Merge pull request #2112 from Bilb/fix-pin-item-crash
fix crash of app on rendering pin item
This commit is contained in:
commit
1424e13a68
|
@ -11,7 +11,8 @@ import { ContextConversationId } from './ConversationListItem';
|
|||
import { UserItem } from './UserItem';
|
||||
|
||||
const NotificationSettingIcon = (props: { isMessagesSection: boolean }) => {
|
||||
const convoSetting = useSelector(useConversationPropsById)?.currentNotificationSetting;
|
||||
const convoId = useContext(ContextConversationId);
|
||||
const convoSetting = useConversationPropsById(convoId)?.currentNotificationSetting;
|
||||
|
||||
if (!props.isMessagesSection) {
|
||||
return null;
|
||||
|
|
|
@ -155,11 +155,11 @@ export const getPinConversationMenuItem = (conversationId: string): JSX.Element
|
|||
|
||||
if (isMessagesSection) {
|
||||
const conversation = getConversationController().get(conversationId);
|
||||
const isPinned = conversation.isPinned();
|
||||
const isPinned = conversation?.isPinned() || false;
|
||||
|
||||
const togglePinConversation = async () => {
|
||||
if ((!isPinned && nbOfAlreadyPinnedConvos < maxNumberOfPinnedConversations) || isPinned) {
|
||||
await conversation.setIsPinned(!isPinned);
|
||||
await conversation?.setIsPinned(!isPinned);
|
||||
} else {
|
||||
ToastUtils.pushToastWarning(
|
||||
'pinConversationLimitToast',
|
||||
|
|
Loading…
Reference in New Issue