Commit Graph

215 Commits

Author SHA1 Message Date
Brock Whittaker a223b7364b activity: Switch ".user-list-filter" to only be queried once.
For static queries like this, just fetch it once so we don’t have to
worry about the overhead.
2017-10-04 17:03:23 -07:00
Brock Whittaker b3b7bf70ca activity: Update sidebar selectors if they don't exist.
The sidebar selectors may not exist at a particular point on load but
we’d like to realistically cache the results once they are, so we try
to load them live until we know that a valid selector has been found.
2017-09-28 18:29:54 -07:00
Brock Whittaker 232b6c694b activity: Remove unnecessary scrollbar update of users.
This call to update the users scrollbar is inside a huddles update
method which should only affect the group PMs, so we can remove the
update function.
2017-09-28 18:29:54 -07:00
Brock Whittaker c9864d3d0e activity: Remove unnecessary extra call to `resize_page_components`.
The `exports.build_user_sidebar` method already calls the resize
function, so there’s no need to call it again or wrap it in the
`actually_update_users_for_search` method.
2017-09-28 18:29:54 -07:00
Brock Whittaker 983be4e8ce right-sidebar: Add perfectScrollbar to the right sidebar.
This adds the perfectScrollbar to the right side and theoretically
updates it any time a piece of code interacts with the sidebar and
updates the counts of users displayed in it.
2017-09-27 19:21:20 -07:00
Cory Lynch d32e89aae4 jQuery: Remove broken use of "removeAttr".
This function no longer sets properties to false, so the supported
way of doing this is to instead use prop(foo, false). Some tests
had to be fixed to accommodate this.
2017-07-24 10:54:47 -07:00
Steve Howell ee17f8fc8d Move mousemove function into initialize(). 2017-05-24 17:41:41 -07:00
Steve Howell 884d9d1a2d Simplify unread count display logic in buddy list.
This commit de-couples the PM code from Group code.  It also
simplified some code related to finding parent elements by
both introducing local variables and removing unnecessary
selectors.
2017-05-24 13:07:33 -07:00
Steve Howell d5d6d47287 Fix unread counts for Group PMs.
The variable name "name" was completely wrong, and I guess
this never generated a traceback or lint error.
2017-05-24 09:18:24 -07:00
Tim Abbott a28f5db050 presence: Check for unsuspend status on receiving responses.
This is the first part of handling an annoying race that would cause
us to try drawing the right sidebar using (in part) users that we
haven't learned about yet (because we were offline/suspended when they
were created, and we haven't quite realized our event queue is gone yet).
2017-05-04 16:11:05 -07:00
Tim Abbott 27f07e6a99 activity: Remove page_params.presences after use.
This is just meant to avoid there being any confusion about whether
this field does anything after this point.
2017-04-28 21:31:19 -07:00
fionabunny 453fc06686 home.py: move initial_presences as presenses to register_ret.
Simplify the page_params generation logic #3853.
2017-04-28 21:30:29 -07:00
Brock Whittaker c7cb20d873 alerts: Polish .alert-box .alert styling.
This polishes the styling on the alerts inside of the .alert-box to
have more appropriate colors, margins, and padding.
2017-04-28 12:50:04 -07:00
Joshua Pan 728594c74a activity.js: Stop opening compose box in user search.
This prevents compose box from opening when you
just press enter with an empty search field in
user search.

Fixes #4376.
2017-04-19 22:18:08 -07:00
Steve Howell 205f2c1562 Add ping_only flag for presence updates.
The web app doesn't need any presence data for its first ping to
the server, because it already has up-to-date presence info in
page_params.  So now we can tell the server not to send us a big
payload that we were already ignoring.
2017-04-04 15:57:10 -07:00
Steve Howell 2718bd0b5d Extract presence.js to track presence info.
Most of this code was simply moved from activity.js with some
minor renaming of functions like set_presence_info -> set_info.

Some functions were slightly nontrivial extractions:

    is_not_offline:
        came from activity.huddle_fraction_present

    get_status/get_mobile:
        simple getters

    set_user_status:
        partial extraction from activity.set_user_status

    last_active_date:
        pulled out of admin.js code

We also fixed activity.filter_and_sort to take user_ids.
2017-04-04 15:57:10 -07:00
Harshit Bansal d17b759fa2 admin: Display last active time of users in admin users table.
Fixes: #2097.
2017-03-27 13:39:47 -07:00
Steve Howell 29412cd06b bug fix: Fix missing return statement in get_filter_li().
This was regressed in 89e17e1aee.

At least one of the symptoms was that we weren't updating the
activity list properly.  This could also cause tracebacks in
compose fade logic.
2017-03-20 09:49:19 -07:00
Steve Howell faa9446e64 Add compose_actions.start() shim. 2017-03-18 15:52:50 -07:00
Steve Howell acef337c28 bug fix: Fix update-one-user regression in compose fading.
We now correctly pass the list item for a user to the function
compose_fade.update_one_row().

This regression started happening in the recent commit of
eece725073.  Before that commit,
compose-fade was broken in a different way.

Testing this fix requires creating a stream and opening the compose
box in one window.  Then, in the other window, have a user not
subscribed to the stream log on for the first time.  Be careful
to make sure you flip back to the other browser tab quickly, and
you should see the new user grayed out.  (You can get a false
positive if you wait too long, because the periodic update was
correctly fading before this fix.)
2017-03-17 12:16:48 -07:00
Steve Howell 89e17e1aee refactor: Extract activity.get_user_list_item(). 2017-03-17 12:16:48 -07:00
Steve Howell a61f468348 Simplify buddy list status level sorting.
Introducing the level function makes it a bit more clear that active
users get sorted to the top.

It also shaves a couple milliseconds for large buddy lists, although
that is mostly negligible compared to name sorting and rendering.
2017-03-08 11:32:23 -08:00
Steve Howell bdd8964ca9 Simplify and speed up buddy list name sorting.
We remove duplicate calls to people.get_person_from_user_id here.
With 2000 users, this makes the sort about 10ms faster.
2017-03-08 11:32:23 -08:00
Steve Howell a246d2dcb3 refactor: Eliminate presence_info params.
It's easier to reason about the activity.js code if we just
make it clear that presence_info is a global singleton.  Going
forward, functions that use that data will explicitly refer to
exports.presence_info.

This change makes some tests slightly more awkward to set up, but
with the actual code you now don't have to question whether there
are multiple copies of presence_info to maintain.

The diff for compare_function is a bit confusing to read, but it's
basically just de-dented since we don't need to parameterize the
compare function any more.
2017-03-08 11:32:23 -08:00
Steve Howell 89d362656a Simplify focus_lost() function (and add comments).
The function focus_lost() was setting has_focus to false
in all cases; now it does it more clearly.  I also added a
comment explaining why we don't ping on losing focus.
2017-03-08 11:32:22 -08:00
Steve Howell 7cec88c748 performance: Avoid unnecessary buddy list redraws.
We no longer build the buddy list twice during page load; we
build it just once from page_params information.  (We also send
the initial ping and schedule subsequent pings slightly later in
the process.)

We also don't do redraws upon regaining focus, since we don't
show ourselves in the buddy list, and even if we did, we wouldn't
need a full server update.

To have this flexibility, we introduce the want_redraw flag to
focus_ping.
2017-03-08 11:09:13 -08:00
Joshua Pan b1e7ecdad2 user search: Hitting enter narrows to user PM.
Fixes #3874.
2017-03-07 21:05:56 -08:00
Raghav Jajodia c3dbce810e right-sidebar: Added clear-search button on user-list searchbar.
A clear-search option to clear the user-list searchbox has been added.
This feature was present in the main searchbar but absent elsewhere.
Fix a part of #3716.
2017-03-04 20:30:58 -08:00
Steve Howell 976185da30 Streamline compose fading for presence updates.
We now only update the new element.
2017-02-28 16:40:10 -08:00
Steve Howell ef9a28fa29 Simplify inserting users into right sidebar.
The test that is removed here was more confusing than useful.
2017-02-28 16:40:10 -08:00
Steve Howell c78e20450c Change activity.set_user_statuses to be set_user_status().
We only get one presence update at a time, so now the
activity.js function reflects that.
2017-02-28 16:26:01 -08:00
Steve Howell 5b96f8db9a Extract get_compare_function() in activity.js. 2017-02-28 16:26:01 -08:00
Tim Abbott e86ed89986 page_params: scope presence_disabled in realm. 2017-02-28 14:58:53 -08:00
Steve Howell d4206f2f5f Speed up building user sidebar during page load.
We now call activity.build_user_sidebar when we initialize
the user sidebar, which avoids some janky jQuery code
that was intended for partial updates.

With 2000 users in dev, the amount of time to build the sidebar
decreases from 1100ms to 700ms in my tests.  (Times vary a bit,
but it does seem consistently faster now.)
2017-02-20 18:07:01 -08:00
Steve Howell 2aa7d20a51 refactor: Split build_user_sidebar() from update_users().
Activity.update_users() is still used to handle partial
updates of users in the buddy list, but now all the places
that want to re-build the whole widget go through
build_user_sidebar().
2017-02-20 15:53:14 -08:00
Steve Howell 2566a89f81 refactor: Extract activity.set_presence_info(). 2017-02-20 15:02:56 -08:00
vaibhav 8ac4fe1a73 activity.js: Move info_for and get_num_unread.
We are just moving these functions out to the module
level.  They didn't need to be inner functions.
2017-02-20 14:02:57 -08:00
Steve Howell 08bc69f8af huddles: Calculate huddle strings more robustly.
We now build huddle strings used in activity.js from
user ids in message.display_recipient.
2017-02-06 22:38:22 -08:00
Steve Howell 88870c316f Use Dict[user_id] in people.filter_by_search_terms.
The function people.filter_by_search_terms() used
to return a JS object with emails as keys to represent
a set of users.  Now we return a Zulip Dict() object
with user_ids as keys.
2017-01-26 10:24:15 -08:00
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
Steve Howell cb6438234a Add search filter for user list.
Whatever text is entered into the search box under users is used
to filter users by their full names.  You can use commas to search
for multiple users. Search terms must be at the start of names, so
"st,fr" would match "Steve Howell" and "Leo Franchi" but not
"jesstess."  Names are case insensitive.

(imported from commit 822b72883928d3c941d38e9798774d71b0689f30)
2014-01-13 16:16:05 -05:00
Tim Abbott 7fa3bdba72 Convert /json/update_active_status to use channel.js.
(imported from commit 75c7a1c9701b4ff0db8e52c31126d778054b6c29)
2014-01-10 21:39:00 -05:00
Steve Howell f174038100 Throttle user list updates to 5s intervals.
(imported from commit 908806d1ac00f14802f2a01a40d0abb66778a441)
2013-12-17 11:54:53 -05:00
Steve Howell 1c67fdb95d Move user list unread-count logic to templates.
When we rebuild the user list from scratch, set the unread
counts in the templates to avoid multiple DOM updates.

(imported from commit 2d0c9b0fb99b382332e464ba7c3caad95e05363e)
2013-12-17 10:59:25 -05:00
Zev Benjamin 6f0477f491 Increase number of names shown in group PM list from 2 to 3
(imported from commit eff308fb1405290488f74d9064fd859d33c99558)
2013-12-06 17:54:05 -05:00
Steve Howell 80ec6ff8bc Remove transitional show_huddles flag.
(imported from commit 37f6cdb4f62076faa1e977ec9b0a53cc461f0d11)
2013-12-03 10:45:01 -05:00
Waseem Daher aeaac45fd0 Hide right-sidebar user/group PM list from MIT.
(imported from commit 2e3ba1ffd3a33450580a164c0aa1ced23eee37c2)
2013-11-30 18:31:05 -05:00
Steve Howell 62089aeff6 Make sure unread counts stick for huddles.
Every time we re-render the huddles section, we need to
update the unread count.  We do this is in very similar
fashion to how we update individual users.

(imported from commit 2419365bc602ddaebc609090e119c0dcfad35bb7)
2013-11-08 12:11:28 -05:00
Steve Howell 52ec258122 [staging only] Show Recent Group PMs in right sidebar.
Show up to 10 of your recent group PM conversations in the right
sidebar.  Clicking on the links narrows to the huddle and opens the
compose box for the huddle.  The green circles have opacity
proportional to the number of users present in the huddle.

This is feature flagged to staging only.

Some of this code was written by Allen before commits were squashed.

Known issue: unread counts disappear on certain refresh events.

(imported from commit 3b44665150ba20594d8b0295cb30df03601c1d52)
2013-11-07 16:54:13 -05:00
Steve Howell 7bde1f7716 Add activity.short_huddle_name().
(imported from commit e3f0389298631fd06169dbc9559691470ac19d00)
2013-11-07 16:54:13 -05:00
Steve Howell 9adcba1e6d Add activity.huddle_fraction_present().
Add a method that lets us know what percentage of a huddle is
present.  (We can use this later to set the opacity of huddles
in the UI.)

(imported from commit 8a2383951807d7bfbf9d730a8980d977cf23b379)
2013-11-07 16:54:13 -05:00
Steve Howell 4fb4e04501 Add activity.full_huddle_name().
(imported from commit 304e47ac88d7497fcde49f448912a2e063dd0bd1)
2013-11-05 15:34:29 -05:00
Steve Howell 6d511486cb Add activity.process_loaded_messages() and get_huddles().
Activity.js now has the capability to track huddles that
come through in loaded messages and return them in reverse
chronological order by their most recent message.  Right
now this only connected to a unit test, not any production
code.

(imported from commit 59957086fa2e454e5711472df091f178217aed2b)
2013-11-05 15:34:28 -05:00
Steve Howell a4ff7320fb Remove unused presence_description "away" entry.
(imported from commit 46f377399335ca9757ee52ecd21d6679b52635ed)
2013-11-05 15:34:28 -05:00
Steve Howell 617b0a95d2 Short circuit MIT case earlier in update_users().
This can be squashed with the prior commit, which inlined this
MIT check into update_users() while trying to avoid other
complications.  After inlining the code, it's clear that we
don't need to call the sort_users() line of code for MIT users,
so I moved the MIT guard condition up.

(imported from commit fa5b52e14964ad595b34d40ce6c8450ea93726c5)
2013-11-05 15:34:27 -05:00
Steve Howell 7f3115fa53 Move set_presence_list from ui.js to activity.js.
Since ui.set_presence_list is only called from activity.js, I am
inlining the code into activity.update_users().  This also allows
us to move ui.presence_descriptions into activity.js, which
is the right home for presence-related things.

(imported from commit 0ff239275c544a86c14d517bc386d06726b81cd9)
2013-11-05 15:34:27 -05:00
Steve Howell 82fd0f2b52 Rename user_info -> presence_info inside activity.js.
The user_info var was mapping users to presence information, and
presence_info is a better name for it.  This change is partly tactical,
as it sets us up to inline ui.set_presence_list, which receives
user_list as presence_list and then has a completely different
variable called user_info.

By doing this pre-factoring, the next commit becomes just a pure
code move without more moving parts of renaming variables.

(imported from commit 4b015d19886b43d24905124eb37cd9dd317aa87b)
2013-11-05 15:34:26 -05:00
Steve Howell e83c026a27 Set focus-related flags correctly after a server reload
(imported from commit 408469c0da0cfa5513e6838329816cd88665981f)
2013-09-16 12:29:34 -04:00
Tim Abbott 9fcca3df4e [schema] Collect data on when users are active on site.
These engagement data will be useful both for making pretty graphs of
how addicted our users are as well as for allowing us to check whether
a new deployment is actually using the product or not.

This measures "number of minutes during which each user had checked
the app within the previous 15 minutes".  It should correctly not
count server-initiated reloads.

It's possible that we should use something less aggressive than
mousemove; I'm a little torn on that because you really can check the
app for new messages without doing anything active.

This is somewhat tested but there are a few outstanding issues:

* Mobile apps don't report these data.  It should be as easy as having
  them send in update_active_status queries with new_user_input=true.

* The semantics of this should be better documented (e.g. the
  management script should print out the spec above)x.

(imported from commit ec8b2dc96b180e1951df00490707ae916887178e)
2013-09-10 13:25:59 -04:00
Luke Faraone a305a7de63 Up offline threshold to 140sec and decrease ping interval to 50sec.
This is intended to help us debug what's going on with presence information.

(imported from commit 637ccea594ae51bc7b266620596180479ee754f0)
2013-08-21 14:45:01 -07:00
Luke Faraone a1a5d00e9f Update your presence dot when your activity changes.
(imported from commit ecdc056db987d4404ded01092f5693ac8dd28ae9)
2013-08-21 11:10:31 -04:00
Luke Faraone f17d030272 Send IDLE continuously when idle, interpret a too-old status as offline.
This helps make our statuses more meaningful and should resolve trac #1534.

As part of this, we lower OFFLINE_THRESHOLD_SECS to 1.1̅6 minutes and
mark the user as idle after 5 minutes.

(imported from commit ee6b1ad203554a84b11e16c4c6195be9df5bcf4f)
2013-08-21 11:07:45 -04:00
Zev Benjamin ec9322fc87 Use Dict everywhere we have keys based on potentially dangerous, user-supplied data
There are also one or two places we don't need to use it for security
purposes, but we do so for consistencey.

(imported from commit aa111f5a22a0e8597ec3cf8504adae66d5fb6768)
2013-08-09 17:35:14 -04:00
Steve Howell 6790ed79cc Add a unit test for activity.js.
This includes slightly invasive, but harmless, changes to
the production code.

(imported from commit ff40af504de2360ada866508da262e0d2e9f7ad9)
2013-08-09 13:11:59 -04:00
Scott Feeney 8703134a23 Replace $.each with _.each
In a few cases the $.each was doing something imperatively that was
terser and easier to understand by using a different Underscore method,
so a few of these I rewrote.

Some code was using the fact that jQuery sets `this` in the callback to
be the item; I rewrote those to use an explicit parameter.

Some code was using $(some selector).each(callback). I converted these
to _.each($(some selector), callback).

One function, ui.process_condensing, was written to be a jQuery $.each
callback despite being in a totally different module from code using it.
I noticed this and updated the function's args.

(imported from commit bf5922a35f257c168cc09ec1d077415d6ef19a03)
2013-07-30 12:12:58 -04:00
Tim Abbott 3bba0cc927 Move zephyr/static to just static.
It's not really a part of the server (aka the rest of zephyr/).

(imported from commit 27f6b6b064938ad927075a68d873e4b68710d279)
2013-07-29 12:11:26 -04:00