Always share profile on send; no profile sharing UI if no messages
This commit is contained in:
parent
8eea20ea91
commit
cd9aee84f5
4 changed files with 35 additions and 6 deletions
|
@ -1763,6 +1763,11 @@ export class ConversationModel extends window.Backbone.Model<
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const hasNoMessages = (this.get('messageCount') || 0) === 0;
|
||||||
|
if (hasNoMessages) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return !this.get('profileSharing');
|
return !this.get('profileSharing');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import _ from 'lodash';
|
import { debounce, isNumber, partition } from 'lodash';
|
||||||
import pMap from 'p-map';
|
import pMap from 'p-map';
|
||||||
|
|
||||||
import Crypto from '../textsecure/Crypto';
|
import Crypto from '../textsecure/Crypto';
|
||||||
|
@ -753,7 +753,7 @@ async function processManifest(
|
||||||
|
|
||||||
// Merge Account records last
|
// Merge Account records last
|
||||||
const sortedStorageItems = ([] as Array<MergeableItemType>).concat(
|
const sortedStorageItems = ([] as Array<MergeableItemType>).concat(
|
||||||
..._.partition(
|
...partition(
|
||||||
decryptedStorageItems,
|
decryptedStorageItems,
|
||||||
storageRecord => storageRecord.storageRecord.account === undefined
|
storageRecord => storageRecord.storageRecord.account === undefined
|
||||||
)
|
)
|
||||||
|
@ -897,7 +897,14 @@ async function sync(): Promise<void> {
|
||||||
window.log.info('storageService.sync: starting...');
|
window.log.info('storageService.sync: starting...');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const localManifestVersion = window.storage.get('manifestVersion') || 0;
|
// If we've previously interacted with strage service, update 'fetchComplete' record
|
||||||
|
const previousFetchComplete = window.storage.get('storageFetchComplete');
|
||||||
|
const manifestFromStorage = window.storage.get('manifestVersion');
|
||||||
|
if (!previousFetchComplete && isNumber(manifestFromStorage)) {
|
||||||
|
window.storage.put('storageFetchComplete', true);
|
||||||
|
}
|
||||||
|
|
||||||
|
const localManifestVersion = manifestFromStorage || 0;
|
||||||
const manifest = await fetchManifest(localManifestVersion);
|
const manifest = await fetchManifest(localManifestVersion);
|
||||||
|
|
||||||
// Guarding against no manifests being returned, everything should be ok
|
// Guarding against no manifests being returned, everything should be ok
|
||||||
|
@ -918,6 +925,9 @@ async function sync(): Promise<void> {
|
||||||
if (hasConflicts) {
|
if (hasConflicts) {
|
||||||
await upload();
|
await upload();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We now know that we've successfully completed a storage service fetch
|
||||||
|
window.storage.put('storageFetchComplete', true);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
window.log.error(
|
window.log.error(
|
||||||
'storageService.sync: error processing manifest',
|
'storageService.sync: error processing manifest',
|
||||||
|
@ -1013,7 +1023,7 @@ export async function eraseAllStorageServiceState(): Promise<void> {
|
||||||
window.log.info('storageService.eraseAllStorageServiceState: complete');
|
window.log.info('storageService.eraseAllStorageServiceState: complete');
|
||||||
}
|
}
|
||||||
|
|
||||||
export const storageServiceUploadJob = _.debounce(() => {
|
export const storageServiceUploadJob = debounce(() => {
|
||||||
if (!storageServiceEnabled) {
|
if (!storageServiceEnabled) {
|
||||||
window.log.info(
|
window.log.info(
|
||||||
'storageService.storageServiceUploadJob: called before enabled'
|
'storageService.storageServiceUploadJob: called before enabled'
|
||||||
|
@ -1024,7 +1034,7 @@ export const storageServiceUploadJob = _.debounce(() => {
|
||||||
storageJobQueue(upload, `upload v${window.storage.get('manifestVersion')}`);
|
storageJobQueue(upload, `upload v${window.storage.get('manifestVersion')}`);
|
||||||
}, 500);
|
}, 500);
|
||||||
|
|
||||||
export const runStorageServiceSyncJob = _.debounce(() => {
|
export const runStorageServiceSyncJob = debounce(() => {
|
||||||
if (!storageServiceEnabled) {
|
if (!storageServiceEnabled) {
|
||||||
window.log.info(
|
window.log.info(
|
||||||
'storageService.runStorageServiceSyncJob: called before enabled'
|
'storageService.runStorageServiceSyncJob: called before enabled'
|
||||||
|
|
|
@ -462,7 +462,7 @@ export async function mergeGroupV2Record(
|
||||||
updateConversation(conversation.attributes);
|
updateConversation(conversation.attributes);
|
||||||
|
|
||||||
const isGroupNewToUs = !isNumber(conversation.get('revision'));
|
const isGroupNewToUs = !isNumber(conversation.get('revision'));
|
||||||
const isFirstSync = !isNumber(window.storage.get('manifestVersion'));
|
const isFirstSync = !window.storage.get('storageFetchComplete');
|
||||||
const dropInitialJoinMessage = isFirstSync;
|
const dropInitialJoinMessage = isFirstSync;
|
||||||
|
|
||||||
// We don't need to update GroupV2 groups all the time. We fetch group state the first
|
// We don't need to update GroupV2 groups all the time. We fetch group state the first
|
||||||
|
|
|
@ -2840,6 +2840,13 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mandatoryProfileSharingEnabled = window.Signal.RemoteConfig.isEnabled(
|
||||||
|
'desktop.mandatoryProfileSharing'
|
||||||
|
);
|
||||||
|
if (mandatoryProfileSharingEnabled && !this.model.get('profileSharing')) {
|
||||||
|
this.model.set({ profileSharing: true });
|
||||||
|
}
|
||||||
|
|
||||||
const { packId, stickerId } = options;
|
const { packId, stickerId } = options;
|
||||||
this.model.sendStickerMessage(packId, stickerId);
|
this.model.sendStickerMessage(packId, stickerId);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
@ -3035,6 +3042,13 @@ Whisper.ConversationView = Whisper.View.extend({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const mandatoryProfileSharingEnabled = window.Signal.RemoteConfig.isEnabled(
|
||||||
|
'desktop.mandatoryProfileSharing'
|
||||||
|
);
|
||||||
|
if (mandatoryProfileSharingEnabled && !this.model.get('profileSharing')) {
|
||||||
|
this.model.set({ profileSharing: true });
|
||||||
|
}
|
||||||
|
|
||||||
const attachments = await this.getFiles();
|
const attachments = await this.getFiles();
|
||||||
const sendDelta = Date.now() - this.sendStart;
|
const sendDelta = Date.now() - this.sendStart;
|
||||||
window.log.info('Send pre-checks took', sendDelta, 'milliseconds');
|
window.log.info('Send pre-checks took', sendDelta, 'milliseconds');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue