Disabled story replies when no longer a member of the group

This commit is contained in:
Alvaro 2022-10-14 08:03:37 -06:00 committed by GitHub
parent c7a6dee81a
commit 7483fe9f82
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 42 additions and 12 deletions

View file

@ -5711,6 +5711,10 @@
"message": "Reacted to the story", "message": "Reacted to the story",
"description": "Description of someone reacting to a story" "description": "Description of someone reacting to a story"
}, },
"icu:StoryViewsNRepliesModal__not-a-member": {
"messageformat": "You cant reply to this story because youre longer a member of this group.",
"description": "Shown in the composer area of the reply-to-story modal when a user can't make a reply because they are no longer a member"
},
"StoryListItem__label": { "StoryListItem__label": {
"message": "Story", "message": "Story",
"description": "aria-label for the story list button" "description": "aria-label for the story list button"

View file

@ -58,6 +58,13 @@
} }
} }
&__not-a-member {
margin: 24px 4px 8px 4px;
font-size: 12px;
text-align: center;
color: $color-gray-25;
}
&__input { &__input {
&__input { &__input {
// For specificity because StoryViewsNRepliesModal is always in dark-theme // For specificity because StoryViewsNRepliesModal is always in dark-theme

View file

@ -62,6 +62,7 @@ export type PropsType = {
| 'sharedGroupNames' | 'sharedGroupNames'
| 'sortedGroupMembers' | 'sortedGroupMembers'
| 'title' | 'title'
| 'left'
>; >;
hasActiveCall?: boolean; hasActiveCall?: boolean;
hasAllStoriesMuted: boolean; hasAllStoriesMuted: boolean;
@ -791,7 +792,7 @@ export const StoryViewer = ({
hasReadReceiptSetting={hasReadReceiptSetting} hasReadReceiptSetting={hasReadReceiptSetting}
hasViewsCapability={isSent} hasViewsCapability={isSent}
i18n={i18n} i18n={i18n}
isGroupStory={isGroupStory} group={group}
onClose={() => setCurrentViewTarget(null)} onClose={() => setCurrentViewTarget(null)}
onReact={emoji => { onReact={emoji => {
onReactToStory(emoji, story); onReactToStory(emoji, story);

View file

@ -207,7 +207,7 @@ NoViews.storyName = 'No views';
export const InAGroupNoReplies = Template.bind({}); export const InAGroupNoReplies = Template.bind({});
InAGroupNoReplies.args = { InAGroupNoReplies.args = {
isGroupStory: true, group: {},
}; };
InAGroupNoReplies.storyName = 'In a group (no replies)'; InAGroupNoReplies.storyName = 'In a group (no replies)';
@ -216,7 +216,7 @@ export const InAGroup = Template.bind({});
const { views, replies } = getViewsAndReplies(); const { views, replies } = getViewsAndReplies();
InAGroup.args = { InAGroup.args = {
hasViewsCapability: true, hasViewsCapability: true,
isGroupStory: true, group: {},
replies, replies,
views, views,
}; };
@ -233,7 +233,7 @@ export const InAGroupCantReply = Template.bind({});
const { views, replies } = getViewsAndReplies(); const { views, replies } = getViewsAndReplies();
InAGroupCantReply.args = { InAGroupCantReply.args = {
canReply: false, canReply: false,
isGroupStory: true, group: {},
replies, replies,
views, views,
}; };
@ -249,13 +249,23 @@ ReadReceiptsTurnedOff.args = {
}; };
ReadReceiptsTurnedOff.storyName = 'Read receipts turned off'; ReadReceiptsTurnedOff.storyName = 'Read receipts turned off';
export const InAGroupButLeft = Template.bind({});
{
const { replies } = getViewsAndReplies();
InAGroupButLeft.args = {
group: { left: true },
replies,
};
}
InAGroupButLeft.storyName = 'In a group (but left)';
export const GroupReadReceiptsOff = Template.bind({}); export const GroupReadReceiptsOff = Template.bind({});
{ {
const { views, replies } = getViewsAndReplies(); const { views, replies } = getViewsAndReplies();
GroupReadReceiptsOff.args = { GroupReadReceiptsOff.args = {
hasReadReceiptSetting: false, hasReadReceiptSetting: false,
hasViewsCapability: true, hasViewsCapability: true,
isGroupStory: true, group: {},
replies, replies,
views, views,
}; };

View file

@ -97,7 +97,7 @@ export type PropsType = {
hasReadReceiptSetting: boolean; hasReadReceiptSetting: boolean;
hasViewsCapability: boolean; hasViewsCapability: boolean;
i18n: LocalizerType; i18n: LocalizerType;
isGroupStory?: boolean; group: Pick<ConversationType, 'left'> | undefined;
onClose: () => unknown; onClose: () => unknown;
onReact: (emoji: string) => unknown; onReact: (emoji: string) => unknown;
onReply: ( onReply: (
@ -127,7 +127,7 @@ export const StoryViewsNRepliesModal = ({
hasReadReceiptSetting, hasReadReceiptSetting,
hasViewsCapability, hasViewsCapability,
i18n, i18n,
isGroupStory, group,
onClose, onClose,
onReact, onReact,
onReply, onReply,
@ -206,10 +206,16 @@ export const StoryViewsNRepliesModal = ({
} }
}, [currentTab, replies.length]); }, [currentTab, replies.length]);
if (canReply) { if (group && group.left) {
composerElement = (
<div className="StoryViewsNRepliesModal__not-a-member">
{i18n('icu:StoryViewsNRepliesModal__not-a-member')}
</div>
);
} else if (canReply) {
composerElement = ( composerElement = (
<> <>
{!isGroupStory && ( {!group && (
<Quote <Quote
authorTitle={authorTitle} authorTitle={authorTitle}
conversationColor="ultramarine" conversationColor="ultramarine"
@ -243,7 +249,7 @@ export const StoryViewsNRepliesModal = ({
}} }}
onTextTooLong={onTextTooLong} onTextTooLong={onTextTooLong}
placeholder={ placeholder={
isGroupStory group
? i18n('StoryViewer__reply-group') ? i18n('StoryViewer__reply-group')
: i18n('StoryViewer__reply') : i18n('StoryViewer__reply')
} }
@ -380,7 +386,7 @@ export const StoryViewsNRepliesModal = ({
<div ref={bottomRef} /> <div ref={bottomRef} />
</div> </div>
); );
} else if (isGroupStory) { } else if (group) {
repliesElement = ( repliesElement = (
<div className="StoryViewsNRepliesModal__replies--none"> <div className="StoryViewsNRepliesModal__replies--none">
{i18n('StoryViewsNRepliesModal__no-replies')} {i18n('StoryViewsNRepliesModal__no-replies')}
@ -486,7 +492,7 @@ export const StoryViewsNRepliesModal = ({
> >
<div <div
className={classNames({ className={classNames({
'StoryViewsNRepliesModal--group': Boolean(isGroupStory), 'StoryViewsNRepliesModal--group': Boolean(group),
})} })}
> >
{tabsElement || ( {tabsElement || (

View file

@ -236,6 +236,7 @@ export function getConversationStory(
'sharedGroupNames', 'sharedGroupNames',
'sortedGroupMembers', 'sortedGroupMembers',
'title', 'title',
'left',
]); ]);
const storyView = getStoryView( const storyView = getStoryView(

View file

@ -54,6 +54,7 @@ export type ConversationStoryType = {
| 'sharedGroupNames' | 'sharedGroupNames'
| 'sortedGroupMembers' | 'sortedGroupMembers'
| 'title' | 'title'
| 'left'
>; >;
isHidden?: boolean; isHidden?: boolean;
searchNames?: string; // This is just here to satisfy Fuse's types searchNames?: string; // This is just here to satisfy Fuse's types