Skip to content

Commit

Permalink
Update question.mjs
Browse files Browse the repository at this point in the history
  • Loading branch information
mythz committed Apr 1, 2024
1 parent 95ba8fd commit c1bbb30
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions MyApp/wwwroot/mjs/question.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ const EditQuestion = {
`,
props:['id','createdBy','previewHtml','bus'],
setup(props) {
const { user } = useAuth()
const { user, hasRole } = useAuth()
const isModerator = hasRole('Moderator')
const client = useClient()
const autoform = ref()
const editing = ref(true)
Expand All @@ -301,7 +302,7 @@ const EditQuestion = {
const savedHtml = ref(props.previewHtml || '')
let allTags = localStorage.getItem('data:tags.txt')?.split('\n') || []
const rep = document.querySelector('[data-rep]')?.dataset?.rep || 1
const canUpdate = computed(() => rep.value >= 10 || props.createdBy === user.value?.userName)
const canUpdate = computed(() => rep.value >= 10 || props.createdBy === user.value?.userName || isModerator)

const { createDebounce } = useUtils()
let lastBody = ''
Expand Down Expand Up @@ -485,7 +486,7 @@ const EditAnswer = {
const { user, hasRole } = useAuth()
const isModerator = hasRole('Moderator')
const rep = document.querySelector('[data-rep]')?.dataset?.rep || 1
const canUpdate = computed(() => rep.value >= 100 || props.createdBy === user.value?.userName)
const canUpdate = computed(() => rep.value >= 100 || props.createdBy === user.value?.userName || isModerator)
const client = useClient()
const autoform = ref()
const editing = ref(true)
Expand Down

0 comments on commit c1bbb30

Please sign in to comment.