1
1
/* @flow strict-local */
2
- import invariant from 'invariant' ;
3
2
import { Clipboard , Share , Alert } from 'react-native' ;
4
3
5
4
import * as NavigationService from '../nav/NavigationService' ;
@@ -27,7 +26,6 @@ import * as api from '../api';
27
26
import { showToast } from '../utils/info' ;
28
27
import { doNarrow , deleteOutboxMessage , navigateToEmojiPicker } from '../actions' ;
29
28
import { navigateToMessageReactionScreen } from '../nav/navActions' ;
30
- import { streamNameOfStreamMessage } from '../utils/recipient' ;
31
29
import { deleteMessagesForTopic } from '../topics/topicActions' ;
32
30
import * as logging from '../utils/logging' ;
33
31
@@ -373,7 +371,8 @@ export const showHeaderActionSheet = ({
373
371
showActionSheetWithOptions,
374
372
callbacks,
375
373
backgroundData,
376
- message,
374
+ topic,
375
+ stream,
377
376
} : { |
378
377
showActionSheetWithOptions : ShowActionSheetWithOptions ,
379
378
callbacks : { |
@@ -388,13 +387,13 @@ export const showHeaderActionSheet = ({
388
387
ownUser : User ,
389
388
flags : FlagsState ,
390
389
} > ,
391
- message : Message | Outbox ,
390
+ stream : string ,
391
+ topic : string ,
392
392
| } ) : void => {
393
- invariant ( message . type === 'stream' , 'showHeaderActionSheet: got PM' ) ;
394
393
const buttonList = constructHeaderActionButtons ( {
395
394
backgroundData,
396
- stream : streamNameOfStreamMessage ( message ) ,
397
- topic : message . subject ,
395
+ stream,
396
+ topic,
398
397
} ) ;
399
398
const callback = buttonIndex => {
400
399
( async ( ) => {
@@ -403,8 +402,8 @@ export const showHeaderActionSheet = ({
403
402
await pressedButton ( {
404
403
...backgroundData ,
405
404
...callbacks ,
406
- stream : streamNameOfStreamMessage ( message ) ,
407
- topic : message . subject ,
405
+ stream,
406
+ topic,
408
407
} ) ;
409
408
} catch (err) {
410
409
Alert . alert ( callbacks . _ ( pressedButton . errorMessage ) , err . message ) ;
@@ -413,7 +412,7 @@ export const showHeaderActionSheet = ({
413
412
} ;
414
413
showActionSheetWithOptions (
415
414
{
416
- title : `#${ streamNameOfStreamMessage ( message ) } > ${ message . subject } ` ,
415
+ title : `#${ stream } > ${ topic } ` ,
417
416
options : buttonList . map ( button => callbacks . _ ( button . title ) ) ,
418
417
cancelButtonIndex : buttonList . length - 1 ,
419
418
} ,
0 commit comments