mirror of
https://github.com/IT4Change/Ocelot-Social.git
synced 2025-12-13 07:45:56 +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 {
|
||||
const txResult = await readTxPromise
|
||||
if (!txResult[0]) return null
|
||||
reviewed = txResult.map(reportedRecord => {
|
||||
const { review, moderator } = reportedRecord
|
||||
const relationshipWithNestedAttributes = {
|
||||
|
||||
@ -101,7 +101,7 @@ export const reports = [
|
||||
slug: 'bigoted-post',
|
||||
title: "I'm a bigoted post!",
|
||||
},
|
||||
reviewed: null,
|
||||
reviewed: [],
|
||||
},
|
||||
{
|
||||
__typename: 'Report',
|
||||
|
||||
@ -40,7 +40,7 @@
|
||||
<base-icon :name="statusIconName" :class="isDisabled ? '--disabled' : '--enabled'" />
|
||||
{{ statusText }}
|
||||
</span>
|
||||
<client-only v-if="report.reviewed">
|
||||
<client-only v-if="isReviewed">
|
||||
<hc-user
|
||||
:user="moderatorOfLatestReview"
|
||||
:showAvatar="false"
|
||||
@ -109,6 +109,10 @@ export default {
|
||||
isDisabled() {
|
||||
return this.report.resource.disabled
|
||||
},
|
||||
isReviewed() {
|
||||
const { reviewed } = this.report
|
||||
return reviewed && reviewed.length
|
||||
},
|
||||
iconName() {
|
||||
if (this.isPost) return 'bookmark'
|
||||
else if (this.isComment) return 'comments'
|
||||
@ -138,12 +142,13 @@ export default {
|
||||
return this.isDisabled ? 'eye-slash' : 'eye'
|
||||
},
|
||||
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 return this.$t('moderation.reports.enabledBy')
|
||||
},
|
||||
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