From 514eb39a1482f04cf7699ec4fb604fcb419f5485 Mon Sep 17 00:00:00 2001 From: syuilo <Syuilotan@yahoo.co.jp> Date: Mon, 10 Feb 2020 05:03:01 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=A6=E3=83=BC=E3=82=B6=E3=83=BC=E3=83=9A?= =?UTF-8?q?=E3=83=BC=E3=82=B8=E3=81=8B=E3=82=89=E3=82=B0=E3=83=AB=E3=83=BC?= =?UTF-8?q?=E3=83=97=E3=81=AB=E6=8B=9B=E5=BE=85=E3=81=A7=E3=81=8D=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGELOG.md | 1 + locales/ja-JP.yml | 1 + src/client/components/user-menu.vue | 44 +++++++++++++++++++++++++++-- 3 files changed, 44 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a0ff74993..0145a9a6d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,7 @@ unreleased -------------------- ### ✨Improvements * リンクにホバーするとURLプレビューを表示するように +* ユーザーページからグループに招待できるように ### 🐛Fixes * 要素の幅を判定する処理が上手くいかないことがある問題を修正 diff --git a/locales/ja-JP.yml b/locales/ja-JP.yml index 35ca4143ff..d665f756c1 100644 --- a/locales/ja-JP.yml +++ b/locales/ja-JP.yml @@ -377,6 +377,7 @@ enable: "有効にする" next: "次" retype: "再入力" noteOf: "{user}のノート" +inviteToGroup: "グループに招待" _tutorial: title: "Misskeyの使い方" 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