Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MHP-3132-Render-Reported-Stories-and-Comments #1443

Merged
merged 12 commits into from
Feb 5, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,6 @@
"skipComments": true
}
],
"complexity": [
2,
{
"max": 10
}
],
"no-return-await": 2,
"quotes": [
2,
Expand Down
16 changes: 8 additions & 8 deletions src/containers/CelebrateFeedHeader/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,11 @@ const CelebrateFeedHeader = ({
id: orgId,
},
});
const UnreadCommentCount = organization.unread_comments_count;
const ReportedContentCount = ReportedContent.length;
const isReportVisible = shouldQueryReport && ReportedContentCount !== 0;
const unreadCommentCount = organization.unread_comments_count;
const reportedContentCount = ReportedContent.length;
const isReportVisible = shouldQueryReport && reportedContentCount !== 0;
const isCommentCardVisible =
!orgIsGlobal(organization) && UnreadCommentCount !== 0;
!orgIsGlobal(organization) && unreadCommentCount !== 0;

const closeCommentCard = () => {
dispatch(markCommentsRead(orgId));
Expand All @@ -69,29 +69,29 @@ const CelebrateFeedHeader = ({
};

const renderCommentCard = () => {
if (UnreadCommentCount === 0) {
if (unreadCommentCount === 0) {
return null;
}

return (
<UnreadCommentsCard
testID="UnreadCommentsCard"
count={UnreadCommentCount}
count={unreadCommentCount}
onPress={commentCard}
onClose={closeCommentCard}
/>
);
};

const renderReport = () => {
if (loading || ReportedContentCount === 0) {
if (loading || reportedContentCount === 0) {
return null;
}
return (
<ReportItemHeaderCard
testID="ReportItemCard"
onPress={report}
count={ReportedContentCount}
count={reportedContentCount}
/>
);
};
Expand Down
18 changes: 7 additions & 11 deletions src/containers/CommentItem/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,11 @@ const CommentItem = ({
const isMine = person ? person.id === me.id : author.id === me.id;
const isMineNotReported = isMine && !isReported;
const itemDate = created_at ? created_at : createdAt ? createdAt : '';

const personName = () => {
const name = person
? person.first_name
? `${person.first_name} ${person.last_name}`
: person.fullName
: author.fullName;
return name;
};
const name = person
? person.first_name
? `${person.first_name} ${person.last_name}`
: person.fullName
: author.fullName;

const renderContent = () => {
return (
Expand All @@ -82,11 +78,11 @@ const CommentItem = ({
<Flex value={1} />
) : (
<CelebrateItemName
name={personName()}
name={name}
person={person}
organization={organization}
pressable={!isReported}
customContent={<Text style={nameStyle}>{personName()}</Text>}
customContent={<Text style={nameStyle}>{name}</Text>}
/>
)}
<CardTime date={itemDate} format={DateConstants.comment} />
Expand Down
7 changes: 4 additions & 3 deletions src/containers/Groups/GroupReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,11 @@ export const GET_REPORTED_CONTENT = gql`
nodes {
id
subject {
typeName: __typename
__typename
... on Story {
content
createdAt
updatedAt
id
author {
fullName
Expand All @@ -44,6 +45,7 @@ export const GET_REPORTED_CONTENT = gql`
... on CommunityCelebrationItemComment {
content
createdAt
updatedAt
id
person {
fullName
Expand Down Expand Up @@ -80,8 +82,7 @@ const GroupReport = () => {
id: organization.id,
},
});
// eslint-disable-next-line @typescript-eslint/no-explicit-any
const renderItem = ({ item }: { item: ReportedItemInterface | any }) => {
const renderItem = ({ item }: { item: ReportedItemInterface }) => {
return (
<ReportedItem item={item} refetch={refetch} organization={organization} />
);
Expand Down
Loading