Parcourir la source

Use composition instead of chaining.

JC Brand il y a 8 ans
Parent
commit
d79bfe6f28
1 fichiers modifiés avec 1 ajouts et 1 suppressions
  1. 1 1
      src/converse-core.js

+ 1 - 1
src/converse-core.js

@@ -887,7 +887,7 @@
                  */
                 var resources = this.get('resources');
                 if (_.isObject(resources) && _.size(resources)) {
-                    var val = _(resources).values().sortBy('priority').reverse().get(0);
+                    var val = _.flow(_.values, _.partial(_.sortBy, _, 'priority'), _.reverse)(resources)[0];
                     if (!_.isUndefined(val)) {
                         return val.status;
                     }