User blocking (Following part) (#3035)
* block wip * UndoBlock * UnBlock * wip * follow * UI * fix
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user