Bug fixes

This commit is contained in:
Chi Vinh Le
2018-01-26 17:28:21 +01:00
parent b638b783fe
commit 3fa2af975c
3 changed files with 11 additions and 14 deletions
+7 -2
View File
@@ -7,11 +7,16 @@ import { getDefinitionName } from 'coral-framework/utils';
export default withQuery(
gql`
query TalkAdmin_Header {
query TalkAdmin_Header($nullID: ID) {
...${getDefinitionName(ModerationIndicator.fragments.root)}
...${getDefinitionName(CommunityIndicator.fragments.root)}
}
${ModerationIndicator.fragments.root}
${CommunityIndicator.fragments.root}
`
`,
{
options: {
variables: { nullID: null },
},
}
)(Header);
@@ -188,11 +188,14 @@ const enhance = compose(
withFragments({
root: gql`
fragment TalkAdmin_Moderation_Indicator_root on RootQuery {
premodCount: commentCount(query: { statuses: [PREMOD] })
premodCount: commentCount(
query: { statuses: [PREMOD], asset_id: $nullID }
)
reportedCount: commentCount(
query: {
statuses: [NONE, PREMOD, SYSTEM_WITHHELD]
action_type: FLAG
asset_id: $nullID
}
)
}
@@ -112,23 +112,12 @@ function getOlderDate(a, b) {
function determineLatestChange(comment) {
let lc = null;
// Skip it when comment itself was not updated.
// We'll use the one from the status_history instead
// as they might diverge a little bit (status_history item is created
// before the comment itself)
if (comment.createdAt !== comment.updatedAt) {
lc = getOlderDate(lc, comment.createdAt);
lc = getOlderDate(lc, comment.updatedAt);
}
comment.status_history.forEach(item => {
lc = getOlderDate(lc, item.created_at);
lc = getOlderDate(lc, item.updated_at);
});
comment.actions.forEach(item => {
lc = getOlderDate(lc, item.created_at);
lc = getOlderDate(lc, item.updated_at);
});
return lc;