fix: open url confirm is Primary color and not destructive

also delete all messages when reinvited to a group we were kicked from
pull/3052/head
Audric Ackermann 9 months ago
parent 522d82d764
commit 79aca9c231

@ -494,8 +494,9 @@
"device": "Device",
"destination": "Destination",
"learnMore": "Learn more",
"linkVisitWarningTitle": "Open this link in your browser?",
"linkVisitWarningTitle": "Open URL",
"linkVisitWarningMessage": "Are you sure you want to open $url$ in your browser?",
"copyUrl": "Copy URL",
"open": "Open",
"audioMessageAutoplayTitle": "Autoplay Audio Messages",
"audioMessageAutoplayDescription": "Autoplay consecutive audio messages.",

@ -59,6 +59,8 @@ import { NoticeBanner } from '../NoticeBanner';
import { SessionSpinner } from '../basic/SessionSpinner';
import { ConversationMessageRequestButtons } from './MessageRequestButtons';
import { RightPanel, StyledRightPanelContainer } from './right-panel/RightPanel';
import { showLinkVisitWarningDialog } from '../dialog/SessionConfirm';
import { useDispatch } from 'react-redux';
const DEFAULT_JPEG_QUALITY = 0.85;
interface State {
@ -671,7 +673,7 @@ function OutdatedLegacyGroupBanner(props: {
selectedConversation: Pick<ReduxConversationType, 'id' | 'isPrivate' | 'isPublic'>;
}) {
const { selectedConversation } = props;
// const dispatch = useDispatch();
const dispatch = useDispatch();
const isLegacyGroup =
!selectedConversation.isPrivate &&
@ -682,7 +684,7 @@ function OutdatedLegacyGroupBanner(props: {
<NoticeBanner
text={window.i18n('upgradeYourGroupBefore')}
onButtonClick={() => {
// showLinkVisitWarningDialog('', dispatch);
showLinkVisitWarningDialog('', dispatch);
throw new Error('TODO'); // fixme audric
}}
icon="externalLink"

@ -219,18 +219,24 @@ export const SessionConfirm = (props: SessionConfirmDialogProps) => {
);
};
export const showLinkVisitWarningDialog = (urlToOpen: string, dispatch: Dispatch<any>) => {
function onClickOk() {
void shell.openExternal(urlToOpen);
}
dispatch(
updateConfirmModal({
title: window.i18n('linkVisitWarningTitle'),
message: window.i18n('linkVisitWarningMessage', [urlToOpen]),
okText: window.i18n('open'),
okTheme: SessionButtonColor.Primary,
cancelText: window.i18n('editMenuCopy'),
cancelText: window.i18n('copyUrl'),
showExitIcon: true,
onClickOk,
onClickClose: () => {

@ -87,7 +87,7 @@ export async function unsendMessagesForEveryoneGroupV2({
await getMessageQueue().sendToGroupV2NonDurably({
message: new GroupUpdateDeleteMemberContentMessage({
createAtNetworkTimestamp: GetNetworkTime.now(),
expirationType: 'unknown', // this is not displayed so not expiring.
expirationType: 'unknown', // GroupUpdateDeleteMemberContentMessage is not displayed so not expiring.
expireTimer: 0,
groupPk,
memberSessionIds: allMessagesFrom,

@ -1101,7 +1101,7 @@ export class ConversationModel extends Backbone.Model<ConversationAttributes> {
if (this.isClosedGroup()) {
if (this.isAdmin(UserUtils.getOurPubKeyStrFromCache())) {
if (this.isClosedGroupV2()) {
if (!PubKey.is03Pubkey(this.id)) {
if (!PubKey.is03Pubkey(this.id)) {
throw new Error('updateExpireTimer v2 group requires a 03 key');
}
const group = await UserGroupsWrapperActions.getGroup(this.id);

@ -357,7 +357,7 @@ export async function handleNewClosedGroup(
members,
admins,
activeAt: envelopeTimestamp,
expirationType: 'unknown',
expirationType: 'unknown', // group creation message, is not expiring
expireTimer: 0,
};

@ -30,6 +30,7 @@ import {
UserGroupsWrapperActions,
} from '../../webworker/workers/browser/libsession_worker_interface';
import { WithMessageHash } from '../../session/types/with';
import { deleteAllMessagesByConvoIdNoConfirmation } from '../../interactions/conversationInteractions';
type WithSignatureTimestamp = { signatureTimestamp: number };
type WithAuthor = { author: PubkeyType };
@ -66,7 +67,7 @@ async function sendInviteResponseToGroup({ groupPk }: { groupPk: GroupPubkeyType
groupPk,
isApproved: true,
createAtNetworkTimestamp: GetNetworkTime.now(),
expirationType: 'unknown', // an invite should not expire
expirationType: 'unknown', // an invite response should not expire
expireTimer: 0,
}),
});
@ -124,6 +125,7 @@ async function handleGroupInviteMessage({
const userEd25519Secretkey = (await UserUtils.getUserED25519KeyPairBytes()).privKeyBytes;
let found = await UserGroupsWrapperActions.getGroup(groupPk);
const wasKicked = found?.kicked || false;
if (!found) {
found = {
authData: null,
@ -153,6 +155,12 @@ async function handleGroupInviteMessage({
await SessionUtilConvoInfoVolatile.insertConvoFromDBIntoWrapperAndRefresh(convo.id);
if (wasKicked && !found.kicked) {
// we have been reinvited to a group which we had been kicked from.
// Let's empty the conversation again to remove any "you were removed from the group" control message
await deleteAllMessagesByConvoIdNoConfirmation(groupPk);
}
await MetaGroupWrapperActions.init(groupPk, {
metaDumped: null,
groupEd25519Secretkey: null,

@ -173,7 +173,7 @@ class GroupPendingRemovalsJob extends PersistedJob<GroupPendingRemovalsPersisted
if (deleteMessagesOfMembers.length) {
const deleteContentMsg = new GroupUpdateDeleteMemberContentMessage({
createAtNetworkTimestamp: GetNetworkTime.now(),
expirationType: 'unknown', // this is not displayed so not expiring.
expirationType: 'unknown', // GroupUpdateDeleteMemberContentMessage this is not displayed so not expiring.
expireTimer: 0,
groupPk,
memberSessionIds: deleteMessagesOfMembers,

@ -71,6 +71,7 @@ export type LocalizerKeys =
| 'clear'
| 'clearAll'
| 'clearAllConfirmationBody'
| 'clearAllConfirmationTitle'
| 'clearAllData'
| 'clearAllReactions'
| 'clearDataSettingsTitle'
@ -105,6 +106,7 @@ export type LocalizerKeys =
| 'copyMessage'
| 'copyOpenGroupURL'
| 'copySessionID'
| 'copyUrl'
| 'couldntFindServerMatching'
| 'create'
| 'createAccount'

Loading…
Cancel
Save