From 9cfec0ba8ceefe010229d4e6ad0504c4eb610c75 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Tue, 21 Jun 2016 17:48:18 +0000 Subject: [PATCH] Show requesting contacts at the top of the roster view. --- docs/CHANGES.md | 5 +++-- spec/controlbox.js | 2 +- src/converse-rosterview.js | 10 +++++----- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/CHANGES.md b/docs/CHANGES.md index 336f587c9..78043c244 100755 --- a/docs/CHANGES.md +++ b/docs/CHANGES.md @@ -3,6 +3,7 @@ ## 1.0.4 (Unreleased) - Restrict occupants sidebar to 30% chatroom width. [jcbrand] +- Made requesting contacts more visible, by placing them at the top of the roster. [jcbrand] ## 1.0.3 (2016-06-20) @@ -15,9 +16,9 @@ - Add processing hints to chat state notifications [jcbrand] - Don't use sound and desktop notifications for OTR messages (when setting up the session) [jcbrand] - New config option [default_state](https://conversejs.org/docs/html/configuration.html#default_state) [jcbrand] -- New API method `converse.rooms.close()` +- New API method `converse.rooms.close()` [jcbrand] - New configuration setting [allow_muc_invites](https://conversejs.org/docs/html/configuration.html#allow-muc-invites) [jcbrand] -- Add new event [pluginsInitialized](https://conversejs.org/docs/html/development.html#pluginsInitialized) +- Add new event [pluginsInitialized](https://conversejs.org/docs/html/development.html#pluginsInitialized) [jcbrand] - #553 Add processing hints to OTR messages [jcbrand] - #650 Don't ignore incoming messages with same JID as current user (might be MAM archived) [jcbrand] - #656 online users count in minimized chat window on initialization corrected [amanzur] diff --git a/spec/controlbox.js b/spec/controlbox.js index 54300a2d5..d9abb09fb 100644 --- a/spec/controlbox.js +++ b/spec/controlbox.js @@ -320,12 +320,12 @@ // requesting and pending contacts are last. var group_titles = $.map(this.rosterview.$el.find('dt'), function (o) { return $(o).text().trim(); }); expect(group_titles).toEqual([ + "Contact requests", "colleagues", "Family", "friends & acquaintences", "ænemies", "Ungrouped", - "Contact requests", "Pending contacts" ]); // Check that usernames appear alphabetically per group diff --git a/src/converse-rosterview.js b/src/converse-rosterview.js index bb59cb54b..8d55b3c74 100644 --- a/src/converse-rosterview.js +++ b/src/converse-rosterview.js @@ -33,9 +33,9 @@ var HEADER_REQUESTING_CONTACTS = __('Contact requests'); var HEADER_UNGROUPED = __('Ungrouped'); var HEADER_WEIGHTS = {}; - HEADER_WEIGHTS[HEADER_CURRENT_CONTACTS] = 0; - HEADER_WEIGHTS[HEADER_UNGROUPED] = 1; - HEADER_WEIGHTS[HEADER_REQUESTING_CONTACTS] = 2; + HEADER_WEIGHTS[HEADER_REQUESTING_CONTACTS] = 0; + HEADER_WEIGHTS[HEADER_CURRENT_CONTACTS] = 1; + HEADER_WEIGHTS[HEADER_UNGROUPED] = 2; HEADER_WEIGHTS[HEADER_PENDING_CONTACTS] = 3; converse_api.plugins.add('rosterview', { @@ -69,9 +69,9 @@ } else if (a_is_special && b_is_special) { return HEADER_WEIGHTS[a] < HEADER_WEIGHTS[b] ? -1 : (HEADER_WEIGHTS[a] > HEADER_WEIGHTS[b] ? 1 : 0); } else if (!a_is_special && b_is_special) { - return (b === HEADER_CURRENT_CONTACTS) ? 1 : -1; + return (b === HEADER_REQUESTING_CONTACTS) ? 1 : -1; } else if (a_is_special && !b_is_special) { - return (a === HEADER_CURRENT_CONTACTS) ? -1 : 1; + return (a === HEADER_REQUESTING_CONTACTS) ? -1 : 1; } } }