Skip to content

Commit 4d14ee2

Browse files
authored
Merge pull request #552 from GetStream/message-bounce-flow
Message bounce flow
2 parents 965f190 + 8fcb2f9 commit 4d14ee2

37 files changed

+864
-410
lines changed
910 KB
Loading

docusaurus/docs/Angular/components/ChannelComponent.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
The `Channel` component is a container component that displays the [`ChannelHeader`](./ChannelHeaderComponent.mdx), [`MessageList`](./MessageListComponent.mdx), [`NotificationList`](./NotificationListComponent.mdx) and [`MessageInput`](./MessageInputComponent.mdx) components. You can also provide the [`Thread`](./ThreadComponent.mdx) component to use message [threads](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
1+
The `Channel` component is a container component that displays the [`ChannelHeader`](./ChannelHeaderComponent.mdx), [`MessageList`](./MessageListComponent.mdx), [`NotificationList`](./NotificationListComponent.mdx), [`EditMessageForm`](./EditMessageFormComponent.mdx), [`MessageBouncePrompt`](./MessageBouncePromptComponent.mdx) and [`MessageInput`](./MessageInputComponent.mdx) components. You can also provide the [`Thread`](./ThreadComponent.mdx) component to use message [threads](https://getstream.io/chat/docs/javascript/threads/?language=javascript).
22

33
## Usage
44

@@ -25,7 +25,5 @@ The `Channel` component is a container component that displays the [`ChannelHead
2525

2626
The `Channel` component doesn't do any settings, it's just displays its children components. The main purpose of this component is to provide the layout for the initial chat UI.
2727

28-
If you want to create your own channel component check out our [customization guide](../concepts/customization.mdx) for more information.
29-
3028
[//]: # "Start of generated content"
3129
[//]: # "End of generated content"
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
The edit message form displays a modal that's opened when a user edits a message. The component uses the [`MessageActionsService`](../../services/MessageActionsService) to know which message is being edited.
2+
3+
By default this is displayed within the [`stream-channel` component](../../components/ChannelComponent).
4+
5+
## Usage
6+
7+
```typescript
8+
constructor(private messageActionsService: MessageActionsService) {
9+
// Open the modal
10+
this.messageActionsService.messageToEdit$(<stream message>);
11+
// Close the modal
12+
this.messageActionsService.messageToEdit$(undefined);
13+
}
14+
```
15+
16+
```html
17+
<stream-edit-message-form></stream-edit-message-form>
18+
```
19+
20+
## Customization
21+
22+
You can provide your own custom component using the [`customTemplatesService.editMessageFormTemplate$` property](../../services/CustomTemplatesService/#editmessageformtemplate)
23+
24+
[//]: # "Start of generated content"
25+
[//]: # "End of generated content"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
import Screenshot from "../assets/message-bounce-screenshot.png";
2+
3+
The component watches for the [`channelService.bouncedMessage$` stream](../../services/ChannelService/#bouncedmessage) and opens the bounce modal if a message is emitted.
4+
5+
To bounce messages, you need to set up [semantic filters for moderation](https://getstream.io/automated-moderation/docs/automod_configuration/?q=semantic%20filters).
6+
7+
## Usage
8+
9+
To bounce messages, you need to set up [semantic filters for moderation](https://getstream.io/automated-moderation/docs/automod_configuration/?q=semantic%20filters).
10+
11+
When a user tries to send a message that voilates the content guidelines set up by the semantic filter the `StreamMessage` object will have the following format:
12+
13+
- `type` will be `error`
14+
- the `moderation_details` property will contain the details of the error
15+
16+
The built-in [message component](../../components/MessageComponent) will open the bounce prompt when a bounced message is clicked. If you have a custom UI, this is how you can do that:
17+
18+
```typescript
19+
constructor(private channelService: ChannelService) {
20+
// Open the modal
21+
this.messageActionsService.bouncedMessage$(<stream message>);
22+
// Close the modal
23+
this.messageActionsService.bouncedMessage$(undefined);
24+
}
25+
```
26+
27+
The built-in [channel component](../../components/ChannelComponent) displays the `stream-message-bounce-prompt` component. If you have a custom UI, this is how you can do that:
28+
29+
```html
30+
<stream-message-bounce-prompt></stream-message-bounce-prompt>
31+
```
32+
33+
<img src={Screenshot} width="1000" />
34+
35+
## Customization
36+
37+
You can provide your own custom component using the [`customTemplatesService.messageBouncePromptTemplate$` property](../../services/CustomTemplatesService/#messagebounceprompttemplate)
38+
39+
[//]: # "Start of generated content"
40+
[//]: # "End of generated content"

docusaurus/shared

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/Users/zitaszupera/.nvm/versions/node/v16.20.2/bin/../lib/node_modules/stream-chat-docusaurus-cli/shared

package-lock.json

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@
117117
"@ngx-translate/core": "^13.0.0",
118118
"@ngx-translate/http-loader": "^6.0.0",
119119
"@popperjs/core": "^2.11.5",
120-
"@stream-io/stream-chat-css": "4.7.2",
120+
"@stream-io/stream-chat-css": "4.7.4",
121121
"@stream-io/transliterate": "^1.5.2",
122122
"angular-mentions": "^1.4.0",
123123
"dayjs": "^1.10.7",

projects/customizations-example/src/app/app.module.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import { PickerModule } from '@ctrl/ngx-emoji-mart';
1212
import { MessageActionComponent } from './message-action/message-action.component';
1313
import { ThreadHeaderComponent } from './thread-header/thread-header.component';
1414
import { IconComponent } from './icon/icon.component';
15-
import { MessageActionsComponent } from './message-actions/message-actions.component';
1615

1716
@NgModule({
1817
declarations: [
@@ -21,7 +20,6 @@ import { MessageActionsComponent } from './message-actions/message-actions.compo
2120
MessageActionComponent,
2221
ThreadHeaderComponent,
2322
IconComponent,
24-
MessageActionsComponent,
2523
],
2624
imports: [
2725
BrowserModule,

projects/customizations-example/src/app/message-actions/message-actions.component.html

Lines changed: 0 additions & 3 deletions
This file was deleted.

projects/customizations-example/src/app/message-actions/message-actions.component.scss

Whitespace-only changes.

0 commit comments

Comments
 (0)