Move link notification to the conversation hero
This commit is contained in:
parent
5f3a62cbb6
commit
2f44e33c9c
26 changed files with 174 additions and 350 deletions
|
@ -2132,103 +2132,6 @@ button.ConversationDetails__action-button {
|
||||||
color: $color-gray-45;
|
color: $color-gray-45;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Module: Conversation Hero
|
|
||||||
|
|
||||||
.module-conversation-hero {
|
|
||||||
padding: 32px 0 28px 0;
|
|
||||||
text-align: center;
|
|
||||||
|
|
||||||
&__avatar {
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__profile-name {
|
|
||||||
@include font-title-2;
|
|
||||||
margin-bottom: 2px;
|
|
||||||
|
|
||||||
@include light-theme {
|
|
||||||
color: $color-gray-90;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include dark-theme {
|
|
||||||
color: $color-gray-05;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__with {
|
|
||||||
@include font-body-2;
|
|
||||||
margin: 0 auto;
|
|
||||||
margin-bottom: 16px;
|
|
||||||
max-width: 500px;
|
|
||||||
|
|
||||||
@include light-theme {
|
|
||||||
color: $color-gray-60;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include dark-theme {
|
|
||||||
color: $color-gray-25;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__membership {
|
|
||||||
@include font-body-2;
|
|
||||||
|
|
||||||
padding: 0 16px;
|
|
||||||
|
|
||||||
@include light-theme {
|
|
||||||
color: $color-gray-60;
|
|
||||||
}
|
|
||||||
|
|
||||||
@include dark-theme {
|
|
||||||
color: $color-gray-25;
|
|
||||||
}
|
|
||||||
|
|
||||||
&__name {
|
|
||||||
@include font-body-2-bold;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
&__message-request-warning {
|
|
||||||
@include font-body-2;
|
|
||||||
|
|
||||||
&__message {
|
|
||||||
display: flex;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
user-select: none;
|
|
||||||
|
|
||||||
@include light-theme {
|
|
||||||
color: $color-gray-60;
|
|
||||||
}
|
|
||||||
@include dark-theme {
|
|
||||||
color: $color-gray-25;
|
|
||||||
}
|
|
||||||
|
|
||||||
&::before {
|
|
||||||
content: '';
|
|
||||||
display: block;
|
|
||||||
height: 14px;
|
|
||||||
margin-right: 8px;
|
|
||||||
width: 14px;
|
|
||||||
|
|
||||||
@include light-theme {
|
|
||||||
@include color-svg(
|
|
||||||
'../images/icons/v2/info-outline-24.svg',
|
|
||||||
$color-gray-60
|
|
||||||
);
|
|
||||||
}
|
|
||||||
@include dark-theme {
|
|
||||||
@include color-svg(
|
|
||||||
'../images/icons/v2/info-solid-24.svg',
|
|
||||||
$color-gray-25
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Module: Message Request Actions
|
// Module: Message Request Actions
|
||||||
|
|
||||||
.module-message-request-actions {
|
.module-message-request-actions {
|
||||||
|
|
125
stylesheets/components/ConversationHero.scss
Normal file
125
stylesheets/components/ConversationHero.scss
Normal file
|
@ -0,0 +1,125 @@
|
||||||
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
.module-conversation-hero {
|
||||||
|
padding: 32px 0 28px 0;
|
||||||
|
text-align: center;
|
||||||
|
|
||||||
|
&__avatar {
|
||||||
|
margin-bottom: 12px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__profile-name {
|
||||||
|
@include font-title-2;
|
||||||
|
margin-bottom: 2px;
|
||||||
|
|
||||||
|
@include light-theme {
|
||||||
|
color: $color-gray-90;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include dark-theme {
|
||||||
|
color: $color-gray-05;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__with {
|
||||||
|
@include font-body-2;
|
||||||
|
margin: 0 auto;
|
||||||
|
margin-bottom: 16px;
|
||||||
|
max-width: 500px;
|
||||||
|
|
||||||
|
@include light-theme {
|
||||||
|
color: $color-gray-60;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include dark-theme {
|
||||||
|
color: $color-gray-25;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__membership {
|
||||||
|
@include font-body-2;
|
||||||
|
|
||||||
|
padding: 0 16px;
|
||||||
|
|
||||||
|
@include light-theme {
|
||||||
|
color: $color-gray-60;
|
||||||
|
}
|
||||||
|
|
||||||
|
@include dark-theme {
|
||||||
|
color: $color-gray-25;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__name {
|
||||||
|
@include font-body-2-bold;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__message-request-warning {
|
||||||
|
@include font-body-2;
|
||||||
|
|
||||||
|
&__message {
|
||||||
|
display: flex;
|
||||||
|
margin-bottom: 12px;
|
||||||
|
align-items: center;
|
||||||
|
justify-content: center;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
@include light-theme {
|
||||||
|
color: $color-gray-60;
|
||||||
|
}
|
||||||
|
@include dark-theme {
|
||||||
|
color: $color-gray-25;
|
||||||
|
}
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: block;
|
||||||
|
height: 14px;
|
||||||
|
margin-right: 8px;
|
||||||
|
width: 14px;
|
||||||
|
|
||||||
|
@include light-theme {
|
||||||
|
@include color-svg(
|
||||||
|
'../images/icons/v2/info-outline-24.svg',
|
||||||
|
$color-gray-60
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@include dark-theme {
|
||||||
|
@include color-svg(
|
||||||
|
'../images/icons/v2/info-solid-24.svg',
|
||||||
|
$color-gray-25
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__linkNotification {
|
||||||
|
@include font-body-2;
|
||||||
|
text-align: center;
|
||||||
|
user-select: none;
|
||||||
|
|
||||||
|
&::before {
|
||||||
|
content: '';
|
||||||
|
display: inline-block;
|
||||||
|
height: 16px;
|
||||||
|
margin-right: 8px;
|
||||||
|
vertical-align: middle;
|
||||||
|
width: 16px;
|
||||||
|
|
||||||
|
@include light-theme {
|
||||||
|
@include color-svg(
|
||||||
|
'../images/icons/v2/info-outline-24.svg',
|
||||||
|
$color-gray-60
|
||||||
|
);
|
||||||
|
}
|
||||||
|
@include dark-theme {
|
||||||
|
@include color-svg(
|
||||||
|
'../images/icons/v2/info-solid-24.svg',
|
||||||
|
$color-gray-25
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -219,13 +219,6 @@
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
&--icon-unsynced::before {
|
|
||||||
@include system-message-icon(
|
|
||||||
'../images/icons/v2/info-outline-24.svg',
|
|
||||||
'../images/icons/v2/info-solid-24.svg'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
&--icon-verified::before {
|
&--icon-verified::before {
|
||||||
@include system-message-icon(
|
@include system-message-icon(
|
||||||
'../images/icons/v2/check-24.svg',
|
'../images/icons/v2/check-24.svg',
|
||||||
|
|
|
@ -57,6 +57,7 @@
|
||||||
@import './components/ContextMenu.scss';
|
@import './components/ContextMenu.scss';
|
||||||
@import './components/ConversationDetails.scss';
|
@import './components/ConversationDetails.scss';
|
||||||
@import './components/ConversationHeader.scss';
|
@import './components/ConversationHeader.scss';
|
||||||
|
@import './components/ConversationHero.scss';
|
||||||
@import './components/ConversationView.scss';
|
@import './components/ConversationView.scss';
|
||||||
@import './components/CustomColorEditor.scss';
|
@import './components/CustomColorEditor.scss';
|
||||||
@import './components/CustomizingPreferredReactionsModal.scss';
|
@import './components/CustomizingPreferredReactionsModal.scss';
|
||||||
|
|
|
@ -2178,9 +2178,6 @@ export async function startApp(): Promise<void> {
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info('firstRun: disabling post link experience');
|
|
||||||
window.Signal.Util.postLinkExperience.stop();
|
|
||||||
|
|
||||||
// Switch to inbox view even if contact sync is still running
|
// Switch to inbox view even if contact sync is still running
|
||||||
if (
|
if (
|
||||||
window.reduxStore.getState().app.appView === AppViewType.Installer
|
window.reduxStore.getState().app.appView === AppViewType.Installer
|
||||||
|
@ -2647,13 +2644,6 @@ export async function startApp(): Promise<void> {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (window.Signal.Util.postLinkExperience.isActive()) {
|
|
||||||
log.info(
|
|
||||||
'onContactReceived: Adding the message history disclaimer on link'
|
|
||||||
);
|
|
||||||
await conversation.addMessageHistoryDisclaimer();
|
|
||||||
}
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
log.error('onContactReceived error:', Errors.toLogFormat(error));
|
log.error('onContactReceived error:', Errors.toLogFormat(error));
|
||||||
}
|
}
|
||||||
|
@ -2722,12 +2712,6 @@ export async function startApp(): Promise<void> {
|
||||||
|
|
||||||
window.Signal.Data.updateConversation(conversation.attributes);
|
window.Signal.Data.updateConversation(conversation.attributes);
|
||||||
|
|
||||||
if (window.Signal.Util.postLinkExperience.isActive()) {
|
|
||||||
log.info(
|
|
||||||
'onGroupReceived: Adding the message history disclaimer on link'
|
|
||||||
);
|
|
||||||
await conversation.addMessageHistoryDisclaimer();
|
|
||||||
}
|
|
||||||
const { expireTimer } = details;
|
const { expireTimer } = details;
|
||||||
const isValidExpireTimer = typeof expireTimer === 'number';
|
const isValidExpireTimer = typeof expireTimer === 'number';
|
||||||
if (!isValidExpireTimer) {
|
if (!isValidExpireTimer) {
|
||||||
|
|
|
@ -204,6 +204,9 @@ export const ConversationHero = ({
|
||||||
phoneNumber,
|
phoneNumber,
|
||||||
sharedGroupNames,
|
sharedGroupNames,
|
||||||
})}
|
})}
|
||||||
|
<div className="module-conversation-hero__linkNotification">
|
||||||
|
{i18n('messageHistoryUnsynced')}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{isShowingMessageRequestWarning && (
|
{isShowingMessageRequestWarning && (
|
||||||
<ConfirmationDialog
|
<ConfirmationDialog
|
||||||
|
|
|
@ -1,16 +0,0 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
import { storiesOf } from '@storybook/react';
|
|
||||||
import { setupI18n } from '../../util/setupI18n';
|
|
||||||
import enMessages from '../../../_locales/en/messages.json';
|
|
||||||
|
|
||||||
import { LinkNotification } from './LinkNotification';
|
|
||||||
|
|
||||||
const story = storiesOf('Components/Conversation/LinkNotification', module);
|
|
||||||
|
|
||||||
const i18n = setupI18n('en', enMessages);
|
|
||||||
|
|
||||||
story.add('Default', () => <LinkNotification i18n={i18n} />);
|
|
|
@ -1,13 +0,0 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
import * as React from 'react';
|
|
||||||
|
|
||||||
import { SystemMessage } from './SystemMessage';
|
|
||||||
import type { LocalizerType } from '../../types/Util';
|
|
||||||
|
|
||||||
export const LinkNotification = ({
|
|
||||||
i18n,
|
|
||||||
}: Readonly<{ i18n: LocalizerType }>): JSX.Element => (
|
|
||||||
<SystemMessage icon="unsynced" contents={i18n('messageHistoryUnsynced')} />
|
|
||||||
);
|
|
|
@ -337,11 +337,6 @@ const items: Record<string, TimelineItemType> = {
|
||||||
},
|
},
|
||||||
timestamp: Date.now(),
|
timestamp: Date.now(),
|
||||||
},
|
},
|
||||||
'id-15': {
|
|
||||||
type: 'linkNotification',
|
|
||||||
data: null,
|
|
||||||
timestamp: Date.now(),
|
|
||||||
},
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const actions = () => ({
|
const actions = () => ({
|
||||||
|
|
|
@ -417,10 +417,6 @@ storiesOf('Components/Conversation/TimelineItem', module)
|
||||||
startedTime: Date.now(),
|
startedTime: Date.now(),
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
type: 'linkNotification',
|
|
||||||
data: null,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
type: 'profileChange',
|
type: 'profileChange',
|
||||||
data: {
|
data: {
|
||||||
|
|
|
@ -23,7 +23,6 @@ import type {
|
||||||
PropsDataType as DeliveryIssueProps,
|
PropsDataType as DeliveryIssueProps,
|
||||||
} from './DeliveryIssueNotification';
|
} from './DeliveryIssueNotification';
|
||||||
import { DeliveryIssueNotification } from './DeliveryIssueNotification';
|
import { DeliveryIssueNotification } from './DeliveryIssueNotification';
|
||||||
import { LinkNotification } from './LinkNotification';
|
|
||||||
import type { PropsData as ChangeNumberNotificationProps } from './ChangeNumberNotification';
|
import type { PropsData as ChangeNumberNotificationProps } from './ChangeNumberNotification';
|
||||||
import { ChangeNumberNotification } from './ChangeNumberNotification';
|
import { ChangeNumberNotification } from './ChangeNumberNotification';
|
||||||
import type { CallingNotificationType } from '../../util/callingNotification';
|
import type { CallingNotificationType } from '../../util/callingNotification';
|
||||||
|
@ -69,10 +68,6 @@ type DeliveryIssueType = {
|
||||||
type: 'deliveryIssue';
|
type: 'deliveryIssue';
|
||||||
data: DeliveryIssueProps;
|
data: DeliveryIssueProps;
|
||||||
};
|
};
|
||||||
type LinkNotificationType = {
|
|
||||||
type: 'linkNotification';
|
|
||||||
data: null;
|
|
||||||
};
|
|
||||||
type MessageType = {
|
type MessageType = {
|
||||||
type: 'message';
|
type: 'message';
|
||||||
data: Omit<MessageProps, 'renderingContext'>;
|
data: Omit<MessageProps, 'renderingContext'>;
|
||||||
|
@ -129,7 +124,6 @@ export type TimelineItemType = (
|
||||||
| GroupNotificationType
|
| GroupNotificationType
|
||||||
| GroupV1MigrationType
|
| GroupV1MigrationType
|
||||||
| GroupV2ChangeType
|
| GroupV2ChangeType
|
||||||
| LinkNotificationType
|
|
||||||
| MessageType
|
| MessageType
|
||||||
| ProfileChangeNotificationType
|
| ProfileChangeNotificationType
|
||||||
| ResetSessionNotificationType
|
| ResetSessionNotificationType
|
||||||
|
@ -261,8 +255,6 @@ export class TimelineItem extends React.PureComponent<PropsType> {
|
||||||
i18n={i18n}
|
i18n={i18n}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
} else if (item.type === 'linkNotification') {
|
|
||||||
notification = <LinkNotification i18n={i18n} />;
|
|
||||||
} else if (item.type === 'timerNotification') {
|
} else if (item.type === 'timerNotification') {
|
||||||
notification = (
|
notification = (
|
||||||
<TimerNotification {...this.props} {...item.data} i18n={i18n} />
|
<TimerNotification {...this.props} {...item.data} i18n={i18n} />
|
||||||
|
|
1
ts/model-types.d.ts
vendored
1
ts/model-types.d.ts
vendored
|
@ -171,7 +171,6 @@ export type MessageAttributesType = {
|
||||||
| 'group-v2-change'
|
| 'group-v2-change'
|
||||||
| 'incoming'
|
| 'incoming'
|
||||||
| 'keychange'
|
| 'keychange'
|
||||||
| 'message-history-unsynced'
|
|
||||||
| 'outgoing'
|
| 'outgoing'
|
||||||
| 'profile-change'
|
| 'profile-change'
|
||||||
| 'story'
|
| 'story'
|
||||||
|
|
|
@ -219,8 +219,6 @@ export class ConversationModel extends window.Backbone
|
||||||
|
|
||||||
private isFetchingUUID?: boolean;
|
private isFetchingUUID?: boolean;
|
||||||
|
|
||||||
private hasAddedHistoryDisclaimer?: boolean;
|
|
||||||
|
|
||||||
private lastIsTyping?: boolean;
|
private lastIsTyping?: boolean;
|
||||||
|
|
||||||
private muteTimer?: NodeJS.Timer;
|
private muteTimer?: NodeJS.Timer;
|
||||||
|
@ -4578,38 +4576,6 @@ export class ConversationModel extends window.Backbone
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
async addMessageHistoryDisclaimer(): Promise<void> {
|
|
||||||
const timestamp = Date.now();
|
|
||||||
|
|
||||||
if (this.hasAddedHistoryDisclaimer) {
|
|
||||||
log.warn(
|
|
||||||
`addMessageHistoryDisclaimer/${this.idForLogging()}: Refusing to add another this session`
|
|
||||||
);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
this.hasAddedHistoryDisclaimer = true;
|
|
||||||
|
|
||||||
const model = new window.Whisper.Message({
|
|
||||||
type: 'message-history-unsynced',
|
|
||||||
readStatus: ReadStatus.Read,
|
|
||||||
seenStatus: SeenStatus.NotApplicable,
|
|
||||||
conversationId: this.id,
|
|
||||||
sent_at: timestamp,
|
|
||||||
received_at: window.Signal.Util.incrementMessageCounter(),
|
|
||||||
received_at_ms: timestamp,
|
|
||||||
// TODO: DESKTOP-722
|
|
||||||
} as unknown as MessageAttributesType);
|
|
||||||
|
|
||||||
const id = await window.Signal.Data.saveMessage(model.attributes, {
|
|
||||||
ourUuid: window.textsecure.storage.user.getCheckedUuid().toString(),
|
|
||||||
});
|
|
||||||
|
|
||||||
model.set({ id });
|
|
||||||
|
|
||||||
const message = window.MessageController.register(id, model);
|
|
||||||
this.addSingleMessage(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
isSearchable(): boolean {
|
isSearchable(): boolean {
|
||||||
return !this.get('left');
|
return !this.get('left');
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,7 +91,6 @@ import {
|
||||||
isGroupV2Change,
|
isGroupV2Change,
|
||||||
isIncoming,
|
isIncoming,
|
||||||
isKeyChange,
|
isKeyChange,
|
||||||
isMessageHistoryUnsynced,
|
|
||||||
isOutgoing,
|
isOutgoing,
|
||||||
isStory,
|
isStory,
|
||||||
isProfileChange,
|
isProfileChange,
|
||||||
|
@ -295,7 +294,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
!isGroupV2Change(attributes) &&
|
!isGroupV2Change(attributes) &&
|
||||||
!isGroupV1Migration(attributes) &&
|
!isGroupV1Migration(attributes) &&
|
||||||
!isKeyChange(attributes) &&
|
!isKeyChange(attributes) &&
|
||||||
!isMessageHistoryUnsynced(attributes) &&
|
|
||||||
!isProfileChange(attributes) &&
|
!isProfileChange(attributes) &&
|
||||||
!isUniversalTimerNotification(attributes) &&
|
!isUniversalTimerNotification(attributes) &&
|
||||||
!isUnsupportedMessage(attributes) &&
|
!isUnsupportedMessage(attributes) &&
|
||||||
|
@ -1056,7 +1054,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
|
|
||||||
// Locally-generated notifications
|
// Locally-generated notifications
|
||||||
const isKeyChangeValue = isKeyChange(attributes);
|
const isKeyChangeValue = isKeyChange(attributes);
|
||||||
const isMessageHistoryUnsyncedValue = isMessageHistoryUnsynced(attributes);
|
|
||||||
const isProfileChangeValue = isProfileChange(attributes);
|
const isProfileChangeValue = isProfileChange(attributes);
|
||||||
const isUniversalTimerNotificationValue =
|
const isUniversalTimerNotificationValue =
|
||||||
isUniversalTimerNotification(attributes);
|
isUniversalTimerNotification(attributes);
|
||||||
|
@ -1085,7 +1082,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
|
||||||
hasErrorsValue ||
|
hasErrorsValue ||
|
||||||
// Locally-generated notifications
|
// Locally-generated notifications
|
||||||
isKeyChangeValue ||
|
isKeyChangeValue ||
|
||||||
isMessageHistoryUnsyncedValue ||
|
|
||||||
isProfileChangeValue ||
|
isProfileChangeValue ||
|
||||||
isUniversalTimerNotificationValue;
|
isUniversalTimerNotificationValue;
|
||||||
|
|
||||||
|
|
|
@ -1111,16 +1111,6 @@ export async function mergeAccountRecord(
|
||||||
|
|
||||||
remotelyPinnedConversations.forEach(conversation => {
|
remotelyPinnedConversations.forEach(conversation => {
|
||||||
conversation.set({ isPinned: true, isArchived: false });
|
conversation.set({ isPinned: true, isArchived: false });
|
||||||
|
|
||||||
if (
|
|
||||||
window.Signal.Util.postLinkExperience.isActive() &&
|
|
||||||
isGroupV2(conversation.attributes)
|
|
||||||
) {
|
|
||||||
log.info(
|
|
||||||
'mergeAccountRecord: Adding the message history disclaimer on link'
|
|
||||||
);
|
|
||||||
conversation.addMessageHistoryDisclaimer();
|
|
||||||
}
|
|
||||||
updatedConversations.push(conversation);
|
updatedConversations.push(conversation);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { Database } from 'better-sqlite3';
|
import type { Database } from 'better-sqlite3';
|
||||||
|
|
29
ts/sql/migrations/57-rm-message-history-unsynced.ts
Normal file
29
ts/sql/migrations/57-rm-message-history-unsynced.ts
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
// Copyright 2022 Signal Messenger, LLC
|
||||||
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
|
import type { Database } from 'better-sqlite3';
|
||||||
|
|
||||||
|
import type { LoggerType } from '../../types/Logging';
|
||||||
|
|
||||||
|
export default function updateToSchemaVersion57(
|
||||||
|
currentVersion: number,
|
||||||
|
db: Database,
|
||||||
|
logger: LoggerType
|
||||||
|
): void {
|
||||||
|
if (currentVersion >= 57) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
db.transaction(() => {
|
||||||
|
db.exec(
|
||||||
|
`
|
||||||
|
DELETE FROM messages
|
||||||
|
WHERE type IS 'message-history-unsynced';
|
||||||
|
`
|
||||||
|
);
|
||||||
|
|
||||||
|
db.pragma('user_version = 57');
|
||||||
|
})();
|
||||||
|
|
||||||
|
logger.info('updateToSchemaVersion57: success!');
|
||||||
|
}
|
|
@ -32,6 +32,7 @@ import updateToSchemaVersion53 from './53-gv2-banned-members';
|
||||||
import updateToSchemaVersion54 from './54-unprocessed-received-at-counter';
|
import updateToSchemaVersion54 from './54-unprocessed-received-at-counter';
|
||||||
import updateToSchemaVersion55 from './55-report-message-aci';
|
import updateToSchemaVersion55 from './55-report-message-aci';
|
||||||
import updateToSchemaVersion56 from './56-add-unseen-to-message';
|
import updateToSchemaVersion56 from './56-add-unseen-to-message';
|
||||||
|
import updateToSchemaVersion57 from './57-rm-message-history-unsynced';
|
||||||
|
|
||||||
function updateToSchemaVersion1(
|
function updateToSchemaVersion1(
|
||||||
currentVersion: number,
|
currentVersion: number,
|
||||||
|
@ -1927,6 +1928,7 @@ export const SCHEMA_VERSIONS = [
|
||||||
updateToSchemaVersion54,
|
updateToSchemaVersion54,
|
||||||
updateToSchemaVersion55,
|
updateToSchemaVersion55,
|
||||||
updateToSchemaVersion56,
|
updateToSchemaVersion56,
|
||||||
|
updateToSchemaVersion57,
|
||||||
];
|
];
|
||||||
|
|
||||||
export function updateSchema(db: Database, logger: LoggerType): void {
|
export function updateSchema(db: Database, logger: LoggerType): void {
|
||||||
|
|
|
@ -785,13 +785,6 @@ export function getPropsForBubble(
|
||||||
timestamp,
|
timestamp,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (isMessageHistoryUnsynced(message)) {
|
|
||||||
return {
|
|
||||||
type: 'linkNotification',
|
|
||||||
data: null,
|
|
||||||
timestamp,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
if (isExpirationTimerUpdate(message)) {
|
if (isExpirationTimerUpdate(message)) {
|
||||||
return {
|
return {
|
||||||
type: 'timerNotification',
|
type: 'timerNotification',
|
||||||
|
@ -984,14 +977,6 @@ function getPropsForGroupV1Migration(
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Message History Unsynced
|
|
||||||
|
|
||||||
export function isMessageHistoryUnsynced(
|
|
||||||
message: MessageWithUIFieldsType
|
|
||||||
): boolean {
|
|
||||||
return message.type === 'message-history-unsynced';
|
|
||||||
}
|
|
||||||
|
|
||||||
// Note: props are null!
|
// Note: props are null!
|
||||||
|
|
||||||
// Expiration Timer Update
|
// Expiration Timer Update
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import type { ComponentProps, ReactElement } from 'react';
|
import type { ComponentProps, ReactElement } from 'react';
|
||||||
|
@ -193,8 +193,6 @@ export function SmartInstallScreen(): ReactElement {
|
||||||
throw new Error('Cannot confirm number; the component was unmounted');
|
throw new Error('Cannot confirm number; the component was unmounted');
|
||||||
}
|
}
|
||||||
|
|
||||||
window.Signal.Util.postLinkExperience.start();
|
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -40,24 +40,6 @@ describe('<Timeline> utilities', () => {
|
||||||
assert.isFalse(areMessagesInSameGroup(undefined, false, defaultNewer));
|
assert.isFalse(areMessagesInSameGroup(undefined, false, defaultNewer));
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns false if either item is not a message', () => {
|
|
||||||
const linkNotification = {
|
|
||||||
type: 'linkNotification' as const,
|
|
||||||
data: null,
|
|
||||||
timestamp: Date.now(),
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.isFalse(
|
|
||||||
areMessagesInSameGroup(defaultNewer, false, linkNotification)
|
|
||||||
);
|
|
||||||
assert.isFalse(
|
|
||||||
areMessagesInSameGroup(linkNotification, false, defaultNewer)
|
|
||||||
);
|
|
||||||
assert.isFalse(
|
|
||||||
areMessagesInSameGroup(linkNotification, false, linkNotification)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it("returns false if authors don't match", () => {
|
it("returns false if authors don't match", () => {
|
||||||
const older = {
|
const older = {
|
||||||
...defaultOlder,
|
...defaultOlder,
|
||||||
|
@ -155,18 +137,6 @@ describe('<Timeline> utilities', () => {
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('returns false if newer item is not a message', () => {
|
|
||||||
const linkNotification = {
|
|
||||||
type: 'linkNotification' as const,
|
|
||||||
data: null,
|
|
||||||
timestamp: Date.now(),
|
|
||||||
};
|
|
||||||
|
|
||||||
assert.isFalse(
|
|
||||||
shouldCurrentMessageHideMetadata(true, defaultCurrent, linkNotification)
|
|
||||||
);
|
|
||||||
});
|
|
||||||
|
|
||||||
it('returns false if newer is deletedForEveryone', () => {
|
it('returns false if newer is deletedForEveryone', () => {
|
||||||
const newer = {
|
const newer = {
|
||||||
...defaultNewer,
|
...defaultNewer,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
// Copyright 2021-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import { assert } from 'chai';
|
import { assert } from 'chai';
|
||||||
|
@ -166,15 +166,6 @@ describe('sql/conversationSummary', () => {
|
||||||
timestamp: now + 3,
|
timestamp: now + 3,
|
||||||
};
|
};
|
||||||
const message4: MessageAttributesType = {
|
const message4: MessageAttributesType = {
|
||||||
id: getUuid(),
|
|
||||||
body: 'message 4',
|
|
||||||
type: 'message-history-unsynced',
|
|
||||||
conversationId,
|
|
||||||
sent_at: now + 4,
|
|
||||||
received_at: now + 4,
|
|
||||||
timestamp: now + 4,
|
|
||||||
};
|
|
||||||
const message5: MessageAttributesType = {
|
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 5',
|
body: 'message 5',
|
||||||
type: 'profile-change',
|
type: 'profile-change',
|
||||||
|
@ -183,7 +174,7 @@ describe('sql/conversationSummary', () => {
|
||||||
received_at: now + 5,
|
received_at: now + 5,
|
||||||
timestamp: now + 5,
|
timestamp: now + 5,
|
||||||
};
|
};
|
||||||
const message6: MessageAttributesType = {
|
const message5: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 6',
|
body: 'message 6',
|
||||||
type: 'story',
|
type: 'story',
|
||||||
|
@ -192,7 +183,7 @@ describe('sql/conversationSummary', () => {
|
||||||
received_at: now + 6,
|
received_at: now + 6,
|
||||||
timestamp: now + 6,
|
timestamp: now + 6,
|
||||||
};
|
};
|
||||||
const message7: MessageAttributesType = {
|
const message6: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 7',
|
body: 'message 7',
|
||||||
type: 'universal-timer-notification',
|
type: 'universal-timer-notification',
|
||||||
|
@ -201,7 +192,7 @@ describe('sql/conversationSummary', () => {
|
||||||
received_at: now + 7,
|
received_at: now + 7,
|
||||||
timestamp: now + 7,
|
timestamp: now + 7,
|
||||||
};
|
};
|
||||||
const message8: MessageAttributesType = {
|
const message7: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 8',
|
body: 'message 8',
|
||||||
type: 'verified-change',
|
type: 'verified-change',
|
||||||
|
@ -212,23 +203,14 @@ describe('sql/conversationSummary', () => {
|
||||||
};
|
};
|
||||||
|
|
||||||
await saveMessages(
|
await saveMessages(
|
||||||
[
|
[message1, message2, message3, message4, message5, message6, message7],
|
||||||
message1,
|
|
||||||
message2,
|
|
||||||
message3,
|
|
||||||
message4,
|
|
||||||
message5,
|
|
||||||
message6,
|
|
||||||
message7,
|
|
||||||
message8,
|
|
||||||
],
|
|
||||||
{
|
{
|
||||||
forceSave: true,
|
forceSave: true,
|
||||||
ourUuid,
|
ourUuid,
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.lengthOf(await _getAllMessages(), 8);
|
assert.lengthOf(await _getAllMessages(), 7);
|
||||||
|
|
||||||
const messages = await getConversationMessageStats({
|
const messages = await getConversationMessageStats({
|
||||||
conversationId,
|
conversationId,
|
||||||
|
@ -282,15 +264,6 @@ describe('sql/conversationSummary', () => {
|
||||||
timestamp: now + 4,
|
timestamp: now + 4,
|
||||||
};
|
};
|
||||||
const message5: MessageAttributesType = {
|
const message5: MessageAttributesType = {
|
||||||
id: getUuid(),
|
|
||||||
body: 'message 5',
|
|
||||||
type: 'message-history-unsynced',
|
|
||||||
conversationId,
|
|
||||||
sent_at: now + 5,
|
|
||||||
received_at: now + 5,
|
|
||||||
timestamp: now + 5,
|
|
||||||
};
|
|
||||||
const message6: MessageAttributesType = {
|
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 6',
|
body: 'message 6',
|
||||||
type: 'profile-change',
|
type: 'profile-change',
|
||||||
|
@ -299,7 +272,7 @@ describe('sql/conversationSummary', () => {
|
||||||
received_at: now + 6,
|
received_at: now + 6,
|
||||||
timestamp: now + 6,
|
timestamp: now + 6,
|
||||||
};
|
};
|
||||||
const message7: MessageAttributesType = {
|
const message6: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 7',
|
body: 'message 7',
|
||||||
type: 'story',
|
type: 'story',
|
||||||
|
@ -308,7 +281,7 @@ describe('sql/conversationSummary', () => {
|
||||||
received_at: now + 7,
|
received_at: now + 7,
|
||||||
timestamp: now + 7,
|
timestamp: now + 7,
|
||||||
};
|
};
|
||||||
const message8: MessageAttributesType = {
|
const message7: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 8',
|
body: 'message 8',
|
||||||
type: 'universal-timer-notification',
|
type: 'universal-timer-notification',
|
||||||
|
@ -317,7 +290,7 @@ describe('sql/conversationSummary', () => {
|
||||||
received_at: now + 8,
|
received_at: now + 8,
|
||||||
timestamp: now + 8,
|
timestamp: now + 8,
|
||||||
};
|
};
|
||||||
const message9: MessageAttributesType = {
|
const message8: MessageAttributesType = {
|
||||||
id: getUuid(),
|
id: getUuid(),
|
||||||
body: 'message 9',
|
body: 'message 9',
|
||||||
type: 'verified-change',
|
type: 'verified-change',
|
||||||
|
@ -337,7 +310,6 @@ describe('sql/conversationSummary', () => {
|
||||||
message6,
|
message6,
|
||||||
message7,
|
message7,
|
||||||
message8,
|
message8,
|
||||||
message9,
|
|
||||||
],
|
],
|
||||||
{
|
{
|
||||||
forceSave: true,
|
forceSave: true,
|
||||||
|
@ -345,7 +317,7 @@ describe('sql/conversationSummary', () => {
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
assert.lengthOf(await _getAllMessages(), 9);
|
assert.lengthOf(await _getAllMessages(), 8);
|
||||||
|
|
||||||
const messages = await getConversationMessageStats({
|
const messages = await getConversationMessageStats({
|
||||||
conversationId,
|
conversationId,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2018-2021 Signal Messenger, LLC
|
// Copyright 2018-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
@ -10,7 +10,6 @@ import type { IndexableBoolean, IndexablePresence } from './IndexedDB';
|
||||||
export type Message = (
|
export type Message = (
|
||||||
| UserMessage
|
| UserMessage
|
||||||
| VerifiedChangeMessage
|
| VerifiedChangeMessage
|
||||||
| MessageHistoryUnsyncedMessage
|
|
||||||
| ProfileChangeNotificationMessage
|
| ProfileChangeNotificationMessage
|
||||||
) & { deletedForEveryone?: boolean };
|
) & { deletedForEveryone?: boolean };
|
||||||
export type UserMessage = IncomingMessage | OutgoingMessage;
|
export type UserMessage = IncomingMessage | OutgoingMessage;
|
||||||
|
@ -68,14 +67,6 @@ export type VerifiedChangeMessage = Readonly<
|
||||||
ExpirationTimerUpdate
|
ExpirationTimerUpdate
|
||||||
>;
|
>;
|
||||||
|
|
||||||
export type MessageHistoryUnsyncedMessage = Readonly<
|
|
||||||
{
|
|
||||||
type: 'message-history-unsynced';
|
|
||||||
} & SharedMessageProperties &
|
|
||||||
MessageSchemaVersion5 &
|
|
||||||
ExpirationTimerUpdate
|
|
||||||
>;
|
|
||||||
|
|
||||||
export type ProfileChangeNotificationMessage = Readonly<
|
export type ProfileChangeNotificationMessage = Readonly<
|
||||||
{
|
{
|
||||||
type: 'profile-change';
|
type: 'profile-change';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2018-2020 Signal Messenger, LLC
|
// Copyright 2018-2022 Signal Messenger, LLC
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
// SPDX-License-Identifier: AGPL-3.0-only
|
||||||
|
|
||||||
import * as Attachment from '../Attachment';
|
import * as Attachment from '../Attachment';
|
||||||
|
@ -19,9 +19,6 @@ export const initializeAttachmentMetadata = async (
|
||||||
if (message.type === 'verified-change') {
|
if (message.type === 'verified-change') {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
if (message.type === 'message-history-unsynced') {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
if (message.type === 'profile-change') {
|
if (message.type === 'profile-change') {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,7 +38,6 @@ import {
|
||||||
} from './sessionTranslation';
|
} from './sessionTranslation';
|
||||||
import * as zkgroup from './zkgroup';
|
import * as zkgroup from './zkgroup';
|
||||||
import { StartupQueue } from './StartupQueue';
|
import { StartupQueue } from './StartupQueue';
|
||||||
import { postLinkExperience } from './postLinkExperience';
|
|
||||||
import { sendToGroup, sendContentMessageToGroup } from './sendToGroup';
|
import { sendToGroup, sendContentMessageToGroup } from './sendToGroup';
|
||||||
import { RetryPlaceholders } from './retryPlaceholders';
|
import { RetryPlaceholders } from './retryPlaceholders';
|
||||||
import * as expirationTimer from './expirationTimer';
|
import * as expirationTimer from './expirationTimer';
|
||||||
|
@ -70,7 +69,6 @@ export {
|
||||||
MessageController,
|
MessageController,
|
||||||
missingCaseError,
|
missingCaseError,
|
||||||
parseRemoteClientExpiration,
|
parseRemoteClientExpiration,
|
||||||
postLinkExperience,
|
|
||||||
queueUpdateMessage,
|
queueUpdateMessage,
|
||||||
RetryPlaceholders,
|
RetryPlaceholders,
|
||||||
saveNewMessageBatcher,
|
saveNewMessageBatcher,
|
||||||
|
|
|
@ -1,32 +0,0 @@
|
||||||
// Copyright 2021 Signal Messenger, LLC
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only
|
|
||||||
|
|
||||||
import { MINUTE } from './durations';
|
|
||||||
|
|
||||||
class PostLinkExperience {
|
|
||||||
private hasNotFinishedSync: boolean;
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.hasNotFinishedSync = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
start() {
|
|
||||||
this.hasNotFinishedSync = true;
|
|
||||||
|
|
||||||
// timeout "post link" after 10 minutes in case the syncs don't complete
|
|
||||||
// in time or are never called.
|
|
||||||
setTimeout(() => {
|
|
||||||
this.stop();
|
|
||||||
}, 10 * MINUTE);
|
|
||||||
}
|
|
||||||
|
|
||||||
stop() {
|
|
||||||
this.hasNotFinishedSync = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
isActive(): boolean {
|
|
||||||
return this.hasNotFinishedSync === true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
export const postLinkExperience = new PostLinkExperience();
|
|
Loading…
Add table
Add a link
Reference in a new issue