Commit Graph

76 Commits

Author SHA1 Message Date
Steve Howell 73125e2718 refactor: Move is_current_user() to people.js.
We no longer have it in util.js, because we will
want to encapsulate this better for upcoming commits
related to email changes.
2017-01-21 21:45:12 -08:00
Steve Howell c0281498e6 group PMs: Fix hrefs in right sidebar for groups.
For the "GROUP PMs" part of the right sidebar, we now have
accurate hrefs when you hover over the groups or right-click
to copy links or open links in new tabs.
2017-01-17 15:13:49 -08:00
Steve Howell d757f840dd Make nicer slugs for "pm-with" narrows.
The slugs for PM-with narrows now have user ids in them, so they
are more resilient to email changes, and they have less escaping
characters and are generally prettier.

Examples:

    narrow/pm-with/3-cordelia
    narrow/pm-with/3,5-group

The part of the URL that is actionable is the comma-delimited
list of one or more userids.

When we decode the slugs, we only use the part before the dash; the
stuff after the dash is just for humans.  If we don't see a number
before the dash, we fall back to the old decoding (which should only
matter during a transition period where folks may have old links).

For group PMS, we always say "group" after the dash. For single PMs,
we use the person's email userid, since it's usually fairly concise
and not noisy for a URL.  We may tinker with this later.

Basically, the heart of this change is these two new methods:

    people.emails_to_slug
    people.slug_to_emails

And then we unify the encode codepath as follows:

    narrow.pm_with_uri ->
    hashchange.operators_to_hash ->
    hashchange.encode_operand ->
    people.emails_to_slug

The decode path didn't really require much modication in this commit,
other than to have hashchange.decode_operand call people.slug_to_emails
for the pm-with case.
2017-01-17 15:13:49 -08:00
Tim Abbott 998dff9e50 lint: Add dangling commas in JavaScript objects. 2017-01-11 15:23:42 -08:00
Steve Howell ef893dc8dd Live-update user list for name changes.
When somebody changes their name, we will now update
the buddy list right away.  The old code was trying
to do this through a code path that was designed for
true presence updates, but it was also passing in an
empty array, instead of undefined, which caused it to
fail to invoke the intended part of the codepath to
redraw the buddy list.

Now we just call the new activity.redraw() function,
which does the right thing for the buddy list.

The group PM list was live-updating before this change,
and it continues to live-update as part of the new
activity.redraw() function.
2017-01-04 19:45:15 -08:00
Brock Whittaker e7687bff6f Hide/Show Optimization with #group-pm-list.
The #group-pm-list now only should change state from hidden to
displayed once, which removes time spent recalculating styles in the
DOM.
2017-01-04 12:36:55 -08:00
Bickio 868f343980 Do not open compose box if user sidebar search is empty.
Fixes #2357.
2016-12-13 11:04:08 -08:00
lonerz dc6849952b eslint: change space-before-function-paren from warning to error.
Also fix violations.
2016-12-05 09:50:37 -08:00
Rafid Aslam 0290aeb6ab lint: Fix several no-unused-vars eslint rule violations.
These changes were extracted by tabbott from the original commit
to merge now because they have been reviewed as safe.
2016-12-03 18:43:47 -08:00
AZtheAsian 5e9918135b eslint: change quote-props from off to error and fix violations. 2016-12-02 18:35:53 -08:00
AZtheAsian 9c0ebc7359 eslint: change no-else-return to error and fix violations 2016-12-02 14:43:09 -08:00
kevv87 e6369fc29b eslint: change no-plusplus from warning to 2 and fix violations. 2016-12-01 14:27:17 -08:00
Tim Abbott 3d1bcb05e1 tornado: Move event_queue.py to zerver/tornado/.
Fixes #729.
2016-11-26 22:29:28 -08:00
Steve Howell 604079a9d4 Fix formatting for Group PMs in the right sidebar.
We now sort users by the lower case value of their
full names in each of the links in the "GROUP PMs"
section of the right sidebar.  We still use "+n others"
for big huddles.
2016-11-26 11:48:52 -08:00
Steve Howell af9ff9a030 Have unread.num_unread_for_person accept a user_id.
(It used to take an email as its parameter.)
2016-11-26 11:48:52 -08:00
Steve Howell aadfe133e2 buddy list: Use user_ids in DOM list elements. 2016-11-26 11:48:52 -08:00
Steve Howell 8f96853fcb presence: Convert presence_info to use user IDs.
When we filtered buddy lists, a recent change introduced some
bugs related to case-insensitive emails.  We now circumvent the
bug by indexing presence_info with user_ids.
2016-11-17 13:27:28 -08:00
Steve Howell 9eb825fff5 Refactor PM unread counts to use user_ids as keys.
We now use comma-delimited lists of user_ids for the following
data structures in unread.js:

    - unread_privates[<user_ids_string>]
    - get_counts.pm_count[<user_ids_string>]
2016-11-15 18:31:59 -08:00
Steve Howell e7a2b51647 Consolidate people searches (buddy list/subscribers).
We now use the same people-filtering code for the buddy
list that we use in subscriber search.
2016-11-14 16:01:13 -08:00
Steve Howell 47ef26fa55 refactoring: Let activity.js manage its own unread counts.
This change breaks a needless dependency of activity.js on
stream_list.js.
2016-11-11 12:27:03 -08:00
Steve Howell 06f4857221 buddy list: Make Group PMs appear more quickly.
It used to be the case that you would get new messages for a
huddle, but the huddle wouldn't show up on your buddy list until
the every-50-seconds mass update of the buddy list.

Now we make sure to work with non-stale jQuery objects, and,
more importantly, we resize ourselves if we add new huddles.

(The resize issue arises due to some complicated heuristics
where we don't want group PMs to take up too much of the buddy
list for users who don't have many in their history.)
2016-11-11 12:02:48 -08:00
Steve Howell eef633efa0 minor: Make get_huddles() internal to activity.js. 2016-11-11 10:41:18 -08:00
Tim Abbott d60ec24c1f js: Move set_user_statuses to activity.js initialization. 2016-11-05 11:33:04 -07:00
Tim Abbott c17676b00c Cleanup MIT hardcoding for disabling presence. 2016-07-26 20:30:12 -07:00
Tim Abbott b25562ca1d Add and use util.is_current_user helper function.
Previously, we were checking if a particular user was the current user
in dozens of places in the codebase, and correct case-insensitive
checks were not used consistently, leading to bugs like #502.
2016-06-07 21:58:44 -07:00
Tim Abbott 8df58432f6 Clear user filter after pressing enter to start compose.
Previously, the user list would remain filtered after a user hit enter
to start composing a message to a user, leaving them in a state with a
partial user list.

Fixes #360.
2016-04-29 15:01:41 -07:00
Ashish 1bf644369f Delete old route for json/update_active_status. 2016-04-11 21:38:23 -07:00
Ashish a12006d86f Replace /json/update_active_status with REST style route. 2016-04-11 21:38:23 -07:00
Tim Abbott 9607144bf2 Fix off-by-one error in presence list updating logic.
The original logic for incremental presence list updating from
668d0d9dfa incorrectly attempted to
insert the user 1 spot later than its proper index in the listing.
2016-03-21 20:28:05 -07:00
Tim Abbott 29b8d71871 Remove throttling of presence updates coming from server events.
Now that we're doing presence updates in a performant fashion, we
don't need to throttle processing these events, and in fact the
throttling of these events created a correctness problem, since we're
now doing incremental updates rather than just rerendering everything
after each event.
2016-03-21 20:28:05 -07:00
Tim Abbott 4bb48abc0d Fix quoting bug in user presence update function.
The code in 668d0d9dfa for removing an
existing user from the user list to update the status didn't correctly
quote the email address of the user in its jquery selector.
2016-03-21 20:28:05 -07:00
Vladislav Manchev 668d0d9dfa Fix performance issues with user presence list in large realms.
Whenever a user became active, this triggers an immediate presence
update event (to show that user as active).  The implementation for
that event (running on the browsers of all other users in the realm)
would fully rerender the presence list, which can be an expensive
operation in a large realm, just to update the status for that one
user.  This fixes that case to just remove the user from the list and
then re-insert it at the appropriate index.

[Commit message expanded with more details by Tim Abbott]
2016-02-12 20:04:43 -08:00
Tim Abbott 0494e40c39 Merge zerver/tornado_callbacks.py into zerver/lib/event_queue.py.
It had stopped being a coherently distinct component a while ago.

(imported from commit 0617957bcfe8dcaf69143c88a96ddd51ecb31a98)
2014-04-23 17:22:31 -07:00
Luke Faraone bba2eb7622 Send missedmessage notifications as soon as you're idle or offline
Previously, you'd have to be offline to recieve missedmessage
notifications, or maybe idle for an hour. However, I'm pretty sure the
latter code didn't actually work, so we scrap that and just nofity you
via email or push as soon as you're idle.

Closes trac #2350

(imported from commit 899966e0514db575b9640a96865639201824b579)
2014-03-14 20:48:57 -04:00
Steve Howell be2a1c2893 Move resizing code to resize.js.
(imported from commit b6df0007307872751e1a4200af740076e08b5c11)
2014-03-14 20:48:55 -04:00
Luke Faraone fd7dd0bc2c Use correct presence names for iOS mobile devices
(imported from commit d75f56c26d272342e2b4d074ea90a6d7fb9cff4e)
2014-03-11 13:06:23 -04:00
Luke Faraone bd20a756f9 Show a mobile icon in the presence list when relevant
We show a user as "on mobile" if:
 * They are only active on mobile
 * They are inactive on all devices and can receive push notifications

(imported from commit 0510b9371727cd19c72f6990df7112921c36ad48)
2014-03-11 13:06:23 -04:00
Leo Franchi 12c04151e9 Prevent click on user filter from collapsing popped-out user list
(imported from commit 182d82f41218e12faeaf07cd92cbee88a9fa6624)
2014-03-04 11:11:31 -05:00
Leo Franchi 5807a44aee Activity ping handling during a reload should not error out
(imported from commit 63c9f935985cdd4f3d795191aae5aa8ab8bad02b)
2014-02-28 16:27:12 -05:00
Luke Faraone 0ac73e4d73 Use a dict in presence_info rather than strings
This allows us to extend it to contain more details, as we will shortly.

(imported from commit 59b14592609810c5ac634a8237928ce029f33a83)
2014-02-27 20:25:38 -05:00
Steve Howell 2c6d7e8e18 Support q hotkey to Search people.
(imported from commit eafaf5900461e2df52de9ddbdc49823bf6d9e403)
2014-02-18 13:04:36 -05:00
Steve Howell 2d09036466 Have ESC blur Search people if it is empty.
(imported from commit d816c8b24cabfbea964fec9cb043f8a00c05f205)
2014-02-18 13:04:35 -05:00
Luke Faraone c33eeeee23 Open a PM from the peoplesearch list on <enter>
Closes trac #2274

(imported from commit 3238abe37b82a994769eebacbd5fced37fca9609)
2014-02-14 09:55:10 -05:00
Tim Abbott f5d3a6ddc7 Move suppress_unread_counts to unread.js.
(imported from commit fb64edc27b661d036c9f24715aeb3b4dbdf9463a)
2014-01-31 15:57:28 -05:00
Tim Abbott e505583f52 Split out new module people.js for tracking people.
(imported from commit fb9b769819ade25d1d3d6e452e68c7ee8651cfdd)
2014-01-30 17:32:58 -05:00
Steve Howell 1887b59504 Have the ENTER key blur people searches.
This is important for hotkey users to be able to use other hotkeys.
Since ESC clears a search, we need ENTER to merely blur the search;
otherwise, hotkey users will need to mouse away from the search box
if they want to keep the search sticky.

(imported from commit 204704435c7821c1ad3b7b750ffe3545adaff9aa)
2014-01-15 16:05:52 -05:00
Steve Howell aae001fa8e Have ESC key clear people searches.
(imported from commit a3f4cf0416f4f2ea76660bf68790988edc5675e2)
2014-01-15 16:05:52 -05:00
Steve Howell 85ff523965 Simplify filtering code in actually_update_users().
(imported from commit d11e56f5708bd3e5e52bc6452676a0fe2be17900)
2014-01-15 16:05:52 -05:00
Steve Howell 892b4b5db2 Remove user from his/her own buddy list.
(imported from commit 388a95b8f1b9c2a7622e1e083d3601c4015682e7)
2014-01-15 16:05:51 -05:00
Steve Howell a05e24667e Fix split command for names.
(imported from commit bed07c3d527b602b43b94ac1c6e77cd65042d341)
2014-01-13 16:28:39 -05:00