"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "js/views/conversation_view.js" between
Signal-Desktop-1.35.2.tar.gz and Signal-Desktop-1.36.1.tar.gz

About: Signal-Desktop is a cross-platform encrypted messaging service (also available for mobile devices).

conversation_view.js  (Signal-Desktop-1.35.2):conversation_view.js  (Signal-Desktop-1.36.1)
skipping to change at line 17 skipping to change at line 17
loadImage, loadImage,
MessageController, MessageController,
Signal, Signal,
storage, storage,
textsecure, textsecure,
Whisper, Whisper,
*/ */
// eslint-disable-next-line func-names // eslint-disable-next-line func-names
(function() { (function() {
'use strict';
const FIVE_MINUTES = 1000 * 60 * 5; const FIVE_MINUTES = 1000 * 60 * 5;
window.Whisper = window.Whisper || {}; window.Whisper = window.Whisper || {};
const { Message, MIME, VisualAttachment } = window.Signal.Types; const { Message, MIME, VisualAttachment } = window.Signal.Types;
const { const {
copyIntoTempDirectory, copyIntoTempDirectory,
deleteDraftFile, deleteDraftFile,
deleteTempFile, deleteTempFile,
getAbsoluteAttachmentPath, getAbsoluteAttachmentPath,
getAbsoluteDraftPath, getAbsoluteDraftPath,
skipping to change at line 220 skipping to change at line 218
}); });
Whisper.OneNonImageAtATimeToast = Whisper.ToastView.extend({ Whisper.OneNonImageAtATimeToast = Whisper.ToastView.extend({
template: i18n('oneNonImageAtATimeToast'), template: i18n('oneNonImageAtATimeToast'),
}); });
Whisper.CannotMixImageAndNonImageAttachmentsToast = Whisper.ToastView.extend({ Whisper.CannotMixImageAndNonImageAttachmentsToast = Whisper.ToastView.extend({
template: i18n('cannotMixImageAndNonImageAttachments'), template: i18n('cannotMixImageAndNonImageAttachments'),
}); });
Whisper.MaxAttachmentsToast = Whisper.ToastView.extend({ Whisper.MaxAttachmentsToast = Whisper.ToastView.extend({
template: i18n('maximumAttachments'), template: i18n('maximumAttachments'),
}); });
Whisper.TimerConflictToast = Whisper.ToastView.extend({
template: i18n('GroupV2--timerConflict'),
});
Whisper.ConversationLoadingScreen = Whisper.View.extend({ Whisper.ConversationLoadingScreen = Whisper.View.extend({
templateName: 'conversation-loading-screen', templateName: 'conversation-loading-screen',
className: 'conversation-loading-screen', className: 'conversation-loading-screen',
}); });
Whisper.ConversationView = Whisper.View.extend({ Whisper.ConversationView = Whisper.View.extend({
className() { className() {
return ['conversation', this.model.get('type')].join(' '); return ['conversation', this.model.get('type')].join(' ');
}, },
skipping to change at line 316 skipping to change at line 317
); );
this.model.throttledGetProfiles = this.model.throttledGetProfiles =
this.model.throttledGetProfiles || this.model.throttledGetProfiles ||
_.throttle(this.model.getProfiles.bind(this.model), FIVE_MINUTES); _.throttle(this.model.getProfiles.bind(this.model), FIVE_MINUTES);
this.model.throttledUpdateSharedGroups = this.model.throttledUpdateSharedGroups =
this.model.throttledUpdateSharedGroups || this.model.throttledUpdateSharedGroups ||
_.throttle( _.throttle(
this.model.updateSharedGroups.bind(this.model), this.model.updateSharedGroups.bind(this.model),
FIVE_MINUTES FIVE_MINUTES
); );
this.model.throttledFetchLatestGroupV2Data =
this.model.throttledFetchLatestGroupV2Data ||
_.throttle(
this.model.fetchLatestGroupV2Data.bind(this.model),
FIVE_MINUTES
);
this.debouncedMaybeGrabLinkPreview = _.debounce( this.debouncedMaybeGrabLinkPreview = _.debounce(
this.maybeGrabLinkPreview.bind(this), this.maybeGrabLinkPreview.bind(this),
200 200
); );
this.debouncedSaveDraft = _.debounce(this.saveDraft.bind(this), 200); this.debouncedSaveDraft = _.debounce(this.saveDraft.bind(this), 200);
this.render(); this.render();
this.loadingScreen = new Whisper.ConversationLoadingScreen(); this.loadingScreen = new Whisper.ConversationLoadingScreen();
this.loadingScreen.render(); this.loadingScreen.render();
skipping to change at line 390 skipping to change at line 398
const expireTimer = this.model.get('expireTimer'); const expireTimer = this.model.get('expireTimer');
const expirationSettingName = expireTimer const expirationSettingName = expireTimer
? Whisper.ExpirationTimerOptions.getName(expireTimer || 0) ? Whisper.ExpirationTimerOptions.getName(expireTimer || 0)
: null; : null;
return { return {
...this.model.cachedProps, ...this.model.cachedProps,
leftGroup: this.model.get('left'), leftGroup: this.model.get('left'),
expirationSettingName, disableTimerChanges:
this.model.get('left') ||
!this.model.getAccepted() ||
!this.model.canChangeTimer(),
showBackButton: Boolean(this.panels && this.panels.length), showBackButton: Boolean(this.panels && this.panels.length),
expirationSettingName,
timerOptions: Whisper.ExpirationTimerOptions.map(item => ({ timerOptions: Whisper.ExpirationTimerOptions.map(item => ({
name: item.getName(), name: item.getName(),
value: item.get('seconds'), value: item.get('seconds'),
})), })),
muteExpirationLabel: this.getMuteExpirationLabel(), muteExpirationLabel: this.getMuteExpirationLabel(),
onSetDisappearingMessages: seconds => onSetDisappearingMessages: seconds =>
this.setDisappearingMessages(seconds), this.setDisappearingMessages(seconds),
onDeleteMessages: () => this.destroyMessages(), onDeleteMessages: () => this.destroyMessages(),
skipping to change at line 1831 skipping to change at line 1844
this.loadNewestMessages(); this.loadNewestMessages();
this.model.updateLastMessage(); this.model.updateLastMessage();
this.focusMessageField(); this.focusMessageField();
const quotedMessageId = this.model.get('quotedMessageId'); const quotedMessageId = this.model.get('quotedMessageId');
if (quotedMessageId) { if (quotedMessageId) {
this.setQuoteMessage(quotedMessageId); this.setQuoteMessage(quotedMessageId);
} }
this.model.throttledFetchLatestGroupV2Data();
const statusPromise = this.model.throttledGetProfiles(); const statusPromise = this.model.throttledGetProfiles();
// eslint-disable-next-line more/no-then // eslint-disable-next-line more/no-then
this.statusFetch = statusPromise.then(() => this.statusFetch = statusPromise.then(() =>
// eslint-disable-next-line more/no-then // eslint-disable-next-line more/no-then
this.model.updateVerified().then(() => { this.model.updateVerified().then(() => {
this.onVerifiedChange(); this.onVerifiedChange();
this.statusFetch = null; this.statusFetch = null;
}) })
); );
}, },
skipping to change at line 2049 skipping to change at line 2064
// We do this here because we don't want convo.messageCollection to have // We do this here because we don't want convo.messageCollection to have
// anything in it unless it has an associated view. This is so, when we // anything in it unless it has an associated view. This is so, when we
// fetch on open, it's clean. // fetch on open, it's clean.
this.model.addIncomingMessage(message); this.model.addIncomingMessage(message);
}, },
async showMembers(e, providedMembers, options = {}) { async showMembers(e, providedMembers, options = {}) {
_.defaults(options, { needVerify: false }); _.defaults(options, { needVerify: false });
const model = providedMembers || this.model.contactCollection; let model = providedMembers || this.model.contactCollection;
if (!providedMembers && this.model.get('groupVersion') === 2) {
model = new Whisper.GroupConversationCollection(
this.model.get('membersV2').map(({ conversationId, role }) => ({
conversation: ConversationController.get(conversationId),
isAdmin:
role === window.textsecure.protobuf.Member.Role.ADMINISTRATOR,
}))
);
}
const view = new Whisper.GroupMemberList({ const view = new Whisper.GroupMemberList({
model, model,
// we pass this in to allow nested panels // we pass this in to allow nested panels
listenBack: this.listenBack.bind(this), listenBack: this.listenBack.bind(this),
needVerify: options.needVerify, needVerify: options.needVerify,
}); });
this.listenBack(view); this.listenBack(view);
}, },
skipping to change at line 2501 skipping to change at line 2527
// Make sure poppers are positioned properly // Make sure poppers are positioned properly
window.dispatchEvent(new Event('resize')); window.dispatchEvent(new Event('resize'));
} }
}); });
}, },
endSession() { endSession() {
this.model.endSession(); this.model.endSession();
}, },
setDisappearingMessages(seconds) { async setDisappearingMessages(seconds) {
if (seconds > 0) { try {
this.model.updateExpirationTimer(seconds); if (seconds > 0) {
} else { await this.model.updateExpirationTimer(seconds);
this.model.updateExpirationTimer(null); } else {
await this.model.updateExpirationTimer(null);
}
} catch (error) {
if (error.code === 409) {
this.showToast(Whisper.TimerConflictToast);
}
} }
}, },
setMuteNotifications(ms) { setMuteNotifications(ms) {
this.model.set({ this.model.set({
muteExpiresAt: ms > 0 ? Date.now() + ms : undefined, muteExpiresAt: ms > 0 ? Date.now() + ms : undefined,
}); });
}, },
async destroyMessages() { async destroyMessages() {
skipping to change at line 2720 skipping to change at line 2752
const contact = this.quotedMessage.getContact(); const contact = this.quotedMessage.getContact();
if (contact) { if (contact) {
this.listenTo(contact, 'change', this.renderQuotedMesage); this.listenTo(contact, 'change', this.renderQuotedMesage);
} }
this.quoteView = new Whisper.ReactWrapperView({ this.quoteView = new Whisper.ReactWrapperView({
className: 'quote-wrapper', className: 'quote-wrapper',
Component: window.Signal.Components.Quote, Component: window.Signal.Components.Quote,
elCallback: el => elCallback: el =>
this.$(this.compositionApi.current.attSlotRef.current).prepend(el), this.$(this.compositionApi.current.attSlotRef.current).prepend(el),
props: Object.assign({}, props, { props: {
...props,
withContentAbove: true, withContentAbove: true,
onClose: () => { onClose: () => {
// This can't be the normal 'onClose' because that is always run whe n this // This can't be the normal 'onClose' because that is always run whe n this
// view is removed from the DOM, and would clear the draft quote. // view is removed from the DOM, and would clear the draft quote.
this.setQuoteMessage(null); this.setQuoteMessage(null);
}, },
}), },
}); });
}, },
async sendMessage(message = '', options = {}) { async sendMessage(message = '', options = {}) {
this.sendStart = Date.now(); this.sendStart = Date.now();
try { try {
const contacts = await this.getUntrustedContacts(options); const contacts = await this.getUntrustedContacts(options);
this.disableMessageField(); this.disableMessageField();
 End of changes. 10 change blocks. 
11 lines changed or deleted 44 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)