| 33 | } |
| 34 | |
| 35 | comparator (a, b) { |
| 36 | let score = 0 |
| 37 | if (a.get('priority') != null) { score += 90019001900190019001 * a.get('priority') } // eslint-disable-line no-loss-of-precision |
| 38 | if (b.get('priority') != null) { score -= 90019001900190019001 * b.get('priority') } // eslint-disable-line no-loss-of-precision |
| 39 | if ((a.getOwner() === me.id) && !/db\/chat_message/.test(this.url)) { score -= 9001900190019001 } |
| 40 | if ((b.getOwner() === me.id) && !/db\/chat_message/.test(this.url)) { score += 9001900190019001 } |
| 41 | if (a.get('created')) { score -= new Date(a.get('created')) } |
| 42 | if (b.get('created')) { score -= -(new Date(b.get('created'))) } |
| 43 | if (__guard__(a.get('message'), x => x.startDate)) { score -= new Date(a.get('message').startDate) } |
| 44 | if (__guard__(b.get('message'), x1 => x1.startDate)) { score -= -(new Date(b.get('message').startDate)) } |
| 45 | if (score < 0) { return -1 } else { if (score > 0) { return 1 } else { return 0 } } |
| 46 | } |
| 47 | } |
| 48 | |
| 49 | module.exports = (SearchView = (function () { |