File tree Expand file tree Collapse file tree 3 files changed +16
-9
lines changed
Expand file tree Collapse file tree 3 files changed +16
-9
lines changed Original file line number Diff line number Diff line change 11<template >
2- <div class =" inline-block align-middle mb-1" v-if =" rule " >
2+ <div class =" inline-block align-middle mb-1" v-if =" role " >
33 <span
4- v-if =" rule === 'official'"
4+ v-if =" role === 'official'"
55 class =" inline-flex items-center rounded-md px-1.5 pb-0.5 pt-0.75 align-middle text-xs font-semibold transition-colors bg-[#c9353f1a] c-[#d8111b] ml-0.5 scale-80"
66 >
77 {{ message.forum.topic.official }}
88 </span >
99 <span
10- v-if =" rule === 'author'"
10+ v-if =" role === 'author'"
1111 class =" inline-flex items-center rounded-md px-1.5 pb-0.5 pt-0.75 align-middle text-xs font-semibold transition-colors bg-[#2c71ff1a] c-[#0056e3] ml-0.5 scale-80"
1212 >
1313 {{ message.forum.topic.author }}
@@ -29,12 +29,12 @@ let { authorId = null, type = null } = defineProps<{
2929 authorId? : string | number | null
3030}>()
3131
32- const userRule = computed (() => {
32+ const userRole = computed (() => {
3333 if (! authorId ) return null
3434 if (isAuthor (authorId ).value ) return ' author'
3535 if (isOfficial (authorId ).value ) return ' official'
3636 return null
3737})
3838
39- const rule = computed (() => type || userRule .value )
39+ const role = computed (() => type || userRole .value )
4040 </script >
Original file line number Diff line number Diff line change 1414 >
1515 <p >
1616 {{ title }}
17- <ForumRoleBadge :type =" rule " />
17+ <ForumRoleBadge :type =" role " />
1818 </p >
1919 <p class =" mr-2" v-if =" topic.type" >
2020 <span
@@ -130,7 +130,7 @@ const renderText = computed(() => {
130130 if (isAnn .value ) return contentSanitized
131131 return contentSanitized .slice (0 , isExpanded .value ? undefined : 180 )
132132})
133- const rule = computed (() => (isOfficial (author .id ).value ? ' official' : null ))
133+ const role = computed (() => (isOfficial (author .id ).value ? ' official' : null ))
134134const hasOverflow = computed (
135135 () => topic .contentRaw .replace (/ !\[ . *? \]\( . *? \) / g , ' ' ).length > 180 ,
136136)
Original file line number Diff line number Diff line change 1717 <div class =" title flex" :class =" style[size].header" >
1818 <p class =" font-size-3.5" >{{ author.username }}</p >
1919
20- <ForumRoleBadge :type =" rule " />
20+ <ForumRoleBadge :type =" role " />
2121 </div >
2222
2323 <article
@@ -57,6 +57,7 @@ import { computed } from 'vue'
5757import ForumRoleBadge from ' ./ForumRoleBadge.vue'
5858import { Image } from ' @/components/ui/image'
5959import ForumCommentMeta from ' ./ForumCommentMeta.vue'
60+ import { useRuleChecks } from ' ~/composables/useRuleChecks'
6061
6162const {
6263 size = ' normal' ,
@@ -77,7 +78,13 @@ const {
7778 commentClickHandler: Function
7879}>()
7980
80- const rule = computed (() => (topicAuthorId === author .id ? ' author' : null ))
81+ const { isOfficial } = useRuleChecks ()
82+
83+ const role = computed (() => {
84+ if (topicAuthorId === author .id ) return ' author'
85+ if (isOfficial (author .id ).value ) return ' official'
86+ return null
87+ })
8188
8289const style = {
8390 small: {
You can’t perform that action at this time.
0 commit comments