Commit Graph

2471 Commits

Author SHA1 Message Date
Tim Abbott dfddea77b7 subscriptions: Show stream settings after toggling checkbox.
Based on Aakash Tiyagi's work in #4026.

Fixes #3971.
2017-03-21 23:09:32 -07:00
Tim Abbott 9347fc4742 subs: Move show_stream_row earlier in file. 2017-03-21 23:09:29 -07:00
Tim Abbott a7610c8b7e subs: Clarify show_stream_row arguments. 2017-03-21 23:07:28 -07:00
Tim Abbott e70bf13bef subs: Extract setup_subscriptions_stream_hash. 2017-03-21 22:17:50 -07:00
James Wang c13809c83f invite: Display and check default streams in invite modal.
This fixes two bugs:

* If a user is not subscribed to a default stream, he or she would not
  be have the option to invite users to that default stream.
* The initial streams checked in the invite modal were the
  non-invite-only streams the user was subscribed to, not their
  default streams.

Fixes: #4209.
2017-03-21 20:56:34 -07:00
digi0ps a765b6e781 settings: Fix user edit form not being shown.
Added an if condition to checks whether person is a bot before fetching
information about bot owner in *static/js/admin.js*.
2017-03-21 20:52:11 -07:00
Cynthia Lin 1dfac12c4b hotkeys: Add arrow key navigation in streams/subscriptions menu.
Fixes #4198.
2017-03-21 20:32:28 -07:00
Steve Howell bd04ea02d3 Use new JS data layer for typing notifications.
The old code may have had some subtle bugs related to sorting of
ids or stringification or failed Dict lookups.  The new data
layer should be more robust.  We had some tracebacks recently
from the old code, and they should go away now.
2017-03-21 17:24:40 -07:00
Steve Howell 67a2094ed1 Add typing_data.js, which can track users who are typing.
(A subsequent commit will actually integrate this into the app.)
2017-03-21 17:24:40 -07:00
Tim Abbott 8b9e78e486 compose: Extract and test get_focus_area. 2017-03-21 17:24:40 -07:00
Tim Abbott 82ec083066 compose: Fix new topic button behavior in home view. 2017-03-21 17:24:40 -07:00
Yago González 34a9e1ae11 markdown: Add TeX typesetting support.
Co-authored-by: Reid Barton <rwbarton@gmail.com>

Fixes #2056.
2017-03-21 16:40:00 -07:00
Ayush Jain bddcfb1c96 Add realm-level settings to control inline image and url preview.
This gives users more control in case they don't want previews,
especially for the "previews of linked websites" feature.

Fixes: #2640.
2017-03-21 15:46:17 -07:00
Brock Whittaker a27f8f2f30 Fix up YouTube embed issues and styling.
This fixes the styling to stay on the screen of most reasonably sized
monitors along with extending the JavaScript code to allow for the
video to be keyed to in the lightbox.
2017-03-21 14:28:13 -07:00
Brock Whittaker 1b31f9be38 Move lightbox events to lightbox.js from clickhandlers.js.
This consolidates lightbox logic to lightbox.js.
2017-03-21 14:28:13 -07:00
Brock Whittaker 5e0a906f84 Fixes for /integrations/ page.
This fixes the hubot text that still stays when you transition to
integration details along with fixing the first animation that is
choppy and previews briefly before fading in.

Fixes #4210.
2017-03-21 13:55:59 -07:00
Steve Howell c87c67c33f js deps: Fix ui.report_success(). 2017-03-21 07:39:30 -07:00
K.Kanakhin 831a467fa3 upload-widget: Correct file input clearing.
Replacing file input doesn't work for value clearing. The best
way is to clean value directly, which excludes accidentally adding
wrong file after upload-widget validation error.
2017-03-21 00:59:17 -07:00
Tim Abbott ee2e6a31b1 reactions: Close popover on escape even with input focused.
This makes it much more convenient to close the emoji reactions
popover after opening it with the hotkeys.

It'd be great if we had a test suite for escape so that we could add
tests for this.

Fixes part of #4197.
2017-03-20 23:51:45 -07:00
Tim Abbott cebaf140c6 subs: Fix stream descriptions rendering on creation.
This is kinda hacky and probably not how we want this to work
long-term, but I think it's a larger refactoring project to make this
part of the model make sense.
2017-03-20 23:25:43 -07:00
Tim Abbott a903d28d78 subs: fix missing ; introduced by rebase error. 2017-03-20 23:19:14 -07:00
Brock Whittaker d89ea13358 portico: Redesign apps page. 2017-03-20 23:08:24 -07:00
Brock Whittaker 4b64ff3752 Change from checking landing page by href to pathname.
Checking by href is a flawed approach due to the fact that hashes
are included in the href and will throw off the results of
returning the last block in a path. The window.location.pathname
property is a much better indicator of the current path.
2017-03-20 23:08:24 -07:00
Raghav Jajodia 2d4ba0fde5 stream_data: Linkify URL in stream description.
If a url is present in stream description, it will be
rendered as a clickable link under /streams page.

Tweaked by tabbott to use the separate rendered_description element to
avoid duplicate rendering and to live-update.

Fixes #1435.
2017-03-20 22:25:03 -07:00
Yago González 156b204015 echo: Remove impossible 'quote' 4-space-indented code block type.
Since it's not possible to manually set the language in 4-space-indented
code blocks, there's no point in checking if these blocks' type is
"quote".
2017-03-20 21:49:22 -07:00
Brock Whittaker 6115ef3427 Disable web sockets for mobile devices.
iOS doesn’t seem to play nice with the web socket library we are using
them, so disable use of websockets for sending messages until we can
fix that.

Fixes #2306.
2017-03-20 21:44:23 -07:00
Steve Howell 7bc2df6a91 Put popular emojis in top row of reactions. 2017-03-20 20:23:32 -07:00
Steve Howell 2296bf5859 Clean up rendering code for reaction popovers.
Instead of passing in a hash to template whose keys are a
mixture of records and strings, we now pass in an
array of records.  This also removes a spurious if condition
in the template that was a result of the janky data structure.
2017-03-20 20:23:32 -07:00
tejaskasetty 02bd5bedce Fix duplicate emoji entries in compose emoji picker.
We were incorrectly appending all the emoji into the emoji picker
every time it was opened, rather than just once.

Note by tabbott: Arguably this isn't the right fix, in that it might
be better to just render the emoji picker once at the beginning.  But
this definitely fixes the bug.

Fixes #3952.
2017-03-20 10:46:20 -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
Tim Abbott b701062d16 Update + hotkey to use the keypress mechanism.
This fixes in issue where the new + hotkey only worked if you hit
shift+=, not if you pressed an actual "+" key on the keyboard.

Fixes #4182.
2017-03-20 09:46:26 -07:00
Brock Whittaker 2775707a67 hotkeys: Add lightbox image feed with controls.
This adds an image feed that you can scroll through with hotkeys
in the lightbox.

The left and right arrow keys along with the left and right arrows
will go to the prev/next image, and clicking on an image will also
take a user to that image.
2017-03-19 22:11:38 -07:00
Brock Whittaker fa5a093738 hotkeys: Add keyboard shortcut for opening the gear menu.
This adds the shortcut “g” for opening the gear menu.
2017-03-19 22:08:21 -07:00
Brock Whittaker 2c28e519d8 Fix un-tab-able links in gear menu.
This fixes some un-tab-able links in the gear menu to have a tabindex
so that they can be tabbed over with shortcuts.
2017-03-19 22:06:27 -07:00
Steve Howell fd856d728c Extract message_util.js 2017-03-19 21:03:45 -07:00
Steve Howell 8d3d70984d Extract message_events.js. 2017-03-19 21:03:45 -07:00
Steve Howell 1114c8bf62 Extract message_fetch.js. 2017-03-19 21:03:45 -07:00
wangjames e0813c7288 collapse: Fix new messages not being collapsed consistently.
This fixes a bug where newly received very-long messages would only
sometimes be collapsed properly until a second message arrived
(whether it did the right thing dependened on whether the new message
had the same recipient or a different recipient from other arriving
messages).

Apparently, we correctly called condense.condense_and_collapse in all
but one of the codepaths of `render` that add new messages.  This
adds a call on the missing codepath.

Fixes #3978.
2017-03-19 20:39:21 -07:00
Joshua Pan 5ec21e2230 hotkey.js: Add opening reactions hotkey.
Add frontend tests for ":" hotkey.

Fixes #3911.
2017-03-19 14:37:05 -07:00
Joshua Pan b600e4d594 Pressing enter in reactions search picks first reaction. 2017-03-19 14:36:34 -07:00
Joshua Pan 9c3d63a80b Add '+' hotkey to add thumbs up reaction.
Fixes #3910.
2017-03-19 14:36:33 -07:00
Joshua Pan c8f2da3f3e reactions.js: Refactor reaction_popover_reaction_on_click. 2017-03-19 14:25:10 -07:00
wangjames 12eeb27442 js dependencies: Extract ui_state.js.
The function home_tab_obscured used to be in the ui_state
namespace via a shim, but now we have an actual module for
it.
2017-03-19 14:11:50 -07:00
Sarah Stringer aa880b0419 Add organization description field to realm settings.
This adds an organization description field to the Realm model, as well as
an input field to the organization settings template. Added three tests.
Set the max length of the field to 100 characters.

Fixes #3962.
2017-03-19 14:05:01 -07:00
Daw-Ran Liou 81f9de7cc8 Add "*" hotkey to toggle starred flag on the selected message. 2017-03-19 13:42:11 -07:00
Joshua Pan c053f786f7 Add ctrl+[ hotkey.
Fixes #4016.
2017-03-19 12:17:28 -07:00
Joshua Pan fcbc2e0cb9 Add ctrl key functionality to hotkeys. 2017-03-19 12:17:28 -07:00
Daw-Ran Liou f67751d1f0 Add hotkey "l" for opening image in lightbox.
Open the lightbox in the current selected message. Only the first image
shows in the lightbox.
2017-03-19 11:43:21 -07:00
Tim Abbott e9f1531fc7 hotkey: Remap v hotkey -> P. 2017-03-19 11:41:02 -07:00
Steve Howell eda046409c Move paging methods into navigate.js. 2017-03-19 11:05:46 -07:00
Steve Howell d026344b37 Extract js/ui_util.js. 2017-03-19 11:05:45 -07:00
Steve Howell 099f401b9b Move mark_subscribed/mark_unsubscribed to stream_events.js. 2017-03-19 11:05:45 -07:00
Steve Howell b98cd55ddb Add ui_report shim. 2017-03-19 11:05:44 -07:00
Steve Howell c67aebf633 Move keep_pointer_in_view() to message_viewport.js. 2017-03-19 10:56:09 -07:00
Steve Howell 1d7d6869c9 Extract stream_events.js 2017-03-19 10:56:09 -07:00
Steve Howell cfd1e8cbc3 Extract stream_muting.js. 2017-03-19 10:56:09 -07:00
Steve Howell 5b2407bb22 Add ui_state.home_tab_obscured() shim. 2017-03-19 10:56:09 -07:00
Steve Howell ab34b5ee9f Extract ui_init.js. 2017-03-19 10:56:09 -07:00
Steve Howell 203ced0ee6 minor: Rename var in filter_emojis(). 2017-03-19 06:25:10 -07:00
Rishi Gupta 19d8d16126 js dependencies: Split hash_util.js from hashchange.js. 2017-03-18 20:40:34 -07:00
Jonathan Pan ceffe2128d activity: Clear search box after clicking a user in right sidebar.
Fixes #4105.
2017-03-18 16:15:14 -07:00
Steve Howell 16a37754cf Add recipient() and composing() shims. 2017-03-18 15:52:50 -07:00
Steve Howell 27f37e6378 Add hash_util.encodeHashComponent() shim. 2017-03-18 15:52:50 -07:00
Steve Howell d75efa19db Add compose_state.has_message_content() shim. 2017-03-18 15:52:50 -07:00
Steve Howell 59fd9e4d48 Add compose_actions.cancel() shim. 2017-03-18 15:52:50 -07:00
Steve Howell faa9446e64 Add compose_actions.start() shim. 2017-03-18 15:52:50 -07:00
Steve Howell 35d38d62f3 Add shim.js w/narrow_state global. 2017-03-18 15:52:50 -07:00
Luke W Faraone 68e7a8a824 Show stream properties on subscription in Zephyr.
On realms with ``should_list_all_streams() == False``, previously, we
would subscribe a user to a stream, but also incorrectly show the stream
creation dialog.

Instead, we act as if the stream was newly created.
2017-03-18 15:51:27 -07:00
Tim Abbott f67e9a7e5e CSS: Rename #overlay to #lightbox_overlay. 2017-03-18 13:54:11 -07:00
Tim Abbott ed90879602 js: Extract lightbox.js from ui.js. 2017-03-18 13:54:11 -07:00
Steve Howell a51caceea5 refactor: Extract unread_ops.js
This module mostly contains the mark_* functions that
update the server with info about unread counts.
2017-03-18 10:35:52 -07:00
Steve Howell 0c6fefba71 Move get_cleaned_pm_recipients() to helper module.
This break's typeahead_helper's dependency on
composebox_typeahead.
2017-03-18 10:35:52 -07:00
Steve Howell 7f43c0504b refactor: Rename fields for split_by_subscribers().
The old name 'subs' was confusing our tooling, since we have
a module called subs.js.
2017-03-18 10:35:52 -07:00
Steve Howell 7b1bfd6703 Break typeahead_helper's dependency on compose.js.
We now have typeahead_helper's callers pass in compose.stream()
when it's needed for sorting purposes.
2017-03-18 10:35:52 -07:00
Steve Howell 166f149ef9 refactor: Add current_stream parameter to functions.
This change makes our dependency on compose.stream_name() happen
in sort_recipients, so we compute it only once, and we can
more easily break the circular dependency.
2017-03-18 10:35:52 -07:00
Raghav Jajodia 668d9cc6ca server_events: update admin bots on deactivate under settings tab.
Deactivating a bot in the /#settings/your-bots page update
the /#administration version to show a reactivate button.
2017-03-17 21:11:42 -07:00
Raghav Jajodia 89a83f6a5d admin.js: Refactor code to change view on bot deactivate/reactivate.
This also fixes the error associated with view on toggle deactivation.
Now, on deactivating a bot, the bot-name and bot-email should strike-out.
And on reactivating a bot, the bot-name and bot-email should remove strike-out.
Toggle edit button on bot activation/deactivation.
Fixes #3413.
2017-03-17 21:11:42 -07:00
Arpith Siromoney e073220e21 Add typing notifications front end.
Send typing notification events when user types in the compose box.
Listen for these events and display a notification.

Sending notifications: Notifications are throttled, so that start
notifications are sent every 10 seconds of active typing, and stop
notifications are sent 5 seconds after active typing stops or when the
compose box is closed.

Displaying notifications:
When a typing notification is received, if the current narrow is private
messages or is: pm-with and the user is not the sender,
"Othello is typing..." is displayed underneath the last message. This notification is
removed after 15 seconds. If another notification is received during this period, the
expiration is extended. When a stop notification is received the notification is removed.

Internally, a list of users currently typing is maintained for each
conversation (in a dict). When an event is received the list (for the appropriate
conversation) is updated and the notifications template is re-rendered
based on the narrow information. This template is also re-rendered when
the narrow changes.

Significantly modified by tabbott for clarity.

Fixes #150.
2017-03-17 20:45:07 -07:00
Tim Abbott 8efe4d530d js: check_stream_existence to subs.js.
We want to remove this, but in the meantime, this is a more coherent
place for htis to live than compose.js.
2017-03-17 15:16:11 -07:00
Tim Abbott af5852a55b subs: Eliminate confusing use of settings local.
The name was never good, and was suggestive of the settings module.
2017-03-17 15:07:49 -07:00
Tim Abbott 871adc01e3 signup: Fix broken password strength checking.
We don't support using the i18n libraries in our portico.

This was broken in 7a6d001592.
2017-03-17 14:11:44 -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
Brock Whittaker d17a3531b3 Fix ui.home_tab_obscured call to not block scroll events.
This fixes the a call being made in ui.js that prevents all scroll
events from occurring while a modal is displayed.

This used to be necessary back in 2012 as modals didn't require
scrolling and would affect background scrolling, however it isn't
required anymore.
2017-03-16 14:23:34 -07:00
Steve Howell eece725073 compose fade: Limit user-fade to .user-sidebar-entry.
Our JS/CSS now only uses the user-fade class for elements
that have the user-sidebar-entry class.  This should prevent
bugs related to having doubly opaque elements.
2017-03-16 14:06:40 -07:00
Steve Howell 19729b83f4 compose fade: Introduce message-fade/user-fade CSS classes.
We now have specific HTML/CSS classes for message fading and
user fading.  They currently both have the same effect, changing
opacity, but we can now more easily treat them differently.

This change also removes "faded" attributes in compose-fade,
which avoids some confusion related to landing pages having
a "faded" class as well.
2017-03-16 14:06:40 -07:00
Steve Howell cfba72e59c compose fade: Remove obsolete "unfaded" class.
We don't have any CSS for "unfaded," so setting the class in JS
just slows down the app.
2017-03-16 14:06:40 -07:00
Steve Howell 11e52f5e91 compose fade: Simplify selector for unfading.
We don't set "faded" for ".message_row", so there is no need
to remove the HTML class.
2017-03-16 14:06:40 -07:00
Philip Skomorokhov 8c52a94692 edit: Remove More/Collapse when in message edit/view source mode.
This entails displaying it when the editing mode ends.

Fixes #3871.
2017-03-16 11:30:49 -07:00
Brock Whittaker 966e161fb2 Fix ui.home_tab_obscured to detect modals open.
All open modals now should have the selector ".overlay.show",
so checking if a modal is open is as simple as checking the length
of the selection ".overlay.show".

Fixes #3655.
2017-03-15 15:45:10 -07:00
Tim Abbott 04195e0be6 modals: Add blueslip error reporting for invalid modal.
This should help if we screw up adding an additional modal in the future.
2017-03-15 12:35:23 -07:00
Brock Whittaker 3bc2ed6dc9 Switch "invite users" to new component overlay.
Fixes #4036.
2017-03-15 12:29:09 -07:00
Brock Whittaker b0e5aeb313 Consolidate JavaScript modal closing in modals.js.
This consolidates all actions to close modals into modals.js and
triggers the correct cleaning/collapsing function dependent on what the
data-overlay attribute is labeled as.

It also ensures these all have an e.stopPropagation().

Fixes #4029.
2017-03-15 12:27:44 -07:00
Brock Whittaker 8ef20a0ed2 Remove meta.focusing boolean.
This was supposed to prevent unwanted modal closes but due to the new
mechanics of modals, it’s better to not prevent the first click.
2017-03-15 12:17:27 -07:00
Brock Whittaker 2e30cef8e9 Change "hashchange.exit_settings" to "hashchange.exit_modal".
Change the name of the hashignore and replace mechanism from
exit_settings to exit_modals since it is now used for more than just
the settings.
2017-03-15 12:17:27 -07:00
aakash-cr7 f44caaf36e Focus on the close button when viewing the edit message history.
Fixes #4035.
2017-03-15 11:43:50 -07:00
Brock Whittaker c155577246 Allow users to resize the message compose box.
This allows for users to resize the message compose box without it
collapsing back down to jQuery autosize’s preferred height.

When you hide the compose box and then re-show it, it keeps the
previous height but reactivates the jQuery module.

Fixes: #2236.
2017-03-14 17:40:21 -07:00
Steve Howell b648c06009 hotkeys/refactor: Extract tab key handlers.
This extracts process_tab_key() and process_shift_tab_key().
It also removes some dead code related to alert words tabbing.
2017-03-14 16:42:40 -07:00
Steve Howell bdbaa5d386 hotkeys: Simplify navigation checks for page up/down.
We remove an unnecessary conditional that always returned true
due to checks that happen earlier in the function.
2017-03-14 16:42:40 -07:00
Steve Howell 2a3e74427b Export hotkey.tab_up_down() for testing. 2017-03-14 16:42:40 -07:00
Abhishek Bhattacharya 8a408a6cbc popovers: Fix actions popover menu positioning.
The main issue is that it wasn't doing the correct comparison; the old
logic that subtracted the viewport.scrollTop() was incorrect for how
our popovers seem to work.

Partially fixes #3741.
2017-03-14 15:37:37 -07:00
Philip Skomorokhov e3fa42f833 edit: Hide emoji reactions when in message edit or view source mode.
This also entails displaying them when the editing mode ends.

Fixes #3870.
2017-03-14 14:55:16 -07:00
Raghav Jajodia b0e2c4ffee settings: refactor code to hide "Email Change" button.
Previously, the code to hide "Change email" button on page load when
email changes are disabled was present in settings.js using jquery to
hide the button. Now, the show/hide is handled in the account-settings handlebars.
2017-03-14 14:43:35 -07:00
Raghav Jajodia ef7e15ee00 admin: Add realm option to prevent users from changing their name.
A realm option to prevent users from changing their name is added.
Fixes #3950.
2017-03-14 14:10:08 -07:00
Steve Howell a1b5f91c1a hotkeys: Remove wasteful resize calls for keydown events.
This fix prevents us from calling the resize library for nearly
every single keydown event in the app (ouch!).  Realistically,
this performance improvement only impacts folks who turned on
the autoscroll_forever feature, but it should be a significant
speed-up for them.  We should go further with this fix, but the
main damage is undone.
2017-03-13 21:38:23 -07:00
Steve Howell c88c69db2e bug fixes: Clean up hotkey mappings.
We simplify hotkey mappings by using different hashes for
keydown and keypress events.  There are browser bugs (iOS, for
example) where keypress events have the wrong keyCode values.
This led us, under iOS, to interpret "!" as "page up."

This fix also helps us disinguish escape from shift-escape.

Brock Whittaker helped on figuring out the keypress/keydown
issues that are addressed in this commit.

Fixes #4019
2017-03-13 21:38:23 -07:00
Steve Howell b99c190380 Extract hotkeys.process_enter_key(). 2017-03-13 15:09:53 -07:00
Steve Howell cfcad48e46 bug fix: Blur message edit textboxes when hitting escape.
We have a somewhat janky mechanism for rendering message edits,
and before this fix, we were not unblurring the text boxes when
we closed the message editing session with the escape key, which
made it so that the escape key was unusable.
2017-03-13 15:09:53 -07:00
Steve Howell f9d26856e8 hotkeys: Remove typeahead logic for escape keys.
We had some ancient logic for typeaheads that was supposed to be
Firefox-specific, but I can't reproduce the code even running under
Firefox, and even if it did, it was returning true instead of false
for a long time, so I suspect the code has been wrong/irrelevant for
a long time.
2017-03-13 15:09:53 -07:00
Steve Howell 55ade83ac2 Extract hotkey.process_escape_key(). 2017-03-13 15:09:53 -07:00
Steve Howell 87a7313143 refactor: Extract compose.reply_with_mention(). 2017-03-13 15:09:53 -07:00
Steve Howell 0979aad226 refactor: Export hotkey.processing_text() for tests. 2017-03-13 15:09:53 -07:00
Steve Howell 1df2dfc6e0 hotkeys refactor: Flip conditional related to popovers.
When checking for hotkeys related to popovers, we avoid making
the external call for keys that won't be important for popovers.
This mostly helps testing.
2017-03-13 15:09:53 -07:00
Steve Howell b1ef7b2e53 Extract hotkey.is_editing_stream_name(). 2017-03-13 15:09:53 -07:00
Steve Howell 1d6e3124c1 Export hotkey.is_settings_page() for testing. 2017-03-13 15:09:53 -07:00
Steve Howell db3883fc51 hotkeys: Refactor backspace/shift-tab sections.
Only check to see if the compose send button is in focus if
we dealing with backspace/shift_tab.  As the comment notes here,
these sections of code are somewhat dubious.
2017-03-13 15:09:53 -07:00
Steve Howell 20f26c40e1 Export process_hotkey() for testing. 2017-03-13 15:09:53 -07:00
Rishi Gupta 9df26a296f composebox_typeahead.js: Remove unnecessary special case for zulip.com.
This was originally introduced in
025b79d98b, which is far back in ancient
history when compose had a different shape (predates enter-sends,
too), and regardless, this code never affected anything but zulip.com.
2017-03-13 14:36:34 -07:00
Tim Abbott 5e39ccd642 js: Rename viewport.js to message_viewport.js.
This fixes the mobile web experience for Chrome on iOS.

Apparently, Chrome-on-iOS silently has a `viewport` module that
overrides and user-defined module by that name, causing all of our
code that accesses the viewport module to not work on that platform.
We fix this by renaming it.
2017-03-10 14:59:59 -08:00
Harshit Bansal c6681917c1 settings: Add UI to allow a user to reactivate his own bots.
Using this UI, a user can now reactivate the bots owned by him.
Until now if a bot was deactivated, there was no way to use the
old bot's original email address. But now they can be reactivated
and their email can be reused.

Fixes: #1183.
2017-03-10 10:59:49 -08:00
Harshit Bansal 0dbca4a3c3 settings: Display all the bots owned by an user.
Add UI to display all the bots owned by an user whether active
or inactive in "Your Bots" section.
2017-03-10 10:59:49 -08:00
Harshit Bansal 876d7bbcdc settings: Rename `bots_list` to `active_bots_list`. 2017-03-10 10:59:49 -08:00
Tim Abbott 900891b072 settings: Rename settings-status to account-settings-status. 2017-03-10 10:53:06 -08:00
Kanak Garg 5023b69ca5 stream settings: Add "View Stream" button.
This adds a button to #subsciption page called "View Stream"
that narrows the user to that particular stream.

This fix involves typical changes to JS/CSS to add new features,
and we also add a "preview_url" field to the sub object in
stream_data.js.

Fixes #3878
2017-03-10 08:26:57 -08:00
Raghav Jajodia c17e574211 Remove product_name setting and return to harcoding 'Zulip'.
This removes some confusion in grep for frontend strings with Zulip in
them and also cleans up the code in some places.

Fixes #1602.
2017-03-09 21:48:15 -08:00
Amy Liu e5ab3123af Migrate json/set_muted_topics to muting/topics. 2017-03-09 20:52:29 -08:00
Tim Abbott ce826e82c5 reactions: Fix click handler for reactions button.
This was broken when we fixed the click target for the other reactions
button place.
2017-03-09 12:18:17 -08:00
Raghav Jajodia 217b8f2a85 hotkeys: escape key press dismiss "invite-users" modal.
Pressing escape key dismiss the invite-user modal.

Fixes #4008.
2017-03-09 12:10:27 -08:00
Rafid Aslam 1143a2d8c4 attachment: Add file icon to the green box when file has no extension.
Fixes #3848.
2017-03-09 00:56:37 -08:00
Umair Khan 2894924ffb capitalization: Fix Only Admins may now create new streams. 2017-03-08 23:40:15 -08:00
Umair Khan c0e92015fd capitalization: Fix Only Admins may now add new emoji. 2017-03-08 23:38:36 -08:00
Tim Abbott 70aa443c25 stream_popover: Fix references to topic_ops.
This apparently got lost in the refactoring that extracted
stream_popover.js.
2017-03-08 23:30:44 -08:00
Tim Abbott 5613358638 stream_popover: Fix hiding topic popover. 2017-03-08 23:25:30 -08:00
Brock Whittaker c5ba4e11d4 Redesign "/integrations/" page in portico.
This redesigns the integrations page to incorporate the new landing nav,
CSS animations, and general styling of the product page set.
2017-03-08 17:42:17 -08:00
Brock Whittaker 1d2c3cec10 Fix: change mobile sidebar click target to call new popover function.
This changes the click target that opens the mobile sidebar to call the
new popover function in stream_popover rather than the old popovers
object.
2017-03-08 17:04:10 -08:00
Tim Abbott 3b59e6c3cc subs: Rename /#subscriptions to /#streams.
Fixes #3653.
2017-03-08 16:57:58 -08:00
Tim Abbott 4a1f1db9ee users: Avoid inserting into the DOM in a loop.
This fixes a major performance issue loading the administration page
in large organizations.
2017-03-08 16:21:25 -08:00
Tim Abbott a8d8855624 attachment: Avoid inserting into the DOM in a loop.
This has a huge impact on the performance of loading the settings page
if you have a decent number of past uploaded files.
2017-03-08 16:20:50 -08:00
Tim Abbott 9c02e59b66 hotkey: Fix K/J being treated as hotkeys in compose. 2017-03-08 16:02:33 -08:00
Tim Abbott e61b54b74a Fix spacebar being broken in the compose box.
This fixes a regression introduced in
8801158dfd.

Apparently the `page_up`/`page_down` hotkey definitions somewhat
confusingly called `spacebar` `page_down`, etc.  Probably worth doing
further cleanup on this.
2017-03-08 15:57:56 -08:00
Tim Abbott fc3927a124 subs: Improve meta.stream_created targeting.
This fixes a potential race where you get subscribed to a stream
around the same time that you create a stream.
2017-03-08 14:47:49 -08:00
Brock Whittaker 022aeca085 subs: Prepend new streams to top of stream list.
This prepends new streams that are created to the top of the list so
that they are more visible when being created.
2017-03-08 14:47:00 -08:00
Brock Whittaker 8801158dfd Add hotkey actions for page up/down in compose box.
The hotkey actions make the caret position go to the top of the compose
box or bottom respectively, while the compose box is open.

Fixes #1910.
2017-03-08 14:13:05 -08:00
Umair Khan d4228e8151 capitalization: Fix waiting period threshold changed. 2017-03-08 12:33:37 -08:00
Umair Khan 22c1c13f38 capitalization: Fix View Source / Edit Topic. 2017-03-08 12:33:37 -08:00
Umair Khan 935cacfc86 capitalization: Fix View Source. 2017-03-08 12:33:37 -08: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
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
Steve Howell 3c948be436 hotkeys: Extract focus_in_empty_compose().
This saves a bit of unnecessary computation when you type
non-arrow keys, which is especially important in the compose
box for characters that seem ordinary, like "j" and "q", but
which have mappings in some cases.
2017-03-03 12:22:57 -08:00
Steve Howell 64e0e65bac hotkeys: Limit calls to tab_up_down().
If you are not hitting an arrow key, we should prevent doing the
complex logic in tab_up_down().
2017-03-03 12:22:57 -08:00
Steve Howell a2653e3ff5 hotkeys: Process "ignored" hotkeys more efficiently. 2017-03-03 12:22:57 -08:00
Tim Abbott 9b11993fa7 settings: Fix need to reload when changing time format.
I noticed while reviewing #3807 that we still haven't fixed this;
because timestamps are primarily displayed in the message view, fixing
this is trivial.
2017-03-01 22:43:19 -08:00
Tim Abbott 342c436c68 Fix propagation of lightbox body clicks closing compose box.
Like most event handlers where one successfully did something
specific, this event handler should stop event propagation.

Fixes #3885.
2017-03-01 20:48:42 -08:00
Tim Abbott 31bf60d3d8 Fix accidentally overriding alt-left with edit-last-message hotkey.
Apparently, our logic was broken on systems where altKey and metaKey
are different, because we didn't ignore hotkey combinations that
included altKey.

Fixes #3738.
2017-03-01 11:18:40 -08:00
Tim Abbott 7fb406b889 lint: Expand lint check for use of .text() without i18n.
Fixes #3705.
2017-02-28 20:37:52 -08:00
Brock Whittaker b8f2685b18 Change bots actions to sidebar.
This changes the bot actions to a sidebar that resides in the settings
overlay.
2017-02-28 20:02:23 -08:00
Brock Whittaker e9e722d48b Restyle individual bots.
This restyles the individual bots to be in a grid and to look more
modern than the last setup.
2017-02-28 20:02:23 -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 b83d10345a Extract update_user_row_when_fading(). 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
Harshit Bansal a05795c85c bot_data.js: Add `get_all_bots_for_current_user()` function.
This function can be used to get all the bots whether active or
inactive that belong to current logged in user.
2017-02-28 16:15:10 -08:00
Rishi Gupta 15d60fa7ed Change now() to timezone.now() throughout codebase.
Change `from django.utils.timezone import now` to
`from django.utils import timezone`.

This is both because now() is ambiguous (could be datetime.datetime.now),
and more importantly to make it easier to write a lint rule against
datetime.datetime.now().
2017-02-28 16:03:37 -08:00
Tim Abbott e86ed89986 page_params: scope presence_disabled in realm. 2017-02-28 14:58:53 -08:00
Rishi Gupta 7a6d001592 signup: Make error message for a weak password more clear.
"Password is weak" sounds like an fyi rather than "we're going to stop you
from registering until you fix this".
2017-02-28 13:46:39 -08:00
Aman Khantaal f0a9b7e4a1 Drafts: Click on a message will open it for edit. 2017-02-28 10:10:12 -08:00
Raghav Jajodia 27f80e7741 hotkeys: 'Esc' key on topic field closes the message_edit form.
Pressing Escape key when on topic field closes the message_edit form
Fixes #3796.
2017-02-27 00:22:18 -08:00
Harshit Bansal bbcd927375 bot_data.js: Replace `remove()` with `deactivate()`.
On receiving a `remove` event of type `realm_bot`, instead
of deleting the bot from `bots` dict, set it's `is_active`
flag to false.
2017-02-26 23:56:51 -08:00
Harshit Bansal a900a2076a bot_data.js: Add `is_active` field to `bot_dict`. 2017-02-26 23:56:51 -08:00
Harshit Bansal 1948cb6a89 Add UI for changing the bot owners.
Add neccesary UI in #administration and #settings for
changing the bot owner. The bot owner select control
is rendered dynamically in order to avoid performance
issues in case of large number of users.

Fixes: #2719.
2017-02-26 21:39:22 -08:00
Brock Whittaker a66cd814af Huge performance update for subscriber list in streams.
Previously the mechanism worked such that the innerHTML was being
appended to directly potentially thousands of times which has horrific
performance implications. By concating all the strings together before
appending to the HTML it all gets rendered in one chunk without forcing
a re-render of previous elements. Performance is ~15x-20x faster now.
2017-02-26 21:11:23 -08:00
Harshit Bansal 40d137d621 bugdown: Change rendered emoji image to `unicode/<codepoint>.png.`
Use `name_to_codepoint.json` file (and the similar structure in
emoji_codes.js) to map emoji names directly to codepoints and change
the rendered emoji image to `unicode/<codepoint.png>` rather than
`<emoji_name>.png`.

Fixes: #3539.
2017-02-26 18:30:15 -08:00
Steve Howell eed41bfd0a Compare recipients using to_user_ids to fix live updates.
If you send a group PM from the home view, and then one of the
recipients changes their email, and then you send a group PM
to the same recipients, we need to make sure we don't create
a spurious recipient bar.  This fix makes this happen by
changing util.same_recipient() to look at user ids instead of
emails.
2017-02-26 16:18:02 -08:00
Steve Howell 9791e2f570 Populate focused_recipient.to_user_ids in compose_fade.js. 2017-02-26 16:18:02 -08:00
Steve Howell 4ae81d9063 Populate message.to_user_ids in message_store.js. 2017-02-26 16:18:02 -08:00
Steve Howell df2abf0529 Populate message.to_user_ids in compose.js. 2017-02-26 16:18:02 -08:00
Steve Howell 49496cee58 Remove message param from compose.snapshot_message(). 2017-02-26 16:18:02 -08:00
Steve Howell 1daa4e3279 Extract people.email_list_to_user_ids_string(). 2017-02-26 16:18:02 -08:00
Steve Howell 9c63e055e2 Simplify create_message_object() for PM fields.
We now only populate PM fields if the message type is
private, and we make only one call to compose.recipient().
2017-02-26 16:18:02 -08:00
Steve Howell 4d0d18ba14 Use stream_id in recipient comparisons.
Using stream_id in recipient comparisons fixes a
bug in this scenario: go to home view, send message
to stream, wait for admin to rename stream, send
another message to the stream.  Before this change,
the stream name would live-update but you'd get a
spurious recipient bar due to the prior message still
having the old stream name in places internally.

There were other ways to fix the live-update glitch,
but it's just generally cleaner to do stream id
comparisons.

Part of this change is to add stream_id to
compose_fade.set_focused_recipient().
2017-02-26 16:18:02 -08:00
Steve Howell c02cf5dd5c Extract compose_fade.should_fade_message(). 2017-02-26 16:18:02 -08:00
Steve Howell 96ca684d40 Remove feature_flags.fade_users_when_composing. 2017-02-26 16:18:02 -08:00
Steve Howell b3dfa79482 Remove obsolete util.same_major_recipient(). 2017-02-26 16:18:02 -08:00
Steve Howell 807afc87ba Remove feature_flags.fade_at_stream_granularity. 2017-02-26 16:18:02 -08:00
Steve Howell 49ab8035f8 Populate stream_id when composing messages. 2017-02-26 16:18:02 -08:00
Steve Howell 98a627cba8 Add message.type guard to add_subject_links(). 2017-02-26 16:18:02 -08:00
Tim Abbott 4ea997493b events: Normalize realm_icon events to be standard.
This lets us save on semi-duplicate code, both in server_events.js and
in zerver/lib/events.py, and makes our event structure a bit more
predictable.
2017-02-26 12:16:07 -08:00
K.Kanakhin 257bb40698 realm-icon: Add realm icon feature.
- Add realm icon fields to realm model.
- Add migration for new realm model's field.
- Add views for icon uploading and deleting.
- Add routes for realm icons views.
- Add JS widget for realm icon upload setting.
- Add realm icon upload to administration
  organization setting.
- Add tests for realm icons.

Fixes #3660.
2017-02-26 12:16:07 -08:00
K.Kanakhin 9ce218154e realm-icon: Move upload widget to separate file.
This makes it possible to use the upload widget in the realm icon
organization settings on frontend.
2017-02-26 12:15:41 -08:00
Tim Abbott bd03bb76fd subs: Remove unnecessary data-is-private variable. 2017-02-25 18:33:07 -08:00
Harshit Bansal f20993787c subscriptions: Add a modal for changing stream privacy.
Change the remaining "Admin settings" with a button, namely
changing a stream's privacy, to instead be a "[Change]" link
opening a confirmation modal.

Fixes: #3493.
2017-02-25 18:23:15 -08:00
Harshit Bansal 1d33c759e4 subs.js: Make `change_stream_privacy()` function global. 2017-02-25 18:23:15 -08:00
Brock Whittaker c35d821786 Restyle uploaded files table.
This restyles the uploaded files table to be lighter, more minimal, and
easier to parse than the previous table.
2017-02-24 15:05:06 -08:00
Brock Whittaker e504eaaa68 Change time render to be client-side and formatted.
This changes the time render to be done on the client-side and
therefore take advantage of knowing the client’s timezone, along with
being formatted in a more human-parseable way.
2017-02-24 15:05:06 -08:00
Brock Whittaker 434317b4cc Add "all" and "subscribed" deeplink for subscriptions.
This adds a deep link to “all” which is to show all streams,
along with "subscribed" for only streams you are subscribed to.
2017-02-23 15:34:30 -08:00
Brock Whittaker 461066cab9 Add deep linking to #subscriptions/new and #subscriptions/:stream_id.
This mechanism allows for a user to deep link to a particular
subscription or the form for creating a new subscription.
2017-02-23 15:34:30 -08:00
Brock Whittaker 0f9a5108fc settings: Change admin pages to have readonly view for non-admins.
This changes the layout of administration for non-administrators such
that they can view organization settings and emoji settings and
displays everything as readonly unless they have the capability to edit.

For now, we just enabled this for the emoji settings and organization
settings features.
2017-02-23 14:20:31 -08:00
Brock Whittaker 3bb22a6965 Remove all .expectOne statements in settings.
This removes all the .expectOne statements and replaces with a
single broad stroke .hide() that doesn't check if they exist,
but rather just ensures they are hidden by default until triggered.
2017-02-23 14:18:25 -08:00
Umair Khan 5bf83f9e0a change-email: Implement confirmation flow.
This adds to Zulip support for a user changing their own email
address.

It's backed by a huge amount of work by Steve Howell on making email
changes actually work from a UI perspective.

Fixes #734.
2017-02-23 03:15:17 -08:00
Sampriti Panda 1929cc5190 Implement persistent drafts functionality
* Created a drafts modal to display/restore/delete drafts
* Created a Draft model to support storing draft data in localstorage
* Removed existing restore-draft functionality
* Added casper and node tests for drafts functionality

Fixes #1717.
2017-02-23 02:58:23 -08:00
Brock Whittaker 8b22b94ab1 Add a LocalStorage wrapper for Zulip.
This is a wrapper that allows for versioning and migrations with
localStorage along with safe storage of data that respects data types.
2017-02-23 02:58:22 -08:00
Steve Howell 03386f1485 avatar live updates: Do full re-render.
We now sweep all active messages for avatar changes and update
the message items and re-render, rather than patching the
DOM.  This avoids some quirks that happen when subsequent messages
get sent and we re-render previous messages out of the message
store.

Our approach here is similar to how we do full-name updates.
2017-02-22 22:46:44 -08:00
Steve Howell 8de72184e1 Fix avatar message display regression from 1.5 release.
In f75af94984 I added some
lines of code that made it so that live updates for avatar
urls would affect messages currently in the browser.

This change worked well when the live update actually happened,
but then the next time the user would reload, the avatar in
the message pane would regress back to showing the avatar urls
from the server (which could have caching issues of their own).

This fix removes a couple lines of code that had the intended
effect of making all of your messages from any given sender
show the same url (good) but which generally grabbed
the url from an old message (bad).

After this fix, we go back to having old messages possibly
showing the old avatar urls, but new messages will display the
new avatar.

(There are lots of moving parts in the avatar system, because
not only do browsers cache image urls, but our server caches
messages and recipient info, so there have been "fixes" to
avatars since this change that are valid fixes in their own
right but not directly relevant to this commit.)
2017-02-22 07:57:03 -08:00
hackerkid 10324ba592 Change reaction button color when user reacts.
This makes it easy to see whether you were one of the people who
reacted to a give message.
2017-02-21 23:09:46 -08:00
Tim Abbott e608f09f73 compose: Remove unnecessary snapshot_message call.
The current logic that we have is as follows:

* If a message is locally echoed, the draft is stored via the locally
rendered message, and that system takes care of it.  So no need to
store it here.

* If the message isn't locally echoed, we don't close the compose box
until, so the content is safe here as well.  It'll be saved as a draft
if the compose box is later closed due to a failure sending.
2017-02-21 19:24:38 -08:00
Brock Whittaker 021e43356f Replace settings v1 toggle with v2 component toggle.
This replaces the settings toggle which had the same markup as the
current component toggle, but not the same JavaScript, along with
having an issue with inline-block spacing, with the new JS generated
one.
2017-02-21 11:31:00 -08:00
Brock Whittaker e4008bcf1c Select first toggle tab by default.
The first one is selected by default, so add the class to make it look
visually selected.
2017-02-21 11:30:59 -08:00
Philip Skomorokhov 7a75ed9c4a message_edit: Fix timer text not decrementing.
This fixes a regression introduced in e6369fc, where we simply lost the `--` part.

Fixes #3720.
2017-02-20 21:41:07 -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
chao1995 b3119b0d67 left-sidebar: Sort pinned streams by lowercase stream name.
The pinned streams were sorted in alphabetic order (i.e. Verona appears
before devel). The reason is that after we plucked pinned streams out from
stream_data.subscribed_streams(), we didn't sort them again, so they
remained in the alphabetic order used in stream_data.

However, we did sort unpinned streams explicitly by using custom compare
function in stream_list.js (by default sort by lowercase stream name,
but when there are more than 40 subscribed streams, sort active streams
first). That's why this issue only relates to pinned streams.

Changes were made to sort pinned streams by lowercase stream name, always,
whether they are active or not (different from unpinned streams).

Tests were added to ensure this overall sort order is correct, i.e.

1. pinned streams are always sorted by lowercase stream name.
2. pinned streams are always before unpinned streams.
3. unpinned streams are sorted by lowercase stream name, if there are more
   than 40 subscribed streams, sort active streams at the top, among active
   and inactive streams, still sorted by lowercase stream name.

Fixes #3701
2017-02-20 10:46:05 -08:00
vaibhav 35c1272525 Include stream description matches in filter results.
User search for streams will now return results where the stream
description (but not the stream name) include the string in the
user query.

The filtering process first obtains the streams whose names match the
user search query, then sorts and displays them. From the remaining
streams, it obtains streams whose description matches the query and
displays them in sorted order after the name match results. Other
streams are not displayed.

Fixes: #2674.
2017-02-20 06:56:59 -08:00
Steve Howell f28158d301 Live-update default streams when deleting streams.
When an admin deactivate a stream, we now remove the
appropriate row from the default streams tables for other
folks viewing default streams in the admin tables.
2017-02-19 18:06:20 -08:00
Steve Howell 6af83e31f6 admin screens: Encapsulate default streams table.
We add a default_streams_table() function that builds an
object encapsulating the defaults streams table in the admin
system.

This function allows us to simplify the click handler code by
closing on row/stream_name rather than picking those values out
of the DOM.
2017-02-19 18:06:20 -08:00
Kartik Maji 1a697b6e02 Add frontend to show message edit history.
Fixes #268.

Modified significantly by tabbott to:
* improve code cleanliness / repetition
* add missing translation tags
* move code into message_edit.js
* correspond with the new backend.
* not display the option for messages only topic-edited
2017-02-19 17:41:06 -08:00
Kartik Maji 0cf6c292d8 Add edit_history of message in update_messages.
Modified by tabbott to not be confused by embed_links edits.
2017-02-19 17:20:48 -08:00
Tim Abbott 78b2eaefc9 timerender: Add get_full_time function.
We'll need to do some iteration, but something like this will be
useful for message edit history.
2017-02-19 15:18:22 -08:00
Tim Abbott e29663a2b3 compose: Fix behavior hitting enter with the preview area open.
The new behavior is:
(1) If enter-sends is enabled, just send the messsage.
(2) If enter-sends is not enabled, return focus to the compose area.

Based on great work by khantaalaman in #3673.

Fixes #3489.
2017-02-18 23:31:54 -08:00
Steve Howell b9ec2545bb Simplify and speed up stream deactivation.
This is a fairly risky, invasive change that speeds up
stream deactivation by no longer sending subscription/remove
events for individual subscribers to all of the clients who
care about a stream.  Instead, we let the client handle the
stream deactivation on a coarser level.

The back end changes here are pretty straightforward.

On the front end we handle stream deactivations by removing the
stream (as needed) from the streams sidebar and/or the stream
settings page.  We also remove the stream from the internal data
structures.

There may be some edge cases where live updates don't handle
everything, such as if you are about to compose a message to a
stream that has been deactivated.  These should be rare, as admins
generally deactivate streams that have been dormant, and they
should be recoverable either by getting proper error handling when
you try to send to the stream or via reload.
2017-02-17 15:53:22 -08:00
Steve Howell 465a765cb0 Add stream_data.delete_sub().
(There was a method with the same name before, but it wasn't
being used.  The new version will accept stream_id instead
of name, and we will use it as part of deactivating streams.)
2017-02-17 15:49:43 -08:00
Steve Howell 1722f1e6c4 Extract stream_list.remove_sidebar_row(). 2017-02-17 15:49:43 -08:00
Tim Abbott f105e8270d compose: Fix hardcoding of 'website' client.
We already do detection of the client on the backend based on
User-Agent and the fact that it's a JSON view, which is pretty safe.
This fixes an issue where the server was not treating the Electron app
as its own client.
2017-02-17 15:20:32 -08:00
Tim Abbott 9072d3c350 socket: Transmit HTTP_USER_AGENT for websockets sending.
This significantly simplify the logic for our logging process, making
it the case that websockets message sending requests always are logged
as having the exact same client as a normal AJAX request from that
server.
2017-02-17 15:19:21 -08:00
Brock Whittaker 7f5703a21f Prevent HTML from being pasted into the stream name/description box.
This prevents users from either dragging formatted markup into content
editable boxes or pasting it in. This uses the “input” event rather
than “paste” because “paste” does not have the end result of the
contents whereas “input” does.

This is not a security vulnerability as it may seem. Processing on the
backend sanitizes input if it contains HTML.
2017-02-17 12:01:24 -08:00
Harshit Bansal 3498c01e1b admin: Make restricted to domains checkbox readonly incase of no domains.
If there are no domains then there is no meaning of setting restricted to
domains checkbox and hence it should be disabled.

Fixes: #3436.
2017-02-17 11:55:15 -08:00
Steve Howell 3e3444848d Remove avatar timestamp logic in the client.
We use to have client-side logic that would append timestamps
or random numbers to avatar URLs to force browsers to
refresh their cache.

We no longer need this now that the back end maintains
versions for avatar changes and puts the version in the URLs.
2017-02-17 10:19:56 -08:00
aakash-cr7 b72262e8ec Add UI for seeing all muted topics in settings page.
Fixes #2322.
2017-02-17 00:10:18 -08:00
paxapy 9a5179c460 Add support for managing and deleting attachments.
Modified substantially by tabbott to fix tons of issues.

Fixes #454.
2017-02-16 23:44:44 -08:00
Raghav Jajodia c1dfa348a1 alert_words: Trim whitespace around alert words.
"Add a new alert word" box now displays an alert when filled with only spaces.
Fixes #3369
2017-02-16 21:06:18 -08:00
Tommy Ip abf522adfb Add styling to distinguish bots from human users in message view.
With work by Brock Whittaker and Tim Abbott on rebasing + changing
styling.

Fixes #1107
2017-02-16 17:00:21 -08:00
Steve Howell 10e220f516 Handle email changes in user_events.update_person().
This code isn't active yet, since the back end doesn't send
events yet for email changes.
2017-02-14 23:25:22 -08:00
Steve Howell 4c53ad59f2 Update PM unread counts more dynamically in the client.
When we process messages for unread counts, we now call
people.pm_reply_user_string() to get a string of user ids,
rather than using emails that may have changed since the
message was originally created.
2017-02-14 23:25:22 -08:00
Steve Howell ed4adc5650 refactor: Simplify people.pm_reply_to().
We now call people.pm_with_user_ids() to avoid some duplicate
code.
2017-02-14 23:25:22 -08:00
Steve Howell 8d3a5e7f02 Add settings.update_email(). 2017-02-14 23:25:22 -08:00
Steve Howell 0bd3af2bc8 Create narrow.update_email(). 2017-02-14 23:25:22 -08:00
Steve Howell 0eeb023a03 Create filter.update_email().
This helper function will help us process email changes.
2017-02-14 23:25:22 -08:00
Brock Whittaker ca428cfc24 Fix tab click unresponsiveness.
There is a particular case in which when a user clicks on a tab, then
uses the goto method to go to another, and then clicks on the original
tab again, it will not load the original tab. This is due to the fact
that the goto function that is used to navigate to a tab without
clicking does not set the last_value, therefore leaving a state that is
incorrect and denying a view update in the case that a user performs
the following:

Click B -> Goto A -> Click B

In this case, it saves the last_value as “B” and so when a user clicks
back on “B” it does not trigger any change as it thinks the user is
going from “B” to “B”.
2017-02-14 23:20:38 -08:00
Steve Howell d406d34fe0 Use user_id in admin_user_list.handlebars.
For our user administration, we now primarily work with user ids
that get put into data-user-id attributes.  We still put emails in the
tags to make our Casper tests easy to maintain.

This requires a minor change to the back end to pass down user ids
for the /users endpoint (in get_members_backend).
2017-02-14 23:07:44 -08:00
Tim Abbott a0aa2ca0f2 hotkey: Fix incorrect test for open subscriptions overlay. 2017-02-12 13:29:12 -08:00
Durga Akhil M u1604vbox f833f68bfd mute_ui: Add UI for mute on recipient bar.
Like the topic edit pencil icon, the new UI is mostly invisible, but
appears when you hover over the recipient bar.

* Added a tag to hold the mute button in recipient_row.handlebars with
corresponding styling in zulip.css.
* Added an event handler for the mute button in click_handlers.js.

Fixes: #2235.
2017-02-12 00:45:20 -08:00
Igor Tokarev 55cffa1e69 Added keyboard shortcut to edit the last message.
Tweaked significantly by tabbott to update Casper tests, document the
new feature, and fix hotkeys.

Fixes #1147.
2017-02-12 00:29:28 -08:00
Tim Abbott 5c34c601d9 compose: Trim trailing whitespace in messages.
This should ensure that local echo matches the backend in handling of
unusual input like `/me `.
2017-02-11 23:01:22 -08:00
Rafid Aslam 241794c586 Change "Reply" to "Quote and reply" in message popover
Change "Reply" in message popover to "Quote and reply"
which is reply and quotes the selected message.

Fixes #3302.
2017-02-11 14:51:55 -08:00
Elliott Jin 4092aab620 unread: Refactor to move DOM element updates into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin ba449d7c23 unread: Refactor to move server calls into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin ef7d4e417c unread: Refactor to move bankruptcy modal into UI layer. 2017-02-11 08:36:39 -08:00
Elliott Jin d233f617dd muting: Refactor to move side effects into UI layer. 2017-02-11 08:36:39 -08:00
Steve Howell 2e07533b4e Add compose.update_email().
When we get notified of an email change and the compose box is
open for PMs, we should update the email in the compose box.
This helper will be useful when we start handling such events.
2017-02-10 21:57:50 -08:00
Steve Howell f56d3807cc Add people.update_email_in_reply_to() helper.
This will be used for live updating.
2017-02-10 21:57:50 -08:00