mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-16 22:27:26 +01:00
add shadow-muting chat hiding feature (automatic flagging of public posts from shadow-muted players) - fixes 10851 (#11239)
* move existing tests for chatRevoked users to 'mute user' describe block * give consistent names to chatRevoked tests and use const not let * improve methods for restoring chat permissions to test users * add tests for shadow-muting and define constants for flag-related numbers * update user profile URLs and reverse private/public 'if' statements * implement shadow muting in the API and schemas * add interface for mods to turn shadow muting on/off for a user - checkbox in the Hall - icon in the user's profile * mark chat posts as being shadow muted (marking is visible to mods only) * convert Admin Tools in profile from icons to text; make crown icon a toggle * move logic for displaying flag count to a computed property * prevent chat notifications for shadow-muted posts
This commit is contained in:
@@ -145,7 +145,7 @@ api.getHeroes = {
|
||||
// Note, while the following routes are called getHero / updateHero
|
||||
// they can be used by admins to get/update any user
|
||||
|
||||
const heroAdminFields = 'contributor balance profile.name purchased items auth flags.chatRevoked';
|
||||
const heroAdminFields = 'contributor balance profile.name purchased items auth flags.chatRevoked flags.chatShadowMuted';
|
||||
|
||||
/**
|
||||
* @api {get} /api/v3/hall/heroes/:heroId Get any user ("hero") given the UUID or Username
|
||||
@@ -213,7 +213,10 @@ const gemsPerTier = {1: 3, 2: 3, 3: 3, 4: 4, 5: 4, 6: 4, 7: 4, 8: 0, 9: 0};
|
||||
* {
|
||||
* "balance": 1000,
|
||||
* "auth": {"blocked": false},
|
||||
* "flags": {"chatRevoked": true},
|
||||
* "flags": {
|
||||
* "chatRevoked": true,
|
||||
* "chatShadowMuted": true
|
||||
* },
|
||||
* "purchased": {"ads": true},
|
||||
* "contributor": {
|
||||
* "admin": true,
|
||||
@@ -286,6 +289,7 @@ api.updateHero = {
|
||||
}
|
||||
|
||||
if (updateData.flags && _.isBoolean(updateData.flags.chatRevoked)) hero.flags.chatRevoked = updateData.flags.chatRevoked;
|
||||
if (updateData.flags && _.isBoolean(updateData.flags.chatShadowMuted)) hero.flags.chatShadowMuted = updateData.flags.chatShadowMuted;
|
||||
|
||||
let savedHero = await hero.save();
|
||||
let heroJSON = savedHero.toJSON();
|
||||
|
||||
Reference in New Issue
Block a user