Skip to content

Commit

Permalink
wip isSingleConversation
Browse files Browse the repository at this point in the history
  • Loading branch information
gnprice committed Feb 6, 2020
1 parent 4ef9a13 commit d6a566d
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/message/messageActionSheet.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,8 @@ import type { BackgroundData } from '../webview/MessageList';
import {
getNarrowFromMessage,
isHomeNarrow,
isPrivateOrGroupNarrow,
isSpecialNarrow,
isTopicNarrow,
caseNarrowDefault,
} from '../utils/narrow';
import { isTopicMuted } from '../utils/message';
import * as api from '../api';
Expand Down Expand Up @@ -205,6 +204,14 @@ export const constructHeaderActionButtons = ({
const messageNotDeleted = (message: Message | Outbox): boolean =>
message.content !== '<p>(deleted)</p>';

/** True just if the narrow represents a specific, whole, conversation. */
const isSingleConversation = (narrow: Narrow): boolean =>
caseNarrowDefault(
narrow,
{ topic: () => true, pm: () => true, groupPm: () => true },
() => false,
);

export const constructMessageActionButtons = ({
backgroundData: { ownUser, flags },
message,
Expand All @@ -217,7 +224,7 @@ export const constructMessageActionButtons = ({
if (!isAnOutboxMessage(message) && messageNotDeleted(message)) {
buttons.push('addReaction');
}
if (!isAnOutboxMessage(message) && !isTopicNarrow(narrow) && !isPrivateOrGroupNarrow(narrow)) {
if (!isAnOutboxMessage(message) && !isSingleConversation(narrow)) {
buttons.push('reply');
}
if (messageNotDeleted(message)) {
Expand Down

0 comments on commit d6a566d

Please sign in to comment.