소스 검색

Use composition instead of chaining

JC Brand 8 년 전
부모
커밋
728c7622e9
1개의 변경된 파일1개의 추가작업 그리고 1개의 파일을 삭제
  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});