diff options
Diffstat (limited to 'src/client/app')
| -rw-r--r-- | src/client/app/desktop/views/pages/user/user.profile.vue | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/client/app/desktop/views/pages/user/user.profile.vue b/src/client/app/desktop/views/pages/user/user.profile.vue index fe864f0d7b..a075995e6e 100644 --- a/src/client/app/desktop/views/pages/user/user.profile.vue +++ b/src/client/app/desktop/views/pages/user/user.profile.vue @@ -13,6 +13,10 @@ <span v-if="user.isMuted">%fa:eye% %i18n:@unmute%</span> <span v-if="!user.isMuted">%fa:eye-slash% %i18n:@mute%</span> </ui-button> + <ui-button @click="user.isBlocking ? unblock() : block()" v-if="$store.state.i.id != user.id"> + <span v-if="user.isBlocking">%fa:user% %i18n:@unblock%</span> + <span v-if="!user.isBlocking">%fa:user-slash% %i18n:@block%</span> + </ui-button> <ui-button @click="list">%fa:list% %i18n:@push-to-a-list%</ui-button> </div> </div> @@ -66,6 +70,27 @@ export default Vue.extend({ }); }, + block() { + if (!window.confirm('%i18n:@block-confirm%')) return; + (this as any).api('blocking/create', { + userId: this.user.id + }).then(() => { + this.user.isBlocking = true; + }, () => { + alert('error'); + }); + }, + + unblock() { + (this as any).api('blocking/delete', { + userId: this.user.id + }).then(() => { + this.user.isBlocking = false; + }, () => { + alert('error'); + }); + }, + list() { const w = (this as any).os.new(MkUserListsWindow); w.$once('choosen', async list => { |