Node.js based forum software built for the modern web
test: fix tests and use action
Barış Soner Uşaklıacab46e656be
diff --git a/install/package.json b/install/package.jsonindex efce2d924e..e5f676dc87 100644--- a/install/package.json+++ b/install/package.json@@ -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",diff --git a/public/src/client/account/header.js b/public/src/client/account/header.jsindex 9aae8d6a8f..dfa888120b 100644--- a/public/src/client/account/header.js+++ b/public/src/client/account/header.js@@ -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);diff --git a/test/user.js b/test/user.jsindex 421a8c2cf4..4d65ffaa64 100644--- a/test/user.js+++ b/test/user.js@@ -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);