File tree Expand file tree Collapse file tree 2 files changed +22
-9
lines changed
Expand file tree Collapse file tree 2 files changed +22
-9
lines changed Original file line number Diff line number Diff line change @@ -639,14 +639,26 @@ describe('<MessageSimple />', () => {
639639 expect ( results ) . toHaveNoViolations ( ) ;
640640 } ) ;
641641
642- describe ( 'bounced message' , ( ) => {
643- const bouncedMessageOptions = {
644- moderation_details : {
645- action : 'MESSAGE_RESPONSE_ACTION_BOUNCE' ,
642+ describe . each ( [
643+ [
644+ 'v1' ,
645+ {
646+ moderation_details : {
647+ action : 'MESSAGE_RESPONSE_ACTION_BOUNCE' ,
648+ } ,
649+ type : 'error' ,
646650 } ,
647- type : 'error' ,
648- } ;
649-
651+ ] ,
652+ [
653+ 'v2' ,
654+ {
655+ moderation : {
656+ action : 'bounce' ,
657+ } ,
658+ type : 'error' ,
659+ } ,
660+ ] ,
661+ ] ) ( 'bounced message %s' , ( _ , bouncedMessageOptions ) => {
650662 it ( 'should render error badge for bounced messages' , async ( ) => {
651663 const message = generateAliceMessage ( bouncedMessageOptions ) ;
652664 const { queryByTestId } = await renderMessageSimple ( { message } ) ;
Original file line number Diff line number Diff line change @@ -485,10 +485,11 @@ export const isOnlyEmojis = (text?: string) => {
485485export const isMessageBounced = <
486486 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics
487487> (
488- message : Pick < StreamMessage < StreamChatGenerics > , 'type' | 'moderation_details' > ,
488+ message : Pick < StreamMessage < StreamChatGenerics > , 'type' | 'moderation' | ' moderation_details'> ,
489489) =>
490490 message . type === 'error' &&
491- message . moderation_details ?. action === 'MESSAGE_RESPONSE_ACTION_BOUNCE' ;
491+ ( message . moderation_details ?. action === 'MESSAGE_RESPONSE_ACTION_BOUNCE' ||
492+ message . moderation ?. action === 'bounce' ) ;
492493
493494export const isMessageEdited = <
494495 StreamChatGenerics extends DefaultStreamChatGenerics = DefaultStreamChatGenerics
You can’t perform that action at this time.
0 commit comments