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

feat: add block user option on post context menu #4053

Merged

Conversation

ilasw
Copy link
Contributor

@ilasw ilasw commented Jan 8, 2025

Changes

  • Add block/unblock {user} in post context menu
  • Rename Don't show posts from {source} intoBlock {source} - Ref.
  • Invalidate post cache on block/unblock
  • Add feedId prop in ReportUserModal

Events

Did you introduce any new tracking events?

Experiment

Did you introduce any new experiments?

Manual Testing

Caution

Please make sure existing components are not breaking/affected by this PR

Preview domain

https://mi-717-block-user-on-post-contex.preview.app.daily.dev

Copy link

vercel bot commented Jan 8, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
daily-webapp ✅ Ready (Inspect) Visit Preview Jan 16, 2025 1:58pm
1 Skipped Deployment
Name Status Preview Updated (UTC)
storybook ⬜️ Ignored (Inspect) Jan 16, 2025 1:58pm

@ilasw ilasw changed the title Mi 717 block user on post context menu feat: add block user option on post context menu Jan 8, 2025
Base automatically changed from MI-741 to MI-655-report-and-block-user January 9, 2025 10:05
? `Show posts from ${post?.source?.name}`
: `Don't show posts from ${post?.source?.name}`,
? `Unblock ${post?.source?.name}`
: `Block ${post?.source?.name}`,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feels like the Block can be misleading that it will block the source across the board. Maybe saying "Block Source from this Feed" or something similar. Either way, this is non-blocking. Just some thought about the new labe.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I've raised the issue as well before. I don't like that we use the same wording for a global block and just removing someone of a feed!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This change comes from the slack thread in description, but feel free to propose some changes in slack and I can change in minutes ✔️

Copy link
Contributor

@AmarTrebinjac AmarTrebinjac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!

Only thing is I don't think we should pop the report user modal when blocking on custom feed. There's already a "report" button for the post, and also blocking on a custom feed is more of a filtering action than a true blocking action.

Wdyt?

@ilasw
Copy link
Contributor Author

ilasw commented Jan 15, 2025

@AmarTrebinjac I'm ok with blocking directly without passing through the modal, do we have some specs anywhere about this change? 👀

@AmarTrebinjac
Copy link
Contributor

@AmarTrebinjac I'm ok with blocking directly without passing through the modal, do we have some specs anywhere about this change? 👀

No, it just makes sense to me this way. I'll clarify with product

Copy link
Contributor

@rebelchris rebelchris left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very minor comment, non blocking though.

? `Unblock ${post.author.name}`
: `Block ${post.author.name}`,
action: async () => {
const clearCache = () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe best to abstract this above in it's own function for readability?
(non blocking)

Comment on lines 512 to 513
? `Unblock ${post.author.name}`
: `Block ${post.author.name}`,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be different my feed vs custom feed but raised it here.
https://dailydotdev.slack.com/archives/C07GVUM114N/p1737018718495219?thread_ts=1736422027.072149&cid=C07GVUM114N

Copy link
Contributor

@AmarTrebinjac AmarTrebinjac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're almost there, only one thing:

When you block source, tag etc, they remove the post from the feed by calling showMessageAndRemovePost - we should do the same when blocking user.

@@ -91,6 +97,26 @@ export interface PostOptionsMenuProps {
allowPin?: boolean;
}

const getBlockOrUnblockLabel = (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we could just call this getBlockLabel

Copy link
Contributor

@AmarTrebinjac AmarTrebinjac left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks amazing, great job @ilasw ! 🚀

@ilasw ilasw merged commit 6cb0889 into MI-655-report-and-block-user Jan 16, 2025
10 checks passed
@ilasw ilasw deleted the MI-717-block-user-on-post-context-menu branch January 16, 2025 14:51
AmarTrebinjac added a commit that referenced this pull request Jan 20, 2025
* feat: ReportUserModal (#4051)

* feat: ReportUserModal

* formatting

* lint

* remove unnecessary check

* update conditional

* remove need to pass onClose

* capitalize values

* feat: Add block and report to user profile (#4054)

* feat: ReportUserModal

* formatting

* lint

* remove unnecessary check

* update conditional

* remove need to pass onClose

* capitalize values

* feat: Add block and report to user profile

* feat: Block, report, share on profile available for everyone (#4059)

* feat: Block, report, share on profile available for everyone

* update copy

* update to still show share button when only 1 opt available

* fix: Should not show following when blocked (#4064)

* fix: Should not show following when blocked

* update syntax

* fix: No longer open report modal when reporting user (#4069)

* fix: No longer open report modal when reporting user

* add block request key to status map

* feat: add block user option on post context menu (#4053)

* feat: ReportUserModal

* formatting

* lint

* remove unnecessary check

* update conditional

* feat: add block user option in post context menu

* remove need to pass onClose

* capitalize values

* feat: add optimistic update on unblock

* feat: refactor avoiding additional query

* fix: ssr error

* feat: add contentPreference data for author

* feat: hide follow option for blocked users, change source block label;

* feat: clear cache on block

* feat: block on custom feed feature

* test: update label for block/unblock

* refactor: invalidate cache is not a utility

* feat: added new labels and block directly without report modal

* feat: hide post from feed and add undo action to toast

---------

Co-authored-by: Amar Trebinjac <amartrebinjac@gmail.com>

* update hateful key

* Update packages/shared/src/components/modals/report/ReportUserModal.tsx

Co-authored-by: Lee Hansel Solevilla <13744167+sshanzel@users.noreply.github.com>

* fix: cache invalidation (#4078)

* move query invalidation

* remove unused hook

* remove follow button on profile when blocked

* feat: Remove default add btn in advanced settings, add block btn on u… (#4075)

* feat: Remove default add btn in advanced settings, add block btn on users

* make reusable component

* invalidate specific feed

* undo feed key

* use onsettled to close

* add author block

* use username instead of name

* try invalidate userblocked request key

* use correct username

* remove unnecessary feed invalidation

* fix: block button inside link in source list (#4077)

* feat: Remove default add btn in advanced settings, add block btn on users

* make reusable component

* fix: button inside link

* fix: lint unused var

* fix: moved key from children to parent

* fix: UserList open in new tab

---------

Co-authored-by: Amar Trebinjac <amartrebinjac@gmail.com>
Co-authored-by: Amar Trebinjac <36768584+AmarTrebinjac@users.noreply.github.com>

* fix: invalidation of blocked users for settings

---------

Co-authored-by: Luca Pagliaro <pagliaroluca@gmail.com>
Co-authored-by: Lee Hansel Solevilla <13744167+sshanzel@users.noreply.github.com>
Co-authored-by: capJavert <dev@kickass.website>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants