A few small bugfixes

This commit is contained in:
Scott Nonnenberg 2020-10-30 10:56:03 -07:00 committed by GitHub
parent cd9aee84f5
commit 05f905fd10
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 52 additions and 44 deletions

View file

@ -1932,26 +1932,6 @@ type WhatIsThis = typeof window.WhatIsThis;
}
}
const hasRegisteredGV23Support = 'hasRegisteredGV23Support';
if (
!window.storage.get(hasRegisteredGV23Support) &&
window.textsecure.storage.user.getUuid()
) {
const server = window.WebAPI.connect({
username: USERNAME || OLD_USERNAME,
password: PASSWORD,
});
try {
await server.registerCapabilities({ 'gv2-3': true });
window.storage.put(hasRegisteredGV23Support, true);
} catch (error) {
window.log.error(
'Error: Unable to register support for GV2.',
error && error.stack ? error.stack : error
);
}
}
const deviceId = window.textsecure.storage.user.getDeviceId();
// If we didn't capture a UUID on registration, go get it from the server
@ -1980,6 +1960,27 @@ type WhatIsThis = typeof window.WhatIsThis;
}
}
// We need to do this after fetching our UUID
const hasRegisteredGV23Support = 'hasRegisteredGV23Support';
if (
!window.storage.get(hasRegisteredGV23Support) &&
window.textsecure.storage.user.getUuid()
) {
const server = window.WebAPI.connect({
username: USERNAME || OLD_USERNAME,
password: PASSWORD,
});
try {
await server.registerCapabilities({ 'gv2-3': true });
window.storage.put(hasRegisteredGV23Support, true);
} catch (error) {
window.log.error(
'Error: Unable to register support for GV2.',
error && error.stack ? error.stack : error
);
}
}
if (firstRun === true && deviceId !== '1') {
const hasThemeSetting = Boolean(window.storage.get('theme-setting'));
if (

View file

@ -225,13 +225,14 @@ export class ConversationListItem extends React.PureComponent<Props> {
<span className="module-conversation-list-item__message__deleted-for-everyone">
{i18n('message--deletedForEveryone')}
</span>
) : null}
<MessageBody
text={text.split('\n')[0]}
disableJumbomoji
disableLinks
i18n={i18n}
/>
) : (
<MessageBody
text={text.split('\n')[0]}
disableJumbomoji
disableLinks
i18n={i18n}
/>
)}
</>
)}
</div>

View file

@ -2985,7 +2985,7 @@ export class ConversationModel extends window.Backbone.Model<
(previewMessage ? previewMessage.getMessagePropStatus() : null) || null,
timestamp,
lastMessageDeletedForEveryone: previewMessage
? previewMessage.deletedForEveryone
? previewMessage.get('deletedForEveryone')
: false,
});

View file

@ -128,8 +128,6 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
OUR_UUID?: string;
deletedForEveryone?: boolean;
isSelected?: boolean;
hasExpired?: boolean;
@ -1076,6 +1074,12 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
};
}
if (this.get('deletedForEveryone')) {
return {
text: window.i18n('message--deletedForEveryone'),
};
}
if (this.isProfileChange()) {
const change = this.get('profileChange');
const changedId = this.get('changedId');
@ -1652,11 +1656,13 @@ export class MessageModel extends window.Backbone.Model<MessageAttributesType> {
}
getSourceDevice(): string | number | undefined {
const sourceDevice = this.get('sourceDevice');
if (this.isIncoming()) {
return this.get('sourceDevice');
return sourceDevice;
}
return window.textsecure.storage.user.getDeviceId();
return sourceDevice || window.textsecure.storage.user.getDeviceId();
}
getSourceUuid(): string | undefined {

8
ts/textsecure.d.ts vendored
View file

@ -1107,10 +1107,10 @@ export declare namespace SyncMessageClass {
}
class MessageRequestResponse {
threadE164?: string;
threadUuid?: string;
groupId?: ProtoBinaryType;
type?: number;
threadE164: string | null;
threadUuid: string | null;
groupId: ProtoBinaryType | null;
type: number | null;
}
}

View file

@ -55,7 +55,7 @@ declare global {
eventType?: string | number;
groupDetails?: any;
groupId?: string;
messageRequestResponseType?: number;
messageRequestResponseType?: number | null;
proto?: any;
read?: any;
reason?: any;
@ -65,8 +65,8 @@ declare global {
source?: any;
sourceUuid?: any;
stickerPacks?: any;
threadE164?: string;
threadUuid?: string;
threadE164?: string | null;
threadUuid?: string | null;
storageServiceKey?: ArrayBuffer;
timestamp?: any;
typing?: any;
@ -195,9 +195,6 @@ class MessageReceiverInner extends EventTarget {
maxSize: 30,
processBatch: this.cacheRemoveBatch.bind(this),
});
// We always process our cache before any websocket message
this.pendingQueue.add(async () => this.queueAllCached());
}
static stringToArrayBuffer = (string: string): ArrayBuffer =>
@ -217,6 +214,9 @@ class MessageReceiverInner extends EventTarget {
return;
}
// We always process our cache before processing a new websocket message
this.pendingQueue.add(async () => this.queueAllCached());
this.count = 0;
if (this.hasConnected) {
const ev = new Event('reconnect');

View file

@ -1232,8 +1232,8 @@ export default class MessageSender {
const syncMessage = this.createSyncMessage();
const response = new window.textsecure.protobuf.SyncMessage.MessageRequestResponse();
response.threadE164 = responseArgs.threadE164;
response.threadUuid = responseArgs.threadUuid;
response.threadE164 = responseArgs.threadE164 || null;
response.threadUuid = responseArgs.threadUuid || null;
response.groupId = responseArgs.groupId || null;
response.type = responseArgs.type;
syncMessage.messageRequestResponse = response;