diff --git a/locales/ja.yml b/locales/ja.yml index 75ff13afef..959865ce0d 100644 --- a/locales/ja.yml +++ b/locales/ja.yml @@ -618,9 +618,9 @@ desktop/views/components/ui.header.post.vue: desktop/views/components/ui.header.search.vue: placeholder: "検索" -desktop/views/components/follow-requests-window.vue: +desktop/views/components/received-follow-requests-window.vue: title: "フォロー申請" - accept: "許可" + accept: "承認" reject: "拒否" desktop/views/components/user-lists-window.vue: @@ -852,6 +852,7 @@ mobile/views/components/ui.nav.vue: timeline: "タイムライン" notifications: "通知" messaging: "メッセージ" + follow-requests: "フォロー申請" search: "検索" drive: "ドライブ" favorites: "お気に入り" @@ -900,6 +901,11 @@ mobile/views/pages/messaging.vue: mobile/views/pages/messaging-room.vue: messaging: "メッセージ" +mobile/views/pages/received-follow-requests.vue: + title: "フォロー申請" + accept: "承認" + reject: "拒否" + mobile/views/pages/note.vue: title: "投稿" prev: "前の投稿" diff --git a/src/client/app/desktop/views/components/notifications.vue b/src/client/app/desktop/views/components/notifications.vue index 368655095f..f2247a782c 100644 --- a/src/client/app/desktop/views/components/notifications.vue +++ b/src/client/app/desktop/views/components/notifications.vue @@ -50,7 +50,7 @@ </div> </template> - <template v-if="notification.type == 'reciveFollowRequest'"> + <template v-if="notification.type == 'receiveFollowRequest'"> <mk-avatar class="avatar" :user="notification.user"/> <div class="text"> <p>%fa:user-clock% @@ -268,7 +268,7 @@ root(isDark) .text p i color #53c7ce - &.reciveFollowRequest + &.receiveFollowRequest .text p i color #888 diff --git a/src/client/app/desktop/views/components/follow-requests-window.vue b/src/client/app/desktop/views/components/received-follow-requests-window.vue similarity index 100% rename from src/client/app/desktop/views/components/follow-requests-window.vue rename to src/client/app/desktop/views/components/received-follow-requests-window.vue diff --git a/src/client/app/desktop/views/components/ui.header.account.vue b/src/client/app/desktop/views/components/ui.header.account.vue index 8c2da6596a..4e0fc1cf1a 100644 --- a/src/client/app/desktop/views/components/ui.header.account.vue +++ b/src/client/app/desktop/views/components/ui.header.account.vue @@ -49,7 +49,7 @@ <script lang="ts"> import Vue from 'vue'; import MkUserListsWindow from './user-lists-window.vue'; -import MkFollowRequestsWindow from './follow-requests-window.vue'; +import MkFollowRequestsWindow from './received-follow-requests-window.vue'; import MkSettingsWindow from './settings-window.vue'; import MkDriveWindow from './drive-window.vue'; import contains from '../../../common/scripts/contains'; diff --git a/src/client/app/mobile/script.ts b/src/client/app/mobile/script.ts index 607ff63711..300615ec58 100644 --- a/src/client/app/mobile/script.ts +++ b/src/client/app/mobile/script.ts @@ -32,6 +32,7 @@ import MkNotifications from './views/pages/notifications.vue'; import MkWidgets from './views/pages/widgets.vue'; import MkMessaging from './views/pages/messaging.vue'; import MkMessagingRoom from './views/pages/messaging-room.vue'; +import MkReceivedFollowRequests from './views/pages/received-follow-requests.vue'; import MkNote from './views/pages/note.vue'; import MkSearch from './views/pages/search.vue'; import MkFollowers from './views/pages/followers.vue'; @@ -78,6 +79,7 @@ init((launch) => { { path: '/i/favorites', name: 'favorites', component: MkFavorites }, { path: '/i/lists', name: 'user-lists', component: MkUserLists }, { path: '/i/lists/:list', name: 'user-list', component: MkUserList }, + { path: '/i/received-follow-requests', name: 'received-follow-requests', component: MkReceivedFollowRequests }, { path: '/i/widgets', name: 'widgets', component: MkWidgets }, { path: '/i/messaging', name: 'messaging', component: MkMessaging }, { path: '/i/messaging/:user', component: MkMessagingRoom }, diff --git a/src/client/app/mobile/views/components/notification-preview.vue b/src/client/app/mobile/views/components/notification-preview.vue index 6046f77242..5e2306932b 100644 --- a/src/client/app/mobile/views/components/notification-preview.vue +++ b/src/client/app/mobile/views/components/notification-preview.vue @@ -31,7 +31,7 @@ </div> </template> - <template v-if="notification.type == 'reciveFollowRequest'"> + <template v-if="notification.type == 'receiveFollowRequest'"> <mk-avatar class="avatar" :user="notification.user"/> <div class="text"> <p>%fa:user-clock%{{ notification.user | userName }}</p> @@ -125,7 +125,7 @@ export default Vue.extend({ .text p i color #53c7ce - &.reciveFollowRequest + &.receiveFollowRequest .text p i color #888 diff --git a/src/client/app/mobile/views/components/notification.vue b/src/client/app/mobile/views/components/notification.vue index 8109bef38e..9228950209 100644 --- a/src/client/app/mobile/views/components/notification.vue +++ b/src/client/app/mobile/views/components/notification.vue @@ -40,7 +40,7 @@ </div> </div> - <div class="notification followRequest" v-if="notification.type == 'reciveFollowRequest'"> + <div class="notification followRequest" v-if="notification.type == 'receiveFollowRequest'"> <mk-avatar class="avatar" :user="notification.user"/> <div> <header> @@ -167,7 +167,7 @@ root(isDark) > div > header i color #53c7ce - &.reciveFollowRequest + &.receiveFollowRequest > div > header i color #888 diff --git a/src/client/app/mobile/views/components/ui.nav.vue b/src/client/app/mobile/views/components/ui.nav.vue index 11a8f7ab97..80f60e4232 100644 --- a/src/client/app/mobile/views/components/ui.nav.vue +++ b/src/client/app/mobile/views/components/ui.nav.vue @@ -18,6 +18,7 @@ <li><router-link to="/" :data-active="$route.name == 'index'">%fa:home%%i18n:@timeline%%fa:angle-right%</router-link></li> <li><router-link to="/i/notifications" :data-active="$route.name == 'notifications'">%fa:R bell%%i18n:@notifications%<template v-if="hasUnreadNotification">%fa:circle%</template>%fa:angle-right%</router-link></li> <li><router-link to="/i/messaging" :data-active="$route.name == 'messaging'">%fa:R comments%%i18n:@messaging%<template v-if="hasUnreadMessagingMessage">%fa:circle%</template>%fa:angle-right%</router-link></li> + <li v-if="$store.getters.isSignedIn && $store.state.i.isLocked"><router-link to="/i/received-follow-requests" :data-active="$route.name == 'received-follow-requests'">%fa:R envelope%%i18n:@follow-requests%<template v-if="$store.getters.isSignedIn && $store.state.i.pendingReceivedFollowRequestsCount">%fa:circle%</template>%fa:angle-right%</router-link></li> <li><router-link to="/othello" :data-active="$route.name == 'othello'">%fa:gamepad%%i18n:@game%<template v-if="hasGameInvitation">%fa:circle%</template>%fa:angle-right%</router-link></li> </ul> <ul> diff --git a/src/client/app/mobile/views/pages/received-follow-requests.vue b/src/client/app/mobile/views/pages/received-follow-requests.vue new file mode 100644 index 0000000000..bf26a84ff9 --- /dev/null +++ b/src/client/app/mobile/views/pages/received-follow-requests.vue @@ -0,0 +1,78 @@ +<template> +<mk-ui> + <span slot="header">%fa:envelope R%%i18n:@title%</span> + + <main> + <div v-for="req in requests"> + <router-link :key="req.id" :to="req.follower | userPage">{{ req.follower | userName }}</router-link> + <span> + <a @click="accept(req.follower)">%i18n:@accept%</a>|<a @click="reject(req.follower)">%i18n:@reject%</a> + </span> + </div> + </main> +</mk-ui> +</template> + +<script lang="ts"> +import Vue from 'vue'; +import Progress from '../../../common/scripts/loading'; + +export default Vue.extend({ + data() { + return { + fetching: true, + requests: [] + }; + }, + mounted() { + document.title = 'Misskey | %i18n:@title%'; + + Progress.start(); + + (this as any).api('following/requests/list').then(requests => { + this.fetching = false; + this.requests = requests; + + Progress.done(); + }); + }, + methods: { + accept(user) { + (this as any).api('following/requests/accept', { userId: user.id }).then(() => { + this.requests = this.requests.filter(r => r.follower.id != user.id); + }); + }, + reject(user) { + (this as any).api('following/requests/reject', { userId: user.id }).then(() => { + this.requests = this.requests.filter(r => r.follower.id != user.id); + }); + } + } +}); +</script> + +<style lang="stylus" scoped> +@import '~const.styl' + +main + width 100% + max-width 680px + margin 0 auto + padding 8px + + @media (min-width 500px) + padding 16px + + @media (min-width 600px) + padding 32px + + > div + display flex + padding 16px + border solid 1px isDark ? #1c2023 : #eee + border-radius 4px + + > span + margin 0 0 0 auto + +</style> diff --git a/src/models/notification.ts b/src/models/notification.ts index a17a892541..875c6952b5 100644 --- a/src/models/notification.ts +++ b/src/models/notification.ts @@ -111,7 +111,7 @@ export const pack = (notification: any) => new Promise<any>(async (resolve, reje switch (_notification.type) { case 'follow': - case 'reciveFollowRequest': + case 'receiveFollowRequest': // nope break; case 'mention': diff --git a/src/services/following/requests/create.ts b/src/services/following/requests/create.ts index 836d85090d..fea82b57d8 100644 --- a/src/services/following/requests/create.ts +++ b/src/services/following/requests/create.ts @@ -31,16 +31,16 @@ export default async function(follower: IUser, followee: IUser) { } }); - // Publish reciveRequest event + // Publish receiveRequest event if (isLocalUser(followee)) { - packUser(follower, followee).then(packed => event(followee._id, 'reciveFollowRequest', packed)); + packUser(follower, followee).then(packed => event(followee._id, 'receiveFollowRequest', packed)); packUser(followee, followee, { detail: true }).then(packed => event(followee._id, 'meUpdated', packed)); // 通知を作成 - notify(followee._id, follower._id, 'reciveFollowRequest'); + notify(followee._id, follower._id, 'receiveFollowRequest'); } if (isLocalUser(follower) && isRemoteUser(followee)) {