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

✨ Allow muting reporter #95

Merged
merged 7 commits into from
Apr 26, 2024
Merged

✨ Allow muting reporter #95

merged 7 commits into from
Apr 26, 2024

Conversation

foysalit
Copy link
Contributor

@foysalit foysalit commented Apr 14, 2024

Depends on bluesky-social/atproto#2390

This PR allows moderators to mute reports from a user. It also adds various indicators in the UI around reporter muting such as

  1. A user's review state shows when the user's reports are muted
  2. A report event will show a tag if the reporter was muted when it came in

It also adds a way for moderators to view ONLY subjects or reporters that have been muted.

Copy link

render bot commented Apr 14, 2024

Copy link

render bot commented Apr 14, 2024

const isCommentEvent = modEventType === MOD_EVENTS.COMMENT
const shouldShowDurationInHoursField =
modEventType === MOD_EVENTS.TAKEDOWN || isMuteEvent
const isReportingMutedForSubject = isMuted(subjectStatus, true)
const shouldShowMuteReportingOnlyField =
isSubjetDid &&
Copy link
Collaborator

Choose a reason for hiding this comment

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

Not related to the work in this PR, but I noticed a typo in this variable name: isSubjetDid vs. isSubjectDid.

@@ -126,6 +127,12 @@ const ResolvedFilters = () => {
onClick: () => updateParams('includeMuted', true),
isActive: includeMuted === 'true',
},
{
id: 'onlyMuted',
text: 'Only Muted',
Copy link
Collaborator

Choose a reason for hiding this comment

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

What results should you get when "only muted" is on?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Only subjects that were muted or reporters that were muted will show up in the queue. This is to provide a quick way to glance through all mutes in case manual reverse/check is necessary.

<ReasonBadge reasonType={modEvent.event.reportType} />
)}
</p>
<div>
Copy link
Collaborator

@devinivy devinivy Apr 24, 2024

Choose a reason for hiding this comment

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

Not sure what the build issue is on this line 🤔

Copy link
Collaborator

Choose a reason for hiding this comment

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

Ohhh, maybe Card's prop types need to be updated.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

did you point at the right line? not seeing any issues here? maybe got cleaned up along the way?

Comment on lines 7 to 9
const field = reportingOnly ? 'muteReportingUntil' : 'muteUntil'
if (!subjectStatus?.[field]) return false
return new Date(`${subjectStatus[field]}`) > new Date()
Copy link
Collaborator

Choose a reason for hiding this comment

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

The types might get loosened here if field gets typed as string. Could always do something like this if it helps:

Suggested change
const field = reportingOnly ? 'muteReportingUntil' : 'muteUntil'
if (!subjectStatus?.[field]) return false
return new Date(`${subjectStatus[field]}`) > new Date()
if (!subjectStatus) return false
const until = reportingOnly ? subjectStatus.muteReportingUntil : subjectStatus.muteUntil
return new Date(until) > new Date()

Copy link
Collaborator

@devinivy devinivy left a comment

Choose a reason for hiding this comment

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

There may be a few build issues unrelated to @atproto/api typings—aside from that, this is looking good to go! 👍

@foysalit foysalit merged commit c9d8908 into main Apr 26, 2024
3 checks passed
@bnewbold bnewbold deleted the mute-reporting branch April 26, 2024 17:15
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.

2 participants