Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ActionSheets: Remove message arg from showHeaderActionSheet
Browse files Browse the repository at this point in the history
showHeaderActionSheet now takes a stream and topic, rather than a
message, since we only used the stream and topic anyways.

I have tested this commit manually on a mobile device.
WesleyAC committed Mar 18, 2021
1 parent 63d03d5 commit 769d85b
Showing 2 changed files with 10 additions and 11 deletions.
16 changes: 7 additions & 9 deletions src/message/messageActionSheet.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
/* @flow strict-local */
import invariant from 'invariant';
import { Clipboard, Share, Alert } from 'react-native';

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

@@ -386,15 +384,15 @@ export const showHeaderActionSheet = (
ownUser: User,
flags: FlagsState,
}>,
message: Message | Outbox,
stream: string,
topic: string,
): void => {
invariant(message.type === 'stream', 'showHeaderActionSheet: got PM');
const buttonList = constructHeaderActionButtons({
mute: params.mute,
subscriptions: params.subscriptions,
ownUser: params.ownUser,
stream: streamNameOfStreamMessage(message),
topic: message.subject,
stream,
topic,
});
const callback = buttonIndex => {
(async () => {
@@ -405,8 +403,8 @@ export const showHeaderActionSheet = (
auth: params.auth,
ownUser: params.ownUser,
flags: params.flags,
stream: streamNameOfStreamMessage(message),
topic: message.subject,
stream,
topic,
...callbacks,
});
} catch (err) {
@@ -416,7 +414,7 @@ export const showHeaderActionSheet = (
};
showActionSheetWithOptions(
{
title: `#${streamNameOfStreamMessage(message)} > ${message.subject}`,
title: `#${stream} > ${topic}`,
options: buttonList.map(button => callbacks._(button.title)),
cancelButtonIndex: buttonList.length - 1,
},
5 changes: 3 additions & 2 deletions src/webview/handleOutboundEvents.js
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ import type { BackgroundData } from './MessageList';
import type { ShowActionSheetWithOptions } from '../message/messageActionSheet';
import type { JSONableDict } from '../utils/jsonable';
import { showToast } from '../utils/info';
import { pmUiRecipientsFromMessage } from '../utils/recipient';
import { streamNameOfStreamMessage, pmUiRecipientsFromMessage } from '../utils/recipient';
import { isUrlAnImage } from '../utils/url';
import * as logging from '../utils/logging';
import { filterUnreadMessagesInRange } from '../utils/unread';
@@ -218,7 +218,8 @@ const handleLongPress = (
showActionSheetWithOptions,
{ dispatch, _ },
backgroundData,
message,
streamNameOfStreamMessage(message),
message.subject,
);
} else if (message.type === 'private') {
const label = pmUiRecipientsFromMessage(message, backgroundData.ownUser.user_id)

0 comments on commit 769d85b

Please sign in to comment.