Skip to content

Commit

Permalink
mark circleVisibility as nullable in ChatItem
Browse files Browse the repository at this point in the history
  • Loading branch information
andreymikhadyuk committed Sep 12, 2023
1 parent d43345d commit 872ce68
Show file tree
Hide file tree
Showing 8 changed files with 6 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/pages/common/components/ChatComponent/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export interface ChatItem {
proposal?: Proposal;
discussion?: Discussion;
chatChannel?: ChatChannel;
circleVisibility: string[];
circleVisibility?: string[];
lastSeenItem?: CommonFeedObjectUserUnique["lastSeen"];
lastSeenAt?: CommonFeedObjectUserUnique["lastSeenAt"];
seenOnce?: boolean;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@ export const checkHasAccessToChat = (
return false;
}

const { circleVisibility = [] } = chatItem;

return (
!chatItem.circleVisibility.length ||
chatItem.circleVisibility.some((circleId) =>
userCircleIds.includes(circleId),
)
!circleVisibility.length ||
circleVisibility.some((circleId) => userCircleIds.includes(circleId))
);
};
1 change: 0 additions & 1 deletion src/pages/commonFeed/CommonFeed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -255,7 +255,6 @@ const CommonFeedComponent: FC<CommonFeedProps> = (props) => {
) {
feedLayoutRef?.setActiveItem({
feedItemId: firstItem.feedItem.id,
circleVisibility: [],
});
dispatch(commonActions.setRecentStreamId(""));
}
Expand Down
5 changes: 1 addition & 4 deletions src/pages/commonFeed/components/FeedLayout/FeedLayout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -492,10 +492,7 @@ const FeedLayout: ForwardRefRenderFunction<FeedLayoutRef, FeedLayoutProps> = (
return;
}

setActiveChatItem({
feedItemId,
circleVisibility: [],
});
setActiveChatItem({ feedItemId });

const itemExists = allFeedItems.some((item) => item.itemId === feedItemId);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const DesktopProfile: FC<DesktopProfileProps> = (props) => {
chatChannel: chatChannel,
discussion:
ChatChannelToDiscussionConverter.toTargetEntity(chatChannel),
circleVisibility: [],
}}
governanceCircles={governanceCircles}
commonId={""}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ const MobileProfile: FC<MobileProfileProps> = (props) => {
chatChannel: chatChannel,
discussion:
ChatChannelToDiscussionConverter.toTargetEntity(chatChannel),
circleVisibility: [],
}}
commonId={""}
commonName={""}
Expand Down
1 change: 0 additions & 1 deletion src/pages/inbox/BaseInbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ const InboxPage: FC<InboxPageProps> = (props) => {
discussion: ChatChannelToDiscussionConverter.toTargetEntity(
chatChannelItem.chatChannel,
),
circleVisibility: [],
});
}, [nextChatChannelItemId, feedLayoutRef]);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ export const ChatChannelItem: FC<ChatChannelFeedLayoutItemProps> = (props) => {
feedItemId: chatChannel.id,
discussion: ChatChannelToDiscussionConverter.toTargetEntity(chatChannel),
chatChannel,
circleVisibility: [],
lastSeenItem: chatChannelUserStatus?.lastSeenChatMessageId
? {
type: LastSeenEntity.DiscussionMessage,
Expand Down

0 comments on commit 872ce68

Please sign in to comment.