diff options
| author | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-10 05:03:01 +0900 |
|---|---|---|
| committer | syuilo <Syuilotan@yahoo.co.jp> | 2020-02-10 05:03:01 +0900 |
| commit | 514eb39a1482f04cf7699ec4fb604fcb419f5485 (patch) | |
| tree | 7dd208277200318072d1b2c156959c8308eec7bc /src | |
| parent | Better title adjust logic (diff) | |
| download | misskey-514eb39a1482f04cf7699ec4fb604fcb419f5485.tar.gz misskey-514eb39a1482f04cf7699ec4fb604fcb419f5485.tar.bz2 misskey-514eb39a1482f04cf7699ec4fb604fcb419f5485.zip | |
ユーザーページからグループに招待できるように
Diffstat (limited to 'src')
| -rw-r--r-- | src/client/components/user-menu.vue | 44 |
1 files changed, 42 insertions, 2 deletions
diff --git a/src/client/components/user-menu.vue b/src/client/components/user-menu.vue index 6e3280031c..b0139380ef 100644 --- a/src/client/components/user-menu.vue +++ b/src/client/components/user-menu.vue @@ -4,7 +4,7 @@ <script lang="ts"> import Vue from 'vue'; -import { faAt, faListUl, faEye, faEyeSlash, faBan, faPencilAlt, faComments } from '@fortawesome/free-solid-svg-icons'; +import { faAt, faListUl, faEye, faEyeSlash, faBan, faPencilAlt, faComments, faUsers } from '@fortawesome/free-solid-svg-icons'; import { faSnowflake, faEnvelope } from '@fortawesome/free-regular-svg-icons'; import i18n from '../i18n'; import XMenu from './menu.vue'; @@ -43,7 +43,11 @@ export default Vue.extend({ icon: faListUl, text: this.$t('addToList'), action: this.pushList - }] as any; + }, this.$store.state.i.id != this.user.id ? { + icon: faUsers, + text: this.$t('inviteToGroup'), + action: this.inviteGroup + } : undefined] as any; if (this.$store.getters.isSignedIn && this.$store.state.i.id != this.user.id) { menu = menu.concat([null, { @@ -118,6 +122,42 @@ export default Vue.extend({ }); }, + async inviteGroup() { + const groups = await this.$root.api('users/groups/owned'); + if (groups.length === 0) { + this.$root.dialog({ + type: 'error', + text: this.$t('youHaveNoGroups') + }); + return; + } + const { canceled, result: groupId } = await this.$root.dialog({ + type: null, + title: this.$t('group'), + select: { + items: groups.map(group => ({ + value: group.id, text: group.name + })) + }, + showCancelButton: true + }); + if (canceled) return; + this.$root.api('users/groups/invite', { + groupId: groupId, + userId: this.user.id + }).then(() => { + this.$root.dialog({ + type: 'success', + iconOnly: true, autoClose: true + }); + }).catch(e => { + this.$root.dialog({ + type: 'error', + text: e + }); + }); + }, + async toggleMute() { this.$root.api(this.user.isMuted ? 'mute/delete' : 'mute/create', { userId: this.user.id |