Make chat window titles match contact list
This commit is contained in:
parent
1a553fef17
commit
bd86546cea
3 changed files with 7 additions and 2 deletions
|
@ -22,6 +22,7 @@
|
||||||
function loadConversation (id) {
|
function loadConversation (id) {
|
||||||
var conversation = new Whisper.Conversation({ id: id });
|
var conversation = new Whisper.Conversation({ id: id });
|
||||||
conversation.fetch().then(function () {
|
conversation.fetch().then(function () {
|
||||||
|
window.document.title = conversation.getTitle();
|
||||||
new Whisper.ConversationView({
|
new Whisper.ConversationView({
|
||||||
model: conversation
|
model: conversation
|
||||||
}).render().$el.prependTo($('body'));
|
}).render().$el.prependTo($('body'));
|
||||||
|
@ -31,7 +32,7 @@
|
||||||
var bg = extension.windows.getBackground();
|
var bg = extension.windows.getBackground();
|
||||||
|
|
||||||
extension.windows.getCurrent(function (windowInfo) {
|
extension.windows.getCurrent(function (windowInfo) {
|
||||||
var windowId = window.document.title = windowInfo.id;
|
var windowId = windowInfo.id;
|
||||||
|
|
||||||
// close the panel if background.html is refreshed
|
// close the panel if background.html is refreshed
|
||||||
bg.addEventListener('beforeunload', function () {
|
bg.addEventListener('beforeunload', function () {
|
||||||
|
|
|
@ -118,6 +118,10 @@
|
||||||
_.each(models, function(message) { message.destroy(); });
|
_.each(models, function(message) { message.destroy(); });
|
||||||
this.archive();
|
this.archive();
|
||||||
return this.save();
|
return this.save();
|
||||||
|
},
|
||||||
|
|
||||||
|
getTitle: function() {
|
||||||
|
return this.get('name') || this.get('members') || this.id;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ var Whisper = Whisper || {};
|
||||||
render: function() {
|
render: function() {
|
||||||
this.$el.html(
|
this.$el.html(
|
||||||
Mustache.render(this.template, {
|
Mustache.render(this.template, {
|
||||||
contact_name: this.model.get('name') || this.model.get('members') || this.model.id,
|
contact_name: this.model.getTitle(),
|
||||||
last_message: this.model.get('lastMessage'),
|
last_message: this.model.get('lastMessage'),
|
||||||
last_message_timestamp: moment(this.model.get('timestamp')).format('MMM D')
|
last_message_timestamp: moment(this.model.get('timestamp')).format('MMM D')
|
||||||
})
|
})
|
||||||
|
|
Loading…
Reference in a new issue