Render end session messages correctly

This commit is contained in:
lilia 2015-02-13 13:12:54 -08:00
parent 488f25635d
commit f00a8f1e81
4 changed files with 36 additions and 0 deletions

View file

@ -105,6 +105,7 @@
<script type="text/javascript" src="js/views/file_input_view.js"></script>
<script type="text/javascript" src="js/views/list_view.js"></script>
<script type="text/javascript" src="js/views/new_group_update_view.js"></script>
<script type="text/javascript" src="js/views/end_session_view.js"></script>
<script type="text/javascript" src="js/views/group_update_view.js"></script>
<script type="text/javascript" src="js/views/attachment_view.js"></script>
<script type="text/javascript" src="js/views/message_view.js"></script>

View file

@ -176,6 +176,7 @@
decrypted_at : now,
type : type,
sent_at : timestamp,
flags : pushMessageContent.flags,
errors : []
});

View file

@ -0,0 +1,30 @@
/* vim: ts=4:sw=4:expandtab
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.EndSessionView = Backbone.View.extend({
tagName: "div",
className: "end-session",
render: function() {
this.$el.text("Secure session ended");
return this;
}
});
})();

View file

@ -44,6 +44,8 @@
this.group_update_view = new Whisper.GroupUpdateView({
model: groupUpdate
}).render();
} else if (this.model.get('flags') === textsecure.protobuf.PushMessageContent.Flags.END_SESSION) {
this.end_session_view = new Whisper.EndSessionView();
} else {
this.template = $('#message').html();
}
@ -57,6 +59,8 @@
render: function() {
if (this.group_update_view) {
this.$el.append(this.group_update_view.$el);
} else if (this.end_session_view) {
this.$el.append(this.end_session_view.$el);
} else {
this.$el.html(
Mustache.render(this.template, {