mirror of
https://github.com/nagisa77/OpenIsle.git
synced 2026-02-22 22:21:09 +08:00
Merge pull request #189 from nagisa77/codex/add-admin-deletion-for-articles-and-comments
Allow admin delete on FE
This commit is contained in:
@@ -103,8 +103,9 @@ const CommentItem = {
|
||||
showEditor.value = !showEditor.value
|
||||
}
|
||||
const isAuthor = computed(() => authState.username === props.comment.userName)
|
||||
const isAdmin = computed(() => authState.role === 'ADMIN')
|
||||
const commentMenuItems = computed(() =>
|
||||
isAuthor.value ? [{ text: '删除评论', color: 'red', onClick: () => deleteComment() }] : []
|
||||
(isAuthor.value || isAdmin.value) ? [{ text: '删除评论', color: 'red', onClick: () => deleteComment() }] : []
|
||||
)
|
||||
const deleteComment = async () => {
|
||||
const token = getToken()
|
||||
|
||||
@@ -140,7 +140,7 @@ export default {
|
||||
const isAuthor = computed(() => authState.username === author.value.username)
|
||||
const articleMenuItems = computed(() => {
|
||||
const items = []
|
||||
if (isAuthor.value) {
|
||||
if (isAuthor.value || isAdmin.value) {
|
||||
items.push({ text: '删除文章', color: 'red', onClick: () => deletePost() })
|
||||
}
|
||||
if (isAdmin.value && status.value === 'PENDING') {
|
||||
|
||||
Reference in New Issue
Block a user