Skip to content

Commit

Permalink
Discordのユーザー名形式の変更に対応、反映には再連携が必要
Browse files Browse the repository at this point in the history
  • Loading branch information
mei23 authored and fs5m8 committed Nov 28, 2023
1 parent b50b9f9 commit 9a10726
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
11 changes: 9 additions & 2 deletions src/client/app/common/views/components/integrations.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="nbogcrmo" :v-if="user.twitter || user.github || user.discord">
<x-integration v-if="user.twitter" service="twitter" :url="`https://twitter.com/${user.twitter.screenName}`" :text="user.twitter.screenName" :icon="['fab', 'twitter']"/>
<x-integration v-if="user.github" service="github" :url="`https://github.com/${user.github.login}`" :text="user.github.login" :icon="['fab', 'github']"/>
<x-integration v-if="user.discord" service="discord" :url="`https://discord.com/users/${user.discord.id}`" :text="`${user.discord.username}#${user.discord.discriminator}`" :icon="['fab', 'discord']"/>
<x-integration v-if="user.discord" service="discord" :url="`https://discord.com/users/${user.discord.id}`" :text="discordName" :icon="['fab', 'discord']"/>
</div>
</template>

Expand All @@ -14,7 +14,14 @@ export default Vue.extend({
components: {
XIntegration
},
props: ['user']
props: ['user'],
computed: {
discordName(): string {
return this.user.discord.discriminator === '0'
? `${this.user.discord.username}`
: `${this.user.discord.username}#${this.user.discord.discriminator}`;
},
},
});
</script>

Expand Down
10 changes: 9 additions & 1 deletion src/client/app/common/views/components/settings/integration.vue
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<section v-if="enableDiscordIntegration">
<header><fa :icon="['fab', 'discord']"/> Discord</header>
<p v-if="$store.state.i.discord">{{ $t('connected-to') }}: <a :href="`https://discord.com/users/${$store.state.i.discord.id}`" rel="nofollow noopener" target="_blank">@{{ $store.state.i.discord.username }}#{{ $store.state.i.discord.discriminator }}</a></p>
<p v-if="$store.state.i.discord">{{ $t('connected-to') }}: <a :href="`https://discord.com/users/${$store.state.i.discord.id}`" rel="nofollow noopener" target="_blank">@{{ discordName }}</a></p>
<ui-button v-if="$store.state.i.discord" @click="disconnectDiscord">{{ $t('disconnect') }}</ui-button>
<ui-button v-else @click="connectDiscord">{{ $t('connect') }}</ui-button>
</section>
Expand Down Expand Up @@ -53,6 +53,14 @@ export default Vue.extend({
});
},
computed: {
discordName(): string {
return this.$store.state.i.discord.discriminator === '0'
? `${this.$store.state.i.discord.username}`
: `${this.$store.state.i.discord.username}#${this.$store.state.i.discord.discriminator}`;
},
},
mounted() {
document.cookie = `i=${this.$store.state.i.token};path=/;${(document.location.protocol.startsWith('https') ? ' secure' : '')}`;
this.$watch('$store.state.i', () => {
Expand Down

0 comments on commit 9a10726

Please sign in to comment.