Explorar o código

Use composition instead of chaining

JC Brand %!s(int64=8) %!d(string=hai) anos
pai
achega
728c7622e9
Modificáronse 1 ficheiros con 1 adicións e 1 borrados
  1. 1 1
      src/converse-core.js

+ 1 - 1
src/converse-core.js

@@ -1253,7 +1253,7 @@
                     contact.save({'chat_status': contact.getHighestPriorityStatus()});
                 } else if (contact) { // presence_type is undefined
                     var resources = contact.addResource(resource, priority, chat_status);
-                    if (priority >= _(resources).values().map('priority').max()) {
+                    if (priority >= _.flow(_.values, _.partial(_.map, _, 'priority'), _.max)(resources)) {
                         // Only save if it's the resource with the highest
                         // priority
                         contact.save({'chat_status': chat_status});