Skip to content

Commit

Permalink
Make it clear in conversation just some recipients failed
Browse files Browse the repository at this point in the history
FREEBIE
  • Loading branch information
scottnonnenberg committed Aug 4, 2017
1 parent c10e1b4 commit ff4fde6
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 5 deletions.
4 changes: 4 additions & 0 deletions _locales/en/messages.json
Expand Up @@ -475,6 +475,10 @@
"message": "Message not sent.",
"description": "Informational label, appears on messages that failed to send"
},
"someRecipientsFailed": {
"message": "Some recipients failed",
"description": "Informational label, for messages where some recipients succeeded, others failed"
},
"showMore": {
"message": "Details",
"description": "Displays the details of a key change"
Expand Down
3 changes: 3 additions & 0 deletions background.html
Expand Up @@ -191,6 +191,9 @@ <h3>{{ welcomeToSignal }}</h3>
{{ messageNotSent }}
<span href='#' class='retry'>{{ resend }}</span>
</script>
<script type='text/x-tmpl-mustache' id='some-failed'>
{{ someFailed }}
</script>
<script type='text/x-tmpl-mustache' id='keychange'>
<span class='content' dir='auto'><span class='shield icon'></span> {{ content }}</span>
</script>
Expand Down
19 changes: 19 additions & 0 deletions js/models/messages.js
Expand Up @@ -249,6 +249,25 @@
}.bind(this));
},

someRecipientsFailed: function() {
var c = this.getConversation();
if (c.isPrivate()) {
return false;
}

var recipients = c.contactCollection.length - 1;
var errors = this.get('errors');
if (!errors) {
return false;
}

if (errors.length > 0 && recipients > 0 && errors.length < recipients) {
return true;
}

return false;
},

sendSyncMessage: function() {
this.syncPromise = this.syncPromise || Promise.resolve();
this.syncPromise = this.syncPromise.then(function() {
Expand Down
13 changes: 13 additions & 0 deletions js/views/message_view.js
Expand Up @@ -25,6 +25,14 @@
resend: i18n('resend')
}
});
var SomeFailedView = Whisper.View.extend({
tagName: 'span',
className: 'some-failed',
templateName: 'some-failed',
render_attributes: {
someFailed: i18n('someRecipientsFailed')
}
});
var TimerView = Whisper.View.extend({
templateName: 'hourglass',
update: function() {
Expand Down Expand Up @@ -172,6 +180,7 @@
'click .error-icon': 'select',
'click .timestamp': 'select',
'click .status': 'select',
'click .some-failed': 'select',
'click .error-message': 'select'
},
retryMessage: function() {
Expand Down Expand Up @@ -241,6 +250,10 @@
if (this.model.hasNetworkError()) {
this.$('.meta').prepend(new NetworkErrorView().render().el);
}
this.$('.meta .some-failed').remove();
if (this.model.someRecipientsFailed()) {
this.$('.meta').prepend(new SomeFailedView().render().el);
}
},
renderControl: function() {
if (this.model.isEndSession() || this.model.isGroupUpdate()) {
Expand Down
8 changes: 7 additions & 1 deletion stylesheets/_conversation.scss
Expand Up @@ -406,11 +406,17 @@ li.entry .error-icon-container {
cursor: pointer;
}

.some-failed {
float: left;
margin-left: 6px;
margin-right: 6px;
}

.hasRetry, .timestamp, .status, .timer {
float: left;
}

.timestamp, .status {
.timestamp, .status, .some-failed {
cursor: pointer;
opacity: 0.5;

Expand Down
15 changes: 11 additions & 4 deletions stylesheets/manifest.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ff4fde6

Please sign in to comment.