Skip to content

Commit 724c847

Browse files
committed
ActionSheets: Remove message arg from showHeaderActionSheet
showHeaderActionSheet now takes a stream and topic, rather than a message, since we only used the stream and topic anyways.
1 parent be6354e commit 724c847

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

src/message/messageActionSheet.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
/* @flow strict-local */
2-
import invariant from 'invariant';
32
import { Clipboard, Share, Alert } from 'react-native';
43

54
import * as NavigationService from '../nav/NavigationService';
@@ -27,7 +26,6 @@ import * as api from '../api';
2726
import { showToast } from '../utils/info';
2827
import { doNarrow, deleteOutboxMessage, navigateToEmojiPicker } from '../actions';
2928
import { navigateToMessageReactionScreen } from '../nav/navActions';
30-
import { streamNameOfStreamMessage } from '../utils/recipient';
3129
import { deleteMessagesForTopic } from '../topics/topicActions';
3230
import * as logging from '../utils/logging';
3331

@@ -373,7 +371,8 @@ export const showHeaderActionSheet = ({
373371
showActionSheetWithOptions,
374372
callbacks,
375373
backgroundData,
376-
message,
374+
topic,
375+
stream,
377376
}: {|
378377
showActionSheetWithOptions: ShowActionSheetWithOptions,
379378
callbacks: {|
@@ -388,13 +387,13 @@ export const showHeaderActionSheet = ({
388387
ownUser: User,
389388
flags: FlagsState,
390389
}>,
391-
message: Message | Outbox,
390+
stream: string,
391+
topic: string,
392392
|}): void => {
393-
invariant(message.type === 'stream', 'showHeaderActionSheet: got PM');
394393
const buttonList = constructHeaderActionButtons({
395394
backgroundData,
396-
stream: streamNameOfStreamMessage(message),
397-
topic: message.subject,
395+
stream,
396+
topic,
398397
});
399398
const callback = buttonIndex => {
400399
(async () => {
@@ -403,8 +402,8 @@ export const showHeaderActionSheet = ({
403402
await pressedButton({
404403
...backgroundData,
405404
...callbacks,
406-
stream: streamNameOfStreamMessage(message),
407-
topic: message.subject,
405+
stream,
406+
topic,
408407
});
409408
} catch (err) {
410409
Alert.alert(callbacks._(pressedButton.errorMessage), err.message);
@@ -413,7 +412,7 @@ export const showHeaderActionSheet = ({
413412
};
414413
showActionSheetWithOptions(
415414
{
416-
title: `#${streamNameOfStreamMessage(message)} > ${message.subject}`,
415+
title: `#${stream} > ${topic}`,
417416
options: buttonList.map(button => callbacks._(button.title)),
418417
cancelButtonIndex: buttonList.length - 1,
419418
},

src/webview/handleOutboundEvents.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type { BackgroundData } from './MessageList';
99
import type { ShowActionSheetWithOptions } from '../message/messageActionSheet';
1010
import type { JSONableDict } from '../utils/jsonable';
1111
import { showToast } from '../utils/info';
12-
import { pmUiRecipientsFromMessage } from '../utils/recipient';
12+
import { streamNameOfStreamMessage, pmUiRecipientsFromMessage } from '../utils/recipient';
1313
import { isUrlAnImage } from '../utils/url';
1414
import * as logging from '../utils/logging';
1515
import { filterUnreadMessagesInRange } from '../utils/unread';
@@ -218,7 +218,8 @@ const handleLongPress = (
218218
showActionSheetWithOptions,
219219
callbacks: { dispatch, startEditMessage, _ },
220220
backgroundData,
221-
message,
221+
stream: streamNameOfStreamMessage(message),
222+
topic: message.subject,
222223
});
223224
} else if (message.type === 'private') {
224225
const label = pmUiRecipientsFromMessage(message, backgroundData.ownUser.user_id)

0 commit comments

Comments
 (0)