breaking: add unblock button instead of changing text dynamically

This commit is contained in:
Barış Soner Uşaklı
2022-12-24 18:33:48 -05:00
parent d190bf41e0
commit dd3e2c0d96

View File

@@ -54,6 +54,7 @@ define('forum/account/header', [
components.get('account/delete-all').on('click', () => AccountsDelete.purge(ajaxify.data.theirid));
components.get('account/flag').on('click', flagAccount);
components.get('account/block').on('click', toggleBlockAccount);
components.get('account/unblock').on('click', toggleBlockAccount);
};
function selectActivePill() {
@@ -119,7 +120,6 @@ define('forum/account/header', [
}
function toggleBlockAccount() {
const targetEl = this;
socket.emit('user.toggleBlock', {
blockeeUid: ajaxify.data.uid,
blockerUid: app.user.uid,
@@ -127,10 +127,8 @@ define('forum/account/header', [
if (err) {
return alerts.error(err);
}
translator.translate('[[user:' + (blocked ? 'unblock' : 'block') + '_user]]', function (label) {
$(targetEl).text(label);
});
components.get('account/block').toggleClass('hidden', blocked);
components.get('account/unblock').toggleClass('hidden', !blocked);
});
// Keep dropdown open