mirror of
https://github.com/Ocelot-Social-Community/Ocelot-Social.git
synced 2026-04-06 01:25:38 +00:00
Return empty array instead null for "not reviewed"
@mattwr18 why did you add the null check in th resolver?
This commit is contained in:
parent
2f2bf571ed
commit
fdca5b008b
@ -144,7 +144,6 @@ export default {
|
|||||||
})
|
})
|
||||||
try {
|
try {
|
||||||
const txResult = await readTxPromise
|
const txResult = await readTxPromise
|
||||||
if (!txResult[0]) return null
|
|
||||||
reviewed = txResult.map(reportedRecord => {
|
reviewed = txResult.map(reportedRecord => {
|
||||||
const { review, moderator } = reportedRecord
|
const { review, moderator } = reportedRecord
|
||||||
const relationshipWithNestedAttributes = {
|
const relationshipWithNestedAttributes = {
|
||||||
|
|||||||
@ -101,7 +101,7 @@ export const reports = [
|
|||||||
slug: 'bigoted-post',
|
slug: 'bigoted-post',
|
||||||
title: "I'm a bigoted post!",
|
title: "I'm a bigoted post!",
|
||||||
},
|
},
|
||||||
reviewed: null,
|
reviewed: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
__typename: 'Report',
|
__typename: 'Report',
|
||||||
|
|||||||
@ -40,7 +40,7 @@
|
|||||||
<base-icon :name="statusIconName" :class="isDisabled ? '--disabled' : '--enabled'" />
|
<base-icon :name="statusIconName" :class="isDisabled ? '--disabled' : '--enabled'" />
|
||||||
{{ statusText }}
|
{{ statusText }}
|
||||||
</span>
|
</span>
|
||||||
<client-only v-if="report.reviewed">
|
<client-only v-if="isReviewed">
|
||||||
<hc-user
|
<hc-user
|
||||||
:user="moderatorOfLatestReview"
|
:user="moderatorOfLatestReview"
|
||||||
:showAvatar="false"
|
:showAvatar="false"
|
||||||
@ -109,6 +109,10 @@ export default {
|
|||||||
isDisabled() {
|
isDisabled() {
|
||||||
return this.report.resource.disabled
|
return this.report.resource.disabled
|
||||||
},
|
},
|
||||||
|
isReviewed() {
|
||||||
|
const { reviewed } = this.report
|
||||||
|
return reviewed && reviewed.length
|
||||||
|
},
|
||||||
iconName() {
|
iconName() {
|
||||||
if (this.isPost) return 'bookmark'
|
if (this.isPost) return 'bookmark'
|
||||||
else if (this.isComment) return 'comments'
|
else if (this.isComment) return 'comments'
|
||||||
@ -138,12 +142,13 @@ export default {
|
|||||||
return this.isDisabled ? 'eye-slash' : 'eye'
|
return this.isDisabled ? 'eye-slash' : 'eye'
|
||||||
},
|
},
|
||||||
statusText() {
|
statusText() {
|
||||||
if (!this.report.reviewed) return this.$t('moderation.reports.enabled')
|
if (!this.isReviewed) return this.$t('moderation.reports.enabled')
|
||||||
else if (this.isDisabled) return this.$t('moderation.reports.disabledBy')
|
else if (this.isDisabled) return this.$t('moderation.reports.disabledBy')
|
||||||
else return this.$t('moderation.reports.enabledBy')
|
else return this.$t('moderation.reports.enabledBy')
|
||||||
},
|
},
|
||||||
moderatorOfLatestReview() {
|
moderatorOfLatestReview() {
|
||||||
return this.report.reviewed[0].moderator
|
const [latestReview] = this.report.reviewed
|
||||||
|
return latestReview && latestReview.moderator
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user