fix: merge issues

pull/2963/head
Audric Ackermann 1 year ago
parent 1c6182a235
commit 5e3f968d22

@ -38,8 +38,8 @@ const StyledContent = styled.div`
// We cannot import toastutils from the password window as it is pulling the whole sending
// pipeline(and causing crashes on Session instances with password)
function pushToastError(id: string, title: string, description?: string) {
toast.error(<SessionToast title={title} description={description} />, {
function pushToastError(id: string, description: string) {
toast.error(<SessionToast description={description} />, {
toastId: id,
updateId: id,
});

@ -82,34 +82,6 @@ export const ConversationHeaderTitle = () => {
return null;
}, [i18n, isGroup, isKickedFromGroup, isPublic, selectedMembersCount, subscriberCount]);
<<<<<<< HEAD
// TODO legacy messages support will be removed in a future release
// NOTE If disappearing messages is defined we must show it first
const disappearingMessageSubtitle = useMemo(() => {
const disappearingMessageSettingText =
expirationMode === 'deleteAfterRead'
? window.i18n('disappearingMessagesModeAfterRead')
: expirationMode === 'deleteAfterSend'
? window.i18n('disappearingMessagesModeAfterSend')
: expirationMode === 'legacy'
? isMe || (isGroup && !isPublic)
? window.i18n('disappearingMessagesModeAfterSend')
: window.i18n('disappearingMessagesModeAfterRead')
: null;
const abbreviatedExpireTime = isNumber(expireTimer)
? TimerOptions.getAbbreviated(expireTimer)
: null;
return expireTimer && disappearingMessageSettingText
? `${disappearingMessageSettingText}${
abbreviatedExpireTime ? ` - ${abbreviatedExpireTime}` : ''
}`
: null;
}, [expirationMode, expireTimer, isGroup, isMe, isPublic]);
=======
>>>>>>> unstable
const handleRightPanelToggle = () => {
if (isRightPanelOn) {
dispatch(closeRightPanel());

@ -41,15 +41,13 @@ import { AttachmentTypeWithPath } from '../../../../types/Attachment';
import { getAbsoluteAttachmentPath } from '../../../../types/MessageAttachment';
import { Avatar, AvatarSize } from '../../../avatar/Avatar';
import { Flex } from '../../../basic/Flex';
import { SpacerMD } from '../../../basic/Text';
import { SpacerLG, SpacerMD, SpacerXL } from '../../../basic/Text';
import { PanelButtonGroup, PanelIconButton } from '../../../buttons';
import { MediaItemType } from '../../../lightbox/LightboxGallery';
import { MediaGallery } from '../../media-gallery/MediaGallery';
import { Header, StyledScrollContainer } from './components';
async function getMediaGalleryProps(
conversationId: string
): Promise<{
async function getMediaGalleryProps(conversationId: string): Promise<{
documents: Array<MediaItemType>;
media: Array<MediaItemType>;
}> {
@ -258,18 +256,18 @@ export const OverlayRightPanelSettings = () => {
const leaveGroupString = isPublic
? window.i18n('leaveCommunity')
: lastMessage?.interactionType === ConversationInteractionType.Leave &&
lastMessage?.interactionStatus === ConversationInteractionStatus.Error
? window.i18n('deleteConversation')
: isKickedFromGroup
? window.i18n('youGotKickedFromGroup')
: window.i18n('leaveGroup');
lastMessage?.interactionStatus === ConversationInteractionStatus.Error
? window.i18n('deleteConversation')
: isKickedFromGroup
? window.i18n('youGotKickedFromGroup')
: window.i18n('leaveGroup');
const showUpdateGroupNameButton = isGroup && weAreAdmin && !commonNoShow; // legacy groups non-admin cannot change groupname anymore
const showAddRemoveModeratorsButton = weAreAdmin && !commonNoShow && isPublic;
const showUpdateGroupMembersButton = !isPublic && isGroup && !commonNoShow;
const deleteConvoAction = async () => {
await showLeaveGroupByConvoId(selectedConvoKey, selectedUsername);
const deleteConvoAction = () => {
void showLeaveGroupByConvoId(selectedConvoKey, selectedUsername);
};
return (
@ -338,7 +336,7 @@ export const OverlayRightPanelSettings = () => {
<PanelIconButton
text={leaveGroupString}
dataTestId="leave-group-button"
disabled={isKickedFromGroup || left}
disabled={isKickedFromGroup}
onClick={() => void deleteConvoAction()}
color={'var(--danger-color)'}
iconType={'delete'}

@ -7,7 +7,8 @@ import {
ConversationInteractionStatus,
ConversationInteractionType,
} from '../../../interactions/conversationInteractions';
import { getConversationController } from '../../../session/conversations';
import { ConvoHub } from '../../../session/conversations';
import { LastMessageType } from '../../../state/ducks/conversations';
import { assertUnreachable } from '../../../types/sqlSharedTypes';
import { MessageBody } from '../../conversation/message/message-content/MessageBody';
@ -34,7 +35,7 @@ export const InteractionItem = (props: InteractionItemProps) => {
// NOTE we want to reset the interaction state when the last message changes
useEffect(() => {
if (conversationId) {
const convo = getConversationController().get(conversationId);
const convo = ConvoHub.use().get(conversationId);
if (storedLastMessageInteractionStatus !== convo.get('lastMessageInteractionStatus')) {
setStoredLastMessageInteractionStatus(convo.get('lastMessageInteractionStatus'));
@ -64,15 +65,15 @@ export const InteractionItem = (props: InteractionItemProps) => {
errorText = isCommunity
? window.i18n('leaveCommunityFailed')
: isGroup
? window.i18n('leaveGroupFailed')
: window.i18n('deleteConversationFailed');
? window.i18n('leaveGroupFailed')
: window.i18n('deleteConversationFailed');
text =
interactionStatus === ConversationInteractionStatus.Error
? errorText
: interactionStatus === ConversationInteractionStatus.Start ||
interactionStatus === ConversationInteractionStatus.Loading
? window.i18n('leaving')
: text;
interactionStatus === ConversationInteractionStatus.Loading
? window.i18n('leaving')
: text;
break;
default:
assertUnreachable(

@ -126,6 +126,7 @@ export const DeletePrivateContactMenuItem = () => {
await ConvoHub.use().delete1o1(convoId, {
fromSyncMessage: false,
justHidePrivate: false,
keepMessages: false,
});
},
})
@ -155,9 +156,9 @@ export const LeaveGroupOrCommunityMenuItem = () => {
{isPublic
? window.i18n('leaveCommunity')
: lastMessage?.interactionType === ConversationInteractionType.Leave &&
lastMessage?.interactionStatus === ConversationInteractionStatus.Error
? window.i18n('deleteConversation')
: window.i18n('leaveGroup')}
lastMessage?.interactionStatus === ConversationInteractionStatus.Error
? window.i18n('deleteConversation')
: window.i18n('leaveGroup')}
</Item>
);
}
@ -542,8 +543,8 @@ export const NotificationForConvoMenuItem = (): JSX.Element | null => {
n === 'all' || !n
? 'notificationForConvo_all'
: n === 'disabled'
? 'notificationForConvo_disabled'
: 'notificationForConvo_mentions_only';
? 'notificationForConvo_disabled'
: 'notificationForConvo_mentions_only';
return { value: n, name: window.i18n(keyToUse) };
});

@ -341,6 +341,7 @@ async function deleteContactsFromDB(contactsToRemove: Array<string>) {
await ConvoHub.use().delete1o1(contactToRemove, {
fromSyncMessage: true,
justHidePrivate: false,
keepMessages: false,
});
} catch (e) {
window.log.warn(

@ -49,7 +49,7 @@ import {
} from '../../webworker/workers/browser/libsession_worker_interface';
import { StateType } from '../reducer';
import { openConversationWithMessages } from './conversations';
import { resetOverlayMode } from './section';
import { resetLeftOverlayMode } from './section';
type WithAddWithoutHistoryMembers = { withoutHistory: Array<PubkeyType> };
type WithAddWithHistoryMembers = { withHistory: Array<PubkeyType> };
@ -195,7 +195,7 @@ const initNewGroupInWrapper = createAsyncThunk(
convo.set({ active_at: Date.now() });
await convo.commit();
convo.updateLastMessage();
dispatch(resetOverlayMode());
dispatch(resetLeftOverlayMode());
// Everything is setup for this group, we now need to send the invites to each members,
// privately and asynchronously, and gracefully handle errors with toasts.

Loading…
Cancel
Save