Move identity conflicts to top of message detail

Also restyle them as with network errors

// FREEBIE
This commit is contained in:
lilia 2016-02-14 16:46:28 -08:00
parent b5058e3981
commit ad66da9fb5
5 changed files with 27 additions and 9 deletions

View file

@ -17,6 +17,9 @@
"verify": { "verify": {
"message": "Verify" "message": "Verify"
}, },
"newIdentity": {
"message": "New Identity"
},
"outgoingKeyConflict": { "outgoingKeyConflict": {
"message": "This contact's identity key has changed. Click to process and display." "message": "This contact's identity key has changed. Click to process and display."
}, },

View file

@ -173,10 +173,17 @@
<div class='container'> <div class='container'>
{{ #hasRetry }} {{ #hasRetry }}
<div class='hasRetry clearfix'> <div class='hasRetry clearfix'>
<div class='retryMessage'>{{ failedToSend }}</div> <h3 class='retryMessage'>{{ failedToSend }}</h3>
<button class='retry'>{{ resend }}</button> <button class='retry'>{{ resend }}</button>
</div> </div>
{{ /hasRetry }} {{ /hasRetry }}
{{ #hasConflict }}
<div class='hasConflict clearfix'>
<h3>{{ hasConflict }}</h3>
<div class='conflicts'>
</div>
</div>
{{ /hasConflict }}
<div class='message-container'></div> <div class='message-container'></div>
<div class='info'> <div class='info'>
<table> <table>

View file

@ -101,7 +101,11 @@
conflict: conflict, conflict: conflict,
errors: this.errors[contact.id] errors: this.errors[contact.id]
}).render(); }).render();
this.$('.contacts').append(v.el); if (conflict) {
this.$('.conflicts').append(v.el);
} else {
this.$('.contacts').append(v.el);
}
}, },
render: function() { render: function() {
this.errors = _.groupBy(this.model.get('errors'), 'number'); this.errors = _.groupBy(this.model.get('errors'), 'number');
@ -110,6 +114,10 @@
e.name === 'OutgoingMessageError' || e.name === 'OutgoingMessageError' ||
e.name === 'SendMessageNetworkError'); e.name === 'SendMessageNetworkError');
}); });
var hasConflict = false;
if (this.model.hasKeyConflicts()) {
hasConflict = i18n('newIdentity');
}
this.$el.html(Mustache.render(_.result(this, 'template', ''), { this.$el.html(Mustache.render(_.result(this, 'template', ''), {
sent_at : moment(this.model.get('sent_at')).toString(), sent_at : moment(this.model.get('sent_at')).toString(),
received_at : this.model.isIncoming() ? moment(this.model.get('received_at')).toString() : null, received_at : this.model.isIncoming() ? moment(this.model.get('received_at')).toString() : null,
@ -121,7 +129,8 @@
resend : i18n('resend'), resend : i18n('resend'),
failedToSend: i18n('failedToSend'), failedToSend: i18n('failedToSend'),
errorLabel : i18n('error'), errorLabel : i18n('error'),
hasRetry : hasRetry hasRetry : hasRetry,
hasConflict : hasConflict
})); }));
this.view.$el.prependTo(this.$('.message-container')); this.view.$el.prependTo(this.$('.message-container'));

View file

@ -94,16 +94,13 @@
height: calc(100% - (#{$header-height} + 4px)); height: calc(100% - (#{$header-height} + 4px));
} }
.hasConflict,
.hasRetry { .hasRetry {
background: #F3F3A7; background: #F3F3A7;
padding: 10px 20px; padding: 10px 20px;
margin: 0 5px; margin: 0 5px;
border-radius: 5px; border-radius: 5px;
.retryMessage {
font-weight: bold;
}
button { button {
margin: 5px; margin: 5px;
background: $blue; background: $blue;

View file

@ -649,13 +649,13 @@ input.search {
.message-detail .container { .message-detail .container {
height: calc(100% - (36px + 4px)); } height: calc(100% - (36px + 4px)); }
.message-detail .hasConflict,
.message-detail .hasRetry { .message-detail .hasRetry {
background: #F3F3A7; background: #F3F3A7;
padding: 10px 20px; padding: 10px 20px;
margin: 0 5px; margin: 0 5px;
border-radius: 5px; } border-radius: 5px; }
.message-detail .hasRetry .retryMessage { .message-detail .hasConflict button,
font-weight: bold; }
.message-detail .hasRetry button { .message-detail .hasRetry button {
margin: 5px; margin: 5px;
background: #2090ea; background: #2090ea;
@ -665,8 +665,10 @@ input.search {
color: white; color: white;
padding: 0.5em; padding: 0.5em;
font-weight: bold; } font-weight: bold; }
.message-detail .hasConflict button span,
.message-detail .hasRetry button span { .message-detail .hasRetry button span {
vertical-align: middle; } vertical-align: middle; }
.message-detail .hasConflict button:before,
.message-detail .hasRetry button:before { .message-detail .hasRetry button:before {
content: ''; content: '';
display: inline-block; display: inline-block;