Skip to content

Node.js based forum software built for the modern web

fix: remove unneeded `flagged` property in favour of flagId, use existing language key for rescind-report

Julian Lam449ffd66c3e7
diff --git a/install/package.json b/install/package.json
index 0566ce5bf2..7839767d2b 100644
--- a/install/package.json
+++ b/install/package.json
@@ -104,7 +104,7 @@
"nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0",
- "nodebb-theme-harmony": "2.0.0-pre.19",
+ "nodebb-theme-harmony": "2.0.0-pre.20",
"nodebb-theme-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.4",
"nodebb-theme-persona": "13.3.18",
diff --git a/public/openapi/components/schemas/UserObject.yaml b/public/openapi/components/schemas/UserObject.yaml
index 9b217cee8b..4bbf83abc3 100644
--- a/public/openapi/components/schemas/UserObject.yaml
+++ b/public/openapi/components/schemas/UserObject.yaml
@@ -443,6 +443,9 @@ UserObjectFull:
type: boolean
canFlag:
type: boolean
+ flagId:
+ type: number
+ nullable: true
canChangePassword:
type: boolean
isSelf:
diff --git a/public/src/modules/flags.js b/public/src/modules/flags.js
index 83684ace51..5eae76d9bb 100644
--- a/public/src/modules/flags.js
+++ b/public/src/modules/flags.js
@@ -70,7 +70,7 @@ define('flags', ['hooks', 'components', 'api', 'alerts'], function (hooks, compo
Flag.rescind = function (flagId) {
api.del(`/flags/${flagId}/report`).then(() => {
- alerts.success('[[flags:rescinded]]');
+ alerts.success('[[flags:report-rescinded]]');
hooks.fire('action:flag.rescinded', { flagId: flagId });
}).catch(alerts.error);
};
diff --git a/src/controllers/accounts/helpers.js b/src/controllers/accounts/helpers.js
index ca4fffb7ad..ef0c9e1499 100644
--- a/src/controllers/accounts/helpers.js
+++ b/src/controllers/accounts/helpers.js
@@ -87,8 +87,7 @@ helpers.getUserDataByUserSlug = async function (userslug, callerUID, query = {})
userData.canBan = results.canBanUser;
userData.canMute = results.canMuteUser;
userData.canFlag = canFlag.flag;
- userData.flagged = flagged;
- userData.flagId = flagId;
+ userData.flagId = flagged ? flagId : null;
userData.canChangePassword = isAdmin || (isSelf && !meta.config['password:disableEdit']);
userData.isSelf = isSelf;
userData.isFollowing = results.isFollowing;
diff --git a/src/flags.js b/src/flags.js
index 9c1def74eb..5d14319f76 100644
--- a/src/flags.js
+++ b/src/flags.js
@@ -354,7 +354,8 @@ Flags.getFlagIdByTarget = async function (type, id) {
throw new Error('[[error:invalid-data]]');
}
- return await method(id, 'flagId');
+ const flagId = await method(id, 'flagId');
+ return utils.isNumber(flagId) ? parseInt(flagId, 10) : flagId;
};
async function modifyNotes(notes) {