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

cc @oplik0
This commit is contained in:
Julian Lam
2024-04-30 10:57:25 -04:00
parent 61a595def2
commit 449ffd66c3
5 changed files with 8 additions and 5 deletions

View File

@@ -104,7 +104,7 @@
"nodebb-plugin-ntfy": "1.7.4", "nodebb-plugin-ntfy": "1.7.4",
"nodebb-plugin-spam-be-gone": "2.2.2", "nodebb-plugin-spam-be-gone": "2.2.2",
"nodebb-rewards-essentials": "1.0.0", "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-lavender": "7.1.8",
"nodebb-theme-peace": "2.2.4", "nodebb-theme-peace": "2.2.4",
"nodebb-theme-persona": "13.3.18", "nodebb-theme-persona": "13.3.18",

View File

@@ -443,6 +443,9 @@ UserObjectFull:
type: boolean type: boolean
canFlag: canFlag:
type: boolean type: boolean
flagId:
type: number
nullable: true
canChangePassword: canChangePassword:
type: boolean type: boolean
isSelf: isSelf:

View File

@@ -70,7 +70,7 @@ define('flags', ['hooks', 'components', 'api', 'alerts'], function (hooks, compo
Flag.rescind = function (flagId) { Flag.rescind = function (flagId) {
api.del(`/flags/${flagId}/report`).then(() => { api.del(`/flags/${flagId}/report`).then(() => {
alerts.success('[[flags:rescinded]]'); alerts.success('[[flags:report-rescinded]]');
hooks.fire('action:flag.rescinded', { flagId: flagId }); hooks.fire('action:flag.rescinded', { flagId: flagId });
}).catch(alerts.error); }).catch(alerts.error);
}; };

View File

@@ -87,8 +87,7 @@ helpers.getUserDataByUserSlug = async function (userslug, callerUID, query = {})
userData.canBan = results.canBanUser; userData.canBan = results.canBanUser;
userData.canMute = results.canMuteUser; userData.canMute = results.canMuteUser;
userData.canFlag = canFlag.flag; userData.canFlag = canFlag.flag;
userData.flagged = flagged; userData.flagId = flagged ? flagId : null;
userData.flagId = flagId;
userData.canChangePassword = isAdmin || (isSelf && !meta.config['password:disableEdit']); userData.canChangePassword = isAdmin || (isSelf && !meta.config['password:disableEdit']);
userData.isSelf = isSelf; userData.isSelf = isSelf;
userData.isFollowing = results.isFollowing; userData.isFollowing = results.isFollowing;

View File

@@ -354,7 +354,8 @@ Flags.getFlagIdByTarget = async function (type, id) {
throw new Error('[[error:invalid-data]]'); 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) { async function modifyNotes(notes) {