Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit f300ceb

Browse files
authored
Merge pull request #1711 from OpenBazaar/indicateTransactionStatusUpdates
LGTM.
2 parents 70b51de + 27b32f7 commit f300ceb

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed

js/templates/orderShort.html

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<div class="width100 cursorDefault positionWrapper <% if(ob.status == 0){ %>hideableChild<% } %>">
2-
<% if (ob.unread) { %>
2+
<%
3+
var flagStatus = false;
4+
if(ob.transactionType == "purchases"){
5+
flagStatus = ob.status == 2 || ob.status > 3;
6+
} else if(ob.transactionType == "sales") {
7+
flagStatus = ob.status == 1 || ob.status > 2;
8+
} else {
9+
flagStatus = true;
10+
}
11+
if (ob.unread || flagStatus && ob.status_changed) { %>
312
<div class="highlightRow"></div>
413
<% } %>
514
<div class="rowItem padding20">

js/views/transactionsVw.js

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,8 +287,21 @@ module.exports = pageVw.extend({
287287

288288
if (!filterBy || filterBy == "all"){
289289
tabCollection.comparator = function(model) {
290-
//add 1 so unread:zero doesn't get dropped from the front of the string when it's changed to a number by the -
291-
return -(String(model.get("unread")+1) + String(model.get("timestamp")));
290+
//order the collection so items that are unread or have status updates are first
291+
var status = model.get("status"),
292+
flagStatus = false;
293+
294+
//only use the status_changed if the status matters to that tab
295+
if(tabName == "purchases"){
296+
flagStatus = status == 2 || status > 3;
297+
} else if(tabName == "sales") {
298+
flagStatus = status == 1 || status > 2;
299+
} else {
300+
flagStatus = true;
301+
}
302+
303+
var attentionVal = model.get("unread") > 0 || model.get("status_changed") && flagStatus ? "2" : "1";
304+
return -(String(attentionVal) + model.get("timestamp"));
292305
};
293306
tabCollection.sort();
294307
}

0 commit comments

Comments
 (0)