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

Refactor: disable report profile #776

Merged
merged 4 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from 2 commits
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
2 changes: 1 addition & 1 deletion apps/akasha/src/components/feed-page/feed-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ const FeedPage: React.FC<FeedPageProps & RootComponentProps> = props => {
closeLabel={t('Close')}
user={ethAddress ? ethAddress : ''}
contentId={flagged}
contentType={t('post')}
contentType="post"
baseUrl={constants.BASE_FLAG_URL}
size={size}
updateEntry={updateEntry}
Expand Down
7 changes: 7 additions & 0 deletions apps/akasha/src/components/post-page/post-page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -337,6 +337,11 @@ const PostPage: React.FC<IPostPage & RootComponentProps> = props => {
setEntryData(modifiedEntry);
};

const updateEntry = (entryId: string) => {
const modifiedEntry = { ...postsState.postsData[entryId], reported: true };
postsActions.updatePostsState(modifiedEntry);
};

const handleListFlipCard = (entry: any, isQuote: boolean) => () => {
const modifiedEntry = isQuote
? { ...entry, quote: { ...entry.quote, reported: false } }
Expand Down Expand Up @@ -379,8 +384,10 @@ const PostPage: React.FC<IPostPage & RootComponentProps> = props => {
closeLabel={t('Close')}
user={ethAddress ? ethAddress : ''}
contentId={flagged}
contentType="post"
baseUrl={constants.BASE_FLAG_URL}
size={size}
updateEntry={updateEntry}
closeModal={() => {
setReportModalOpen(false);
}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { Box } from 'grommet';
export interface ICardHeaderMenuProps {
target: {};
onMenuClose: () => void;
flagAsLabel: string;
flagAsLabel?: string;
onFlag: () => void;
}

Expand Down
5 changes: 3 additions & 2 deletions ui/design/src/components/Cards/profile-cards/profile-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export interface IProfileCardProps extends IProfileWidgetCard {
changeCoverImageLabel?: string;
cancelLabel?: string;
saveChangesLabel?: string;
flagAsLabel: string;
flagAsLabel?: string;
flaggable: boolean;
onEntryFlag: () => void;
getProfileProvidersData?: () => void;
Expand Down Expand Up @@ -257,7 +257,8 @@ const ProfileCard: React.FC<IProfileCardProps> = props => {
onClick={toggleEditMenu}
/>
)}
{flaggable && loggedEthAddress !== profileData.ethAddress && (
{/* if more options need to be in the dropdown, consider adjusting these conditions */}
{flaggable && !!flagAsLabel?.length && loggedEthAddress !== profileData.ethAddress && (
<Icon type="moreDark" onClick={toggleMenuDrop} clickable={true} ref={menuIconRef} />
)}
</Box>
Expand Down
5 changes: 5 additions & 0 deletions ui/design/src/components/Modals/report/report-modal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ const ReportModal: React.FC<IReportModalProps> = props => {
explanation,
};

// hard check: makes sure contentType is specified
if (!contentType || contentType?.length < 1) {
return handleCancel();
}

setRequesting(true);

postData(baseUrl, dataToPost)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ export const ProfilePageCard = (props: IProfileHeaderProps & RootComponentProps)
closeLabel={t('Close')}
user={loggedUserEthAddress ? loggedUserEthAddress : ''}
contentId={profileData.ethAddress ? profileData.ethAddress : flagged}
contentType={t('profile')}
contentType="profile"
baseUrl={BASE_FLAG_URL}
size={size}
closeModal={closeReportModal}
Expand Down Expand Up @@ -199,7 +199,8 @@ export const ProfilePageCard = (props: IProfileHeaderProps & RootComponentProps)
postsLabel={t('Posts')}
shareProfileLabel={t('Share')}
flaggable={true}
flagAsLabel={t('Report Profile')}
// uncomment this to enable report profile
// flagAsLabel={t('Report Profile')}
onEntryFlag={handleEntryFlag(profileData.ethAddress ? profileData.ethAddress : '')}
/>
</>
Expand Down