mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: fix tests and use action
This commit is contained in:
@@ -103,10 +103,10 @@
|
||||
"nodebb-plugin-ntfy": "1.7.4",
|
||||
"nodebb-plugin-spam-be-gone": "2.2.1",
|
||||
"nodebb-rewards-essentials": "1.0.0",
|
||||
"nodebb-theme-harmony": "1.2.47",
|
||||
"nodebb-theme-harmony": "1.2.48",
|
||||
"nodebb-theme-lavender": "7.1.8",
|
||||
"nodebb-theme-peace": "2.2.4",
|
||||
"nodebb-theme-persona": "13.3.13",
|
||||
"nodebb-theme-persona": "13.3.14",
|
||||
"nodebb-widget-essentials": "7.0.15",
|
||||
"nodemailer": "6.9.11",
|
||||
"nprogress": "0.2.0",
|
||||
|
||||
@@ -56,8 +56,8 @@ define('forum/account/header', [
|
||||
components.get('account/delete-content').on('click', () => AccountsDelete.content(ajaxify.data.theirid));
|
||||
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);
|
||||
components.get('account/block').on('click', () => toggleBlockAccount('block'));
|
||||
components.get('account/unblock').on('click', () => toggleBlockAccount('unblock'));
|
||||
};
|
||||
|
||||
function selectActivePill() {
|
||||
@@ -129,10 +129,11 @@ define('forum/account/header', [
|
||||
});
|
||||
}
|
||||
|
||||
function toggleBlockAccount() {
|
||||
function toggleBlockAccount(action) {
|
||||
socket.emit('user.toggleBlock', {
|
||||
blockeeUid: ajaxify.data.uid,
|
||||
blockerUid: app.user.uid,
|
||||
action,
|
||||
}, function (err, blocked) {
|
||||
if (err) {
|
||||
return alerts.error(err);
|
||||
|
||||
@@ -2457,7 +2457,7 @@ describe('User', () => {
|
||||
|
||||
describe('.toggle()', () => {
|
||||
it('should toggle block', (done) => {
|
||||
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid }, (err) => {
|
||||
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid, action: 'block' }, (err) => {
|
||||
assert.ifError(err);
|
||||
User.blocks.is(blockeeUid, 1, (err, blocked) => {
|
||||
assert.ifError(err);
|
||||
@@ -2468,7 +2468,7 @@ describe('User', () => {
|
||||
});
|
||||
|
||||
it('should toggle block', (done) => {
|
||||
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid }, (err) => {
|
||||
socketUser.toggleBlock({ uid: 1 }, { blockerUid: 1, blockeeUid: blockeeUid, action: 'unblock' }, (err) => {
|
||||
assert.ifError(err);
|
||||
User.blocks.is(blockeeUid, 1, (err, blocked) => {
|
||||
assert.ifError(err);
|
||||
|
||||
Reference in New Issue
Block a user