diff --git a/app/components/board/post/index.ts b/app/components/board/post/index.ts index 7afa5d92..f5e9945c 100644 --- a/app/components/board/post/index.ts +++ b/app/components/board/post/index.ts @@ -78,7 +78,7 @@ export default class PostComponent extends Component { if (typeof this.args.post.message === 'string') { const content = this.contentParser.parsePostContent( this.args.post.message, - { groupId: this.args.post.author.groupId }, + { privileged: this.args.post.author.privileged }, ); return htmlSafe(content); } else { diff --git a/app/config/app.config.ts b/app/config/app.config.ts index fbfcba7f..a31f83dc 100644 --- a/app/config/app.config.ts +++ b/app/config/app.config.ts @@ -52,10 +52,6 @@ export const appConfig = { * The threshold for HTTP timeout warning in milliseconds. */ httpTimeoutWarningThreshold: 5000, - /** - * The default user group id. Other group ids define mods, admins and the like. - */ - standardUserGroupId: '3', /** * The refresh interval for the newsfeed in milliseconds. */ diff --git a/app/models/user.ts b/app/models/user.ts index b15f9bfc..3cd842c8 100644 --- a/app/models/user.ts +++ b/app/models/user.ts @@ -23,7 +23,7 @@ export default class User extends Model { declare age?: string; @attr() - declare groupId?: string; + declare privileged?: boolean; @attr() declare locked?: boolean; diff --git a/app/services/api/types/users.ts b/app/services/api/types/users.ts index 44e5c18c..65c4a229 100644 --- a/app/services/api/types/users.ts +++ b/app/services/api/types/users.ts @@ -7,6 +7,6 @@ export interface Read { activity?: string; status?: string; age?: string; - groupId?: string; locked?: boolean; + privileged: boolean; } diff --git a/app/services/content-parser.ts b/app/services/content-parser.ts index 4623367d..fa84122a 100644 --- a/app/services/content-parser.ts +++ b/app/services/content-parser.ts @@ -24,18 +24,18 @@ export default class ContentParserService extends Service { /** * Parses post content to HTML and returns the result. * @param input The post content containing BBCode and other things. - * @param options.groupId (optional) The author's group id. Will be used to decide whether specific tags should be parsed at all (e.g. `[mod]`). - * Defaults to '3', the value for normal users. + * @param options.privileged (optional) Whether the author is considered privileged. + * Will be used to decide whether specific tags should be parsed at all (e.g. `[mod]`). * @returns The HTML output. */ - parsePostContent(input: string, options?: { groupId?: string }) { - const { groupId } = { groupId: appConfig.standardUserGroupId, ...options }; + parsePostContent(input: string, options?: { privileged?: boolean }) { + const { privileged } = { ...options }; let output = input; output = sanitize(output); output = parseCode(output); output = parseSimpleTags(output); output = parseTex(output); - output = parsePrivilegedTags(output, groupId); + output = parsePrivilegedTags(output, privileged); output = parseImg(output); output = parseVideo(output, window.location); output = parseUrl(output, { diff --git a/app/services/content-parser/privileged-tags.ts b/app/services/content-parser/privileged-tags.ts index 4f78fec2..21ce978a 100644 --- a/app/services/content-parser/privileged-tags.ts +++ b/app/services/content-parser/privileged-tags.ts @@ -1,14 +1,11 @@ -import { appConfig } from 'potber-client/config/app.config'; - /** - * Parses all privileged tags. Privileged will only be parsed if the given `groupId` does not equal 3, - * which is the value for normal users. + * Parses all privileged tags. * @param input The input string. - * @param groupId The group id. + * @param privileged Whether the user is privileged. * @returns The output string. */ -export function parsePrivilegedTags(input: string, groupId: string) { - if (groupId === appConfig.standardUserGroupId) { +export function parsePrivilegedTags(input: string, privileged?: boolean) { + if (!privileged) { return input; } let output = input;