-
Notifications
You must be signed in to change notification settings - Fork 77
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 moderation types #1213
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
myandrienko
requested review from
vishalnarkhede,
santhoshvai,
khushal87,
szuperaz,
oliverlaz,
arnautov-anton and
MartinCupela
as code owners
January 25, 2024 14:26
Size Change: 0 B Total Size: 332 kB ℹ️ View Unchanged
|
myandrienko
commented
Jan 25, 2024
@@ -571,6 +572,18 @@ export type MessageResponseBase< | |||
updated_at?: string; | |||
}; | |||
|
|||
export type ModerationDetailsResponse = { | |||
action: 'MESSAGE_RESPONSE_ACTION_BOUNCE' | (string & {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a known trick to both get nice autocomplete from TS Language Server, and allow any string value at the same time.
oliverlaz
approved these changes
Jan 25, 2024
5 tasks
This was referenced Feb 1, 2024
Merged
myandrienko
added a commit
to GetStream/stream-chat-react
that referenced
this pull request
Feb 9, 2024
### 🎯 Goal 🚂 GetStream/stream-chat-js#1213 🚂 GetStream/stream-chat-css#264 In chats with moderation rules set up, message can bounce if its content is deemed potentially harmful. The author of a bounced message should then be presented with four alternatives: 1. Edit the message and try sending it again 2. Try sending it again as-is (this is helpful for "bounce then flag" flow) 3. Remove the message 4. Do nothing. Bounced messages are ephemeral, so it will soon disappear on its own ### 🛠 Implementation details This PR introduces a couple of new components, including the `MessageBounceModal` which is rendered by `MessageSimple` when a bounced message is clicked. The contents of the modal (`MessageBounceOption`) is an overridable component that should ideally render three buttons for the first three alternative options listed above. The callbacks for said buttons are provided via `MessageBounceContext`. ### 🎨 UI Changes The chat in the screenshot has a semantic filter set up which is triggered by the word "midnight". Here's what a bounced message with the word "midnight" looks like: ![image](https://github.com/GetStream/stream-chat-react/assets/975978/9476cde6-f310-41a8-bb6d-3e7ed0f58421) Clicking on the bounced messages opens `MessageBounceModal`: ![image](https://github.com/GetStream/stream-chat-react/assets/975978/9bbb7201-3342-4ce7-88f2-9a3131c96878) Clicking "Edit Message" opens the standard editing UI: ![image](https://github.com/GetStream/stream-chat-react/assets/975978/ef627801-9b3b-46e5-8d12-eb8b3fd08afd) ### To-Do and Next Steps [The design doc](https://www.figma.com/file/ekifwChR9tR7zRJg1QEzSM/Chat-UI-Kit-1.0-All-platforms?type=design&node-id=23638-313355&mode=design) for this feature also features a notification banner with a button, which is displayed when a message bounces. Clicking the button should bring the user to the bounced message. We don't have a way to have interactive elements within channel notifications at the moment, but this is going to be implemented in further PRs in two steps: 1. Allow passing arbitrary JSX to the notification, not just text 2. Implement a bounced message notification with a button to bring the user to the message - [x] Release `stream-chat-css` with udpated styles - [x] Release `stream-chat-js` with updates types - [x] Cover `MessageBounceModal` and `MessageBounceOptions` with tests - [x] Document new components and customization options - [x] Document the moderation flow
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the changes, What, Why and How?
Added new types for moderation responses, and a new optional property
moderation_details
onMessageResponse
.When the message doesn't pass moderation and is bounced, the response from POST
/channels/:type/:id/message
endpoint containsmoderation_details
. The clients may use this field to properly notify users.The types are based on
https://github.com/GetStream/chat/blob/master/automod/moderation/nnbb.go#L61-L66, since they are not exposed in OpenAPI.
Changelog
moderation_details
inMessageResponseBase
type