Commit Graph

2075 Commits

Author SHA1 Message Date
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
Brock Whittaker 3b55519b11 Redesign "/features/" page in portico.
This redesigns the features page to incorporate the new landing nav,
CSS animations, and general styling of the product page set.
2017-03-07 23:25:39 -08:00
Raghav Jajodia 21f0339cfc compose: Focus on topic when narrowed to a stream+topic.
When narrowed to a stream+topic and clicking the "new topic" button,
focus in on topic and the text remains selected.
Fixes #3888.
2017-03-07 22:24:57 -08:00
K.Kanakhin 1cb0f8dc41 Add size limit for uploading user avatars and realm icons.
- Add settings parameter for max realm icon size.
- Add settings parameter for max user avatar size.
- Add checking file size to avatar and icon
  uploading views.
- Transfer file size limit parameter to frontend.
- Add tests.
2017-03-07 22:13:01 -08:00
K.Kanakhin 72424f3a9f realm-icon: Fix variable name for realm icon source. 2017-03-07 22:09:58 -08:00
Vasu Verma d4a004c420 Fix enter key not deleting selected text in compose box.
Fix #3889.
2017-03-07 22:04:04 -08:00
Joshua Pan b1e7ecdad2 user search: Hitting enter narrows to user PM.
Fixes #3874.
2017-03-07 21:05:56 -08:00
Archana BS a6b5b03122 stats: Change time ranges for bar graph and pie chart.
- Change templates/analytics/stats.html to use 'Last
  Week', 'Last Month', 'Last Year' time ranges instead
  of 'Last 10 days', 'Last 30 days'.
- Change static/styles/stats.css to not set background
  color for default time option, for messages sent by
  client and message by recipient type.
- Change static/js/stats/stats.js to show only available
  time range options, and set background color for the
  default. The default is Last Month if it exists, and
  otherwise All Time.

Fixes: #3856
2017-03-07 17:25:58 -08:00
Raghav Jajodia d52e08a25c analytics: Add a "Last updated" to the bottom of the stats page.
Fixes #3857.
2017-03-07 16:02:27 -08:00
Tim Abbott ec16a3298d reactions: Expand click area for opening popover. 2017-03-06 22:26:12 -08:00
Brock Whittaker ec9bad4096 Hide the emoji icon in message when emoji is selected.
This hides the emoji icon from the shown state when users select an
emoji from the popover.
2017-03-06 22:24:21 -08:00
Brock Whittaker 4d5aa3ddc9 Restyle and refactor .message_controls for better UX.
This refactors the .message_controls to stop relying on absolute
positioning and strange CSS, and throws them inline.

This also restyles so they hang to the right of the time which is now
always present.

Fixes: #3761.
2017-03-06 22:24:21 -08:00
Steve Howell a17deb144a Use data-stream-id in topics popover. 2017-03-05 15:44:44 -08:00
Steve Howell 8e2e406404 refactor: Extract stream_popover.js.
This module handles the popovers in the stream list--one for
stream actions and another for topic-specific actions.

The extraction was mostly straightforward, but I did move some
of the code related to the color picker to be more consistent
with how I organized the other click handlers.
2017-03-05 15:44:43 -08:00
Steve Howell ba49962f9a refactor: Extract stream_popover_sub().
Part of this change moved a click handler from subs.js to
popover.js.
2017-03-05 15:44:43 -08:00
Steve Howell 6630b84dc0 Remove data-stream-name from subscription_settings. 2017-03-05 15:44:43 -08:00
Steve Howell 58b018858e refactor: Pass in sub to ajaxUnsubscribe(). 2017-03-05 15:44:43 -08:00
Steve Howell 761a0beb7e refactor: Rename variable in show_settings_for(). 2017-03-05 15:44:43 -08:00
Steve Howell e703b0bfdb refactor: Remove stream_name param in update_stream_color(). 2017-03-05 15:44:43 -08:00
Steve Howell f8819256b0 Use stream_id in update_subscription_properties(). 2017-03-05 15:44:43 -08:00
Steve Howell 95cdc744d9 refactor: Simplify code for renaming streams. 2017-03-05 11:55:09 -08:00
Steve Howell c5757ac8fe refactor: Change params for subs.mark_subscribed().
We pass in sub instead of stream_name, to support callers that
already do lookups by stream id.

And then we make the second optional argument be subscribers, since
that is all we were using from the old `attrs` argument.
2017-03-05 11:55:09 -08:00
Steve Howell 2f8ecad295 Remove unused get_stream_name(). 2017-03-05 11:55:09 -08:00
Steve Howell 4f1108cc27 refactor: Pass in a sub to remove_user_from_stream(). 2017-03-05 11:55:09 -08:00
Steve Howell 190b2ab1d3 refactor: Pass in a sub to invite_users_to_stream(). 2017-03-05 11:55:09 -08:00
Steve Howell 8a4dee4a80 bug fix: Handle bad streams for compose-invite feature.
We now handle missing subs more gracefully when you click on the
link to invite somebody you at-mentioned in a stream message.
2017-03-05 11:55:09 -08:00
Steve Howell 6183a0d8b2 bug fix: Handle invalid streams in would_receive_message(). 2017-03-05 11:55:09 -08:00
Steve Howell 4b98ec0a12 bug fix: Handle errors in at-mention typeaheads.
If a stream doesn't exist, prevent executing code that leads
to needless warnings.
2017-03-05 11:55:09 -08:00
Steve Howell 434f228135 refactor: Avoid nesting in the compose invite handler.
We exit early now if email is undefined, rather than
having a big if statement.
2017-03-05 11:55:09 -08:00
Steve Howell 24631a7405 refactor: Pass in a sub to subs.toggle_pin_to_top_stream(). 2017-03-05 11:55:09 -08:00
Steve Howell 32c2dc63f1 refactor: Pass in a sub to subs.toggle_home(). 2017-03-05 11:55:09 -08:00
Steve Howell 3a93a7310e refactor: Pass in a sub to set_stream_property().
This helps us localize the legacy need to pass stream names
(vs. ids) to the back end to set stream properties.
2017-03-05 11:55:09 -08:00
Steve Howell 1904871d77 refactor: Start to deprecate get_stream_name().
When possible, we should use get_sub_from_target() instead of
get_stream_name(), not only because it often saves a lookup later,
but it also makes it easier to audit the code for name vs. id
bugs.  (When you rename a stream, there can be races where you
use the old stream name instead of the more durable stream_id).

This commit handles the easy cases where the caller directly
wanted the sub, not the name.
2017-03-05 11:55:09 -08:00
Steve Howell df6d644788 refactor: Extract get_sub_for_target(). 2017-03-05 11:55:09 -08:00
Steve Howell a4376efd0f refactor: De-dup code using subs.sub_or_unsub(). 2017-03-05 11:55:09 -08:00
Steve Howell 67e558f905 refactor: Pass in a full sub to sub_or_unsub(). 2017-03-05 11:55:09 -08:00
Steve Howell c38bbea6b9 Add tests for subs.sub_or_unsub(). 2017-03-05 11:55:09 -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
Philip Skomorokhov 866a7b06b2 upload: Limit total size of files uploaded by a user to 1GB.
Fixes #3884.
2017-03-04 18:08:30 -08:00
Raghav Jajodia cd2d798498 admin: Added realm option to prevent users from changing their email.
A realm option to prevent users from changing their email address is added.
Fixes #3777.
2017-03-04 17:32:48 -08:00
Steve Howell b611ecfa1e Make get_user_id blueslip errors clear again.
We had a theory that get_user_id() errors were often due to race
conditions related to reloads, so we would only report missing
user ids if subsequent lookups failed 5 seconds later.  It turns
out we still get the blueslip errors, and now we don't get
meaningful tracebacks.  This change makes it so that errors
get reported immediately again.
2017-03-04 07:50:47 -08:00
Steve Howell b8caf45262 Improve error checking for peer_add/peer_remove events.
If we get invalid events related to stream subscribers, we now
exit earlier to prevent ugly tracebacks.  We may eventually
want to upgrade some of these warnings to errors, once we fix some
of our live-update bugs.  In particular, we don't yet live-update
users when streams go from private to public, so if you add/remove
subscribers to a newly-public stream that a user still thinks is
private, they will not be able to handle the event through no
fault of the codepath that happens during the add/remove.
2017-03-03 16:03:50 -08:00
Sourav Badami 4616ee7762 Enable display of emoji as their alt codes in reactions.
This currently only supports this in emoji reactions, not in actual
emoji in message bodies, but it's a great start for people who want a
text-only view.

Tweaked to update the text by tabbott.

Fixes #3169.
2017-03-03 15:19:34 -08:00
Steve Howell 024168d85d bug fix: Fix hotkeys for compose preview.
We have special code for closing a "compose preview", but
it should only apply to the enter key.  Before this fix, we
would do the "enter" logic for other hotkeys like "j".
2017-03-03 12:22:57 -08:00
Steve Howell a6e1ab4fec hotkeys: Limit calls to ui.home_tab_obscured().
If you are typing a key like "q" in the compose box, there is no
need to check if the home tab is obscured, because the effect of
"q" is not limited by the message pane being opened.
2017-03-03 12:22:57 -08:00
Steve Howell bd6107cc1d hotkeys: Alphabetize switch/case code blocks. 2017-03-03 12:22:57 -08:00