cleanup expired template from html files
parent
6e14718a32
commit
2fc61d2c96
@ -1,77 +0,0 @@
|
||||
/*
|
||||
global
|
||||
ConversationController,
|
||||
extension,
|
||||
ConversationController
|
||||
getInboxCollection,
|
||||
i18n,
|
||||
Whisper,
|
||||
*/
|
||||
|
||||
// eslint-disable-next-line func-names
|
||||
(function() {
|
||||
'use strict';
|
||||
|
||||
window.Whisper = window.Whisper || {};
|
||||
|
||||
Whisper.InboxViewWhisper = Whisper.View.extend({
|
||||
templateName: 'two-column',
|
||||
className: 'inbox index',
|
||||
initialize(options = {}) {
|
||||
this.ready = false;
|
||||
this.render();
|
||||
this.$el.attr('tabindex', '1');
|
||||
// ConversationCollection
|
||||
|
||||
extension.expired(expired => {
|
||||
if (expired) {
|
||||
const banner = new Whisper.ExpiredAlertBanner().render();
|
||||
banner.$el.prependTo(this.$el);
|
||||
this.$el.addClass('expired');
|
||||
}
|
||||
});
|
||||
|
||||
this.openSettings = this.openSettings.bind(this);
|
||||
this.openSessionConversation = this.openSessionConversation.bind(this);
|
||||
// FIXME: Fix this for new react views
|
||||
this.setupLeftPane();
|
||||
},
|
||||
|
||||
onEmpty() {
|
||||
const view = this.appLoadingScreen;
|
||||
if (view) {
|
||||
this.appLoadingScreen = null;
|
||||
view.remove();
|
||||
}
|
||||
},
|
||||
async openConversation(id, messageId) {
|
||||
// If we call this to create a new conversation, it can only be private
|
||||
// (group conversations are created elsewhere)
|
||||
const conversation = await ConversationController.getOrCreateAndWait(
|
||||
id,
|
||||
'private'
|
||||
);
|
||||
|
||||
if (this.openConversationAction) {
|
||||
this.openConversationAction(id, messageId);
|
||||
}
|
||||
|
||||
if (conversation) {
|
||||
conversation.updateProfileName();
|
||||
}
|
||||
|
||||
this.open(conversation);
|
||||
},
|
||||
});
|
||||
|
||||
Whisper.ExpiredAlertBanner = Whisper.View.extend({
|
||||
templateName: 'expired_alert',
|
||||
className: 'expiredAlert',
|
||||
render_attributes() {
|
||||
return {
|
||||
expiredWarning: i18n('expiredWarning'),
|
||||
upgrade: i18n('upgrade'),
|
||||
};
|
||||
},
|
||||
});
|
||||
})();
|
@ -1,68 +0,0 @@
|
||||
/* global storage, libsignal, ConversationController, textsecure, Whisper */
|
||||
|
||||
describe('InboxView', () => {
|
||||
let inboxView;
|
||||
let conversation;
|
||||
let identityKey;
|
||||
|
||||
before(async () => {
|
||||
ConversationController.reset();
|
||||
identityKey = {
|
||||
pubKey: libsignal.crypto.getRandomBytes(33),
|
||||
privKey: libsignal.crypto.getRandomBytes(32),
|
||||
};
|
||||
storage.put('identityKey', identityKey);
|
||||
await ConversationController.load();
|
||||
await textsecure.storage.user.setNumberAndDeviceId(
|
||||
'18005554444',
|
||||
1,
|
||||
'Home Office'
|
||||
);
|
||||
await ConversationController.getOrCreateAndWait(
|
||||
textsecure.storage.user.getNumber(),
|
||||
'private'
|
||||
);
|
||||
inboxView = new Whisper.InboxView({
|
||||
model: {},
|
||||
window,
|
||||
initialLoadComplete() {},
|
||||
}).render();
|
||||
|
||||
conversation = new Whisper.Conversation({
|
||||
id: '1234',
|
||||
type: 'private',
|
||||
});
|
||||
});
|
||||
|
||||
describe('the conversation stack', () => {
|
||||
it('should be rendered', () => {
|
||||
assert.ok(inboxView.length === 1);
|
||||
});
|
||||
|
||||
describe('opening a conversation', () => {
|
||||
let triggeredOpenedCount = 0;
|
||||
|
||||
before(() => {
|
||||
conversation.on('opened', () => {
|
||||
triggeredOpenedCount += 1;
|
||||
});
|
||||
|
||||
inboxView.open(conversation);
|
||||
});
|
||||
|
||||
it('should trigger an opened event', () => {
|
||||
assert.ok(triggeredOpenedCount === 1);
|
||||
});
|
||||
|
||||
describe('and then opening it again immediately', () => {
|
||||
before(() => {
|
||||
inboxView.open(conversation);
|
||||
});
|
||||
|
||||
it('should trigger the opened event again', () => {
|
||||
assert.ok(triggeredOpenedCount === 2);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Reference in New Issue