Ensure we are always using conversationId for story actions
This commit is contained in:
parent
68adb736d3
commit
37f9346f57
3 changed files with 12 additions and 5 deletions
|
@ -163,6 +163,7 @@ export const StoriesPane = ({
|
||||||
>
|
>
|
||||||
{renderedStories.map(story => (
|
{renderedStories.map(story => (
|
||||||
<StoryListItem
|
<StoryListItem
|
||||||
|
conversationId={story.conversationId}
|
||||||
group={story.group}
|
group={story.group}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
key={story.storyView.timestamp}
|
key={story.storyView.timestamp}
|
||||||
|
@ -190,6 +191,7 @@ export const StoriesPane = ({
|
||||||
{isShowingHiddenStories &&
|
{isShowingHiddenStories &&
|
||||||
hiddenStories.map(story => (
|
hiddenStories.map(story => (
|
||||||
<StoryListItem
|
<StoryListItem
|
||||||
|
conversationId={story.conversationId}
|
||||||
key={story.storyView.timestamp}
|
key={story.storyView.timestamp}
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
isHidden
|
isHidden
|
||||||
|
|
|
@ -20,6 +20,9 @@ export default {
|
||||||
title: 'Components/StoryListItem',
|
title: 'Components/StoryListItem',
|
||||||
component: StoryListItem,
|
component: StoryListItem,
|
||||||
argTypes: {
|
argTypes: {
|
||||||
|
conversationId: {
|
||||||
|
defaultValue: getDefaultConversation().id,
|
||||||
|
},
|
||||||
i18n: {
|
i18n: {
|
||||||
defaultValue: i18n,
|
defaultValue: i18n,
|
||||||
},
|
},
|
||||||
|
|
|
@ -14,6 +14,7 @@ import { StoryImage } from './StoryImage';
|
||||||
import { getAvatarColor } from '../types/Colors';
|
import { getAvatarColor } from '../types/Colors';
|
||||||
|
|
||||||
export type PropsType = Pick<ConversationStoryType, 'group' | 'isHidden'> & {
|
export type PropsType = Pick<ConversationStoryType, 'group' | 'isHidden'> & {
|
||||||
|
conversationId: string;
|
||||||
i18n: LocalizerType;
|
i18n: LocalizerType;
|
||||||
onGoToConversation: (conversationId: string) => unknown;
|
onGoToConversation: (conversationId: string) => unknown;
|
||||||
onHideStory: (conversationId: string) => unknown;
|
onHideStory: (conversationId: string) => unknown;
|
||||||
|
@ -26,6 +27,7 @@ export type PropsType = Pick<ConversationStoryType, 'group' | 'isHidden'> & {
|
||||||
};
|
};
|
||||||
|
|
||||||
export const StoryListItem = ({
|
export const StoryListItem = ({
|
||||||
|
conversationId,
|
||||||
group,
|
group,
|
||||||
i18n,
|
i18n,
|
||||||
isHidden,
|
isHidden,
|
||||||
|
@ -83,7 +85,7 @@ export const StoryListItem = ({
|
||||||
: i18n('StoryListItem__hide'),
|
: i18n('StoryListItem__hide'),
|
||||||
onClick: () => {
|
onClick: () => {
|
||||||
if (isHidden) {
|
if (isHidden) {
|
||||||
onHideStory(sender.id);
|
onHideStory(conversationId);
|
||||||
} else {
|
} else {
|
||||||
setHasConfirmHideStory(true);
|
setHasConfirmHideStory(true);
|
||||||
}
|
}
|
||||||
|
@ -92,18 +94,18 @@ export const StoryListItem = ({
|
||||||
{
|
{
|
||||||
icon: 'StoryListItem__icon--info',
|
icon: 'StoryListItem__icon--info',
|
||||||
label: i18n('StoryListItem__info'),
|
label: i18n('StoryListItem__info'),
|
||||||
onClick: () => viewUserStories(sender.id, true),
|
onClick: () => viewUserStories(conversationId, true),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
icon: 'StoryListItem__icon--chat',
|
icon: 'StoryListItem__icon--chat',
|
||||||
label: i18n('StoryListItem__go-to-chat'),
|
label: i18n('StoryListItem__go-to-chat'),
|
||||||
onClick: () => onGoToConversation(sender.id),
|
onClick: () => onGoToConversation(conversationId),
|
||||||
},
|
},
|
||||||
]}
|
]}
|
||||||
moduleClassName={classNames('StoryListItem', {
|
moduleClassName={classNames('StoryListItem', {
|
||||||
'StoryListItem--hidden': isHidden,
|
'StoryListItem--hidden': isHidden,
|
||||||
})}
|
})}
|
||||||
onClick={() => viewUserStories(sender.id)}
|
onClick={() => viewUserStories(conversationId)}
|
||||||
popperOptions={{
|
popperOptions={{
|
||||||
placement: 'bottom',
|
placement: 'bottom',
|
||||||
strategy: 'absolute',
|
strategy: 'absolute',
|
||||||
|
@ -159,7 +161,7 @@ export const StoryListItem = ({
|
||||||
<ConfirmationDialog
|
<ConfirmationDialog
|
||||||
actions={[
|
actions={[
|
||||||
{
|
{
|
||||||
action: () => onHideStory(sender.id),
|
action: () => onHideStory(conversationId),
|
||||||
style: 'affirmative',
|
style: 'affirmative',
|
||||||
text: i18n('StoryListItem__hide-modal--confirm'),
|
text: i18n('StoryListItem__hide-modal--confirm'),
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue