Commit Graph

3203 Commits

Author SHA1 Message Date
Steve Howell 24ee369d43 Improve error message in message_list.select_id(). 2017-03-27 10:26:30 -07:00
Steve Howell 6314f60edc Keep compose open if left arrow does not cause message edit.
If somebody hits the left arrow to edit a message, but there are
no messages available to edit, then leave them in the compose box.
2017-03-27 10:15:05 -07:00
Steve Howell 293c89ba94 message edit: Only enable left-arrow-editing for content.
We no longer let the left arrow put you into the message edit
UI for a message where you can only edit topics, since that is
just confusing to most users.

This change also improves error handling a bit, and it removes
an unnecessary call to rows.id().

Finally, it moves some logic out of message_list.js, so that we
don't have a circular dependency for this codepath.

Fixes #4259
2017-03-27 10:02:19 -07:00
Steve Howell c0a6038a95 css: Enforce one selector per line.
While it's sometimes nice to put a few selectors on the same line,
it is generally better to have a consistent way of formatting our
selectors, and most of our code up until now lists them vertically.
This change fixes the linter to enforce one selector per line, and
it cleans up the places in the CSS where we had multiple selectors
on the same line.

The advantages of one-per-line are as followers:
    * cleaner diffs
    * easier to see when multiple areas of the app may have the
      same format
    * less likely to go over 80 cols
    * makes it more clear where we have deep nesting in the
      individual selectors
    * makes it easier for our linting tools to enforce
      whitespace violations

This also fixed an old bug where we had ".landing_page h2, h4", which
sets "h4" styles outside of the landing page.
2017-03-26 16:57:33 -07:00
Steve Howell 3d76088f59 tools: Make CSS style more consistent with opening brace.
We now always put the opening brace of a CSS section on
the same line as the last selector (with a space in front).
2017-03-26 16:57:33 -07:00
Steve Howell cf6545a71f reactions: Only warn for unknown user ids.
If we get reactions for deactivated users, or otherwise missing
users, we only issue a blueslip warning now.  The function
get_message_reactions() was indirectly causing blueslip errors
before this fix, but we can downgrade to warnings now that this
function has better unit tests around it.

We eventually want to track deactivated users on the client.

Fixes #4289
2017-03-26 11:51:36 -07:00
Steve Howell 3da047e10e Add people.is_known_user_id(). 2017-03-26 11:39:06 -07:00
Steve Howell 80addd902c Extract local vars in get_message_reactions(). 2017-03-26 11:39:05 -07:00
Tim Abbott 5672618b82 css: Extract popovers.css. 2017-03-25 20:14:17 -07:00
Cynthia Lin f41883ce8d subs.js: Refactor row data functions to return objects. 2017-03-25 18:35:21 -07:00
Cynthia Lin 6e2d180a34 hotkeys: Add hotkey `n` for opening New streams modal in Streams menu. 2017-03-25 18:35:21 -07:00
Cynthia Lin ca460fad1f hotkeys: Add hotkey `V` for viewing selected stream in Streams menu. 2017-03-25 18:35:21 -07:00
Cynthia Lin a027e9318d hotkeys: Move cursor to Filter streams input if at top of Streams menu.
Fixes #4227
2017-03-25 18:35:21 -07:00
Cynthia Lin b800cb05c0 hotkeys: Add left/right arrow keys to toggle views in Streams menu.
Fixes #4228
2017-03-25 18:35:21 -07:00
Cynthia Lin fb89d8a2bf subs.js: Refactor modal row functions. 2017-03-25 18:35:21 -07:00
Cynthia Lin 69c32daffa hotkeys: Add `U` hotkey for unsubscribing/subscribing in Streams menu.
Fixes #4229
2017-03-25 18:35:21 -07:00
Cynthia Lin d17131dcb4 hotkeys: Rename subs.arrow_keys() to subs.switch_rows(). 2017-03-25 18:35:21 -07:00
Aditya Bansal 42265fe035 Fix '@' in userprofile popover to use font-awesome icon. 2017-03-25 18:30:58 -07:00
Aditya Bansal 91962aa6ab font-awesome: Fix font-awesome 4.7.0 upgrade in a hacky way.
What actually has been done below is to just copy the css class defination
from the latest font-awesome css to be here and since the rest of the stuff
in /third/fontawesome was updated in ee0b16b1ef
we should be able to use this safely until we update all font-awesome class
usage in templates.

Fixes #4302.
2017-03-25 18:30:40 -07:00
K.Kanakhin 234a1f8e61 retention-period: Add retention period to front-end admin organization settings.
- Add message retention period field to organization settings form.
- Add css for retention period field.
- Add convertor to not negative int or to None.
- Add retention period setting processing to back-end.
- Fix tests.

Modified by tabbott to hide the setting, since it doesn't work yet.
The goal of merging this setting code now is to avoid unnecessary
merge conflicts in the future.

Part of #106.
2017-03-25 17:57:18 -07:00
Joshua Pan 16b2313165 muting_ui.js: Remove any popups when unmuting. 2017-03-25 12:49:14 -07:00
Joshua Pan 76e84288d9 Add M hotkey to toggle mute/unmute topics.
Get rid of current_msg_list.selected_message() redundancy.
2017-03-25 09:42:49 -07:00
Joshua Pan dc9f83005f Add toggle_mute to muting_ui.js. 2017-03-25 09:42:49 -07:00
Joshua Pan 32837804d8 Extract stream_popover.topic_ops to muting_ui.js. 2017-03-25 09:42:49 -07:00
Brock Whittaker efd72d3338 Modify lightbox to only display valid images and YT Videos.
This modifies the lightbox to only display images inside the
".message_inline_image" class, rather than all images inside the
message body, which currently includes things like the bot icon.
2017-03-25 09:19:26 -07:00
Steve Howell b3e4aa4c44 reactions: Downgrade blueslip error to a warning.
When we get a server error for adding/removing a reaction, we
no longer make a blueslip error, since it is somewhat common for
users to retry actions before the server sends an event.  The
code comment that is part of this commit explains this further.

Fixes #4290.
2017-03-24 18:24:15 -07:00
wizsid11 95789eb879 Add Slack webhook.
Adds a new webhook integration for Slack to receive messages
from one's Slack team's public channels.
Contains negative tests for broken, missing or invalid data.

Allows two different option for integration:
1. Receive notification on a single stream with different topics
for each of Slack's public channels.
2. Receive notification on different streams for each of Slack's
public channels.

Steps to choose between the two options is described in the documentation.

Fixes #3569.
2017-03-23 23:32:38 -07:00
Tomasz Kolek be0a2cb20b Add basecamp3 webhook integration.
Fixes: #3949.
2017-03-23 23:28:53 -07:00
Tim Abbott 69323d12c9 Fix click message_content covering bottom half of avatar.
This causes clicks to correctly hit the avatar an open the profile
popover.

Fixes #4251.
2017-03-23 15:22:06 -07:00
Aditya Bansal 17a4c5d0d8 Fix horizontal scroll for super long lines in bullet lists.
Fixes: #4245.
2017-03-23 15:19:28 -07:00
Moritz Neeb 9866805937 docs: fix a typo in hashchange.js 2017-03-23 15:16:02 -07:00
Joshua Pan f40b43a491 hotkeys: Add hotkey `G` an alias for End.
Fixes #4195.
2017-03-23 11:38:36 -07:00
Tim Abbott 5d030e9173 casper: Add test for the reload hashchange logic. 2017-03-22 23:06:08 -07:00
Tim Abbott 04db0b5df0 reload: Fix passing data to next browser session.
Apparently, Django's CSRF protection mechanism changed at some point,
and now we get a different CSRF token every time the webapp is loaded.
This, in turn, caused our reload logic to avoid losing state to be
completely ineffective, since the CSRF check in reload.initialize
always failed.

We fix this in a secure fashion by passing the reload instructions
from the browser to its reloaded self via localstorage, keyed by a
randomly generated token.  The token randomization is primarily
relevant for handling several Zulip tabs in the same browser, but also
servers to make it very difficult for an attacker to ever trigger this
code path by redirecting a browser to `/#reload` URLs.

Fixes #3411.
Fixes #3687.
2017-03-22 22:46:54 -07:00
Tim Abbott 64acf84ab1 reload: Save narrow when event queues expire.
Along with the issues with our reload data passing system that are
fixed in the next commit, this is responsible for #3411.
2017-03-22 22:28:35 -07:00
Tim Abbott ee4b948873 bankruptcy: Fix narrow being lost on declaring bankruptcy.
This was actually being done in 2 ways: via not saving the narrow in
the reload and second through calling `change_tab_to('#home')`.  The
code is so ancient that it seems unlikely that this behavior was still
intentional.

Fixes part of #3687 (the remainder is fixed in a few commits).
2017-03-22 22:28:18 -07:00
Tim Abbott 37ac0e6e6d server_events: Remove obsolete 'tool old' handler.
This error predates the transition to an event queue system and hasn't
been possible for years.
2017-03-22 21:16:39 -07:00
Tim Abbott 61e6ed8c31 bankruptcy: Fix clicking outside bankruptcy modal.
Previously, this would leave the unread UI disabled forever, showing 0
unread counts for anything, which was a super confusing failure mode.
2017-03-22 20:50:44 -07:00
Tim Abbott 977e7b0fdc unread: Move bankruptcy code out of click_handlers.js. 2017-03-22 20:49:05 -07:00
Tim Abbott 1f89058023 Fix broken size for message actions popover.
This fixes a regression introduced in
23a5f56023 where the `.popover-inner`
CSS wasn't scoped properly.
2017-03-22 16:44:23 -07:00
Tim Abbott ccb38a1e9c compose: Fix missing opts argument to show_box.
This fixes a regression in the recent compose.get_focus_area
refactoring that I did.
2017-03-22 16:32:53 -07:00
hackerkid 97bd9d5186 Fix positioning of message-info-popover. 2017-03-22 16:04:38 -07:00
hackerkid ed72ee476f Make user_popover use user_info_popover template. 2017-03-22 16:04:38 -07:00
hackerkid b2fc8d6fa2 Rename message_info_popover* templates to user_info_popover*. 2017-03-22 16:04:38 -07:00
hackerkid 23a5f56023 Add sender avatar in message popover. 2017-03-22 16:04:38 -07:00
hackerkid 3ac8f52a73 Remove title of message info popup. 2017-03-22 16:04:38 -07:00
hackerkid 32bc5893d0 Remove arrow from message info popover by providing template.
Provide custom template (user_info_popover.handlebars) to message info popover.
2017-03-22 16:04:38 -07:00
Tim Abbott 2a5269baa9 docs: Document the frontend hashchange system. 2017-03-22 15:21:36 -07:00
hollywoodno d6716838ad bugdown: Remove trailing whitespace on fence code blocks.
This fixes fenced code blocks that are copy-pasted from certain
clients having trailing whitespace anoyingly often.

Fixes #3998.
2017-03-22 14:17:34 -07:00
Brock Whittaker 5ed482cf2c compose: Apply consistent styling for compose buttons.
This applies the consistent :hover effect for all compose buttons.

Fixes: #4239.
2017-03-22 13:15:44 -07:00
Tim Abbott 3d3f9bc58e devlogin: Link to the normal login page. 2017-03-22 13:03:45 -07:00
Brock Whittaker dbcd19bcfa streams: Add hotkey for content-editable enter.
When you enter, it should click the checkmark, which would save the
current input of the input section.
2017-03-22 12:21:21 -07:00
Brock Whittaker d21fe68e9e streams: Fix content-editable cursor shifting to beginning. 2017-03-22 12:21:08 -07:00
Raghav Jajodia 956106ae92 streams: Fix closing of content-editable area on escape key press.
Pressing Escape key while editing stream description now closes
the editing.
Fixes #4202.
2017-03-22 12:19:59 -07:00
Raghav Jajodia 9a339a7053 streams: Prevent cursor jump to the end of editing stream-descr.
This prevents the cursor to jump at the end of the content-editable
area when the user types in the middle.

Fixes #4202.
2017-03-22 12:19:59 -07:00
Raghav Jajodia 9707c74f33 message_edit: Added copy to clipboard button.
A copy-to-clipboard button is added over message-edit textarea.
Closes #3239.
2017-03-22 11:00:18 -07:00
Steve Howell 2991c19fea Extract typing indicator inbound timing logic.
We now track our inbound timing events using code in
typing_data.js.

This code may be a little more robust with variations on how
recipients are represented in events, although there are no known
bugs here.
2017-03-22 08:20:21 -07:00
Steve Howell 4fb8339954 Extract typing_events.js. 2017-03-22 07:29:42 -07:00
Steve Howell cde1861655 typing indicators: Validate PM emails. 2017-03-22 07:01:20 -07:00
Steve Howell 1ec392a18e Extract compose.get_invalid_recipient_emails(). 2017-03-22 07:01:20 -07:00
Steve Howell 84b31a5532 typing indicators: Limit to PM conversations.
We now only send outbound typing indicators if we are
composing a private message.
2017-03-22 07:01:20 -07:00
Steve Howell 642be6ad18 Revamp state tracking for outbound typing indicators.
This change moves most of the logic related to starting and
stopping outbound typing indicators to a new module called
typing_status.js that is heavily unit tested.

While this was in some sense a rewrite, the logic was mostly
inspired by the existing code.

This change does fix one known bug, which is that when we
were changing recipients before (while typing was active), we
were not stopping and starting typing indicators.  This was
a fairly minor bug, since usually users leave the compose
box to change recipients, and we would do stop/start under
that scenario.  Now we also handle the case where the user
does not leave the compose box to change recipients.
2017-03-22 07:01:20 -07:00
Steve Howell f89c9d6629 Avoid deprecated report_success() call.
We are moving to ui_report to break dependencies.
2017-03-22 06:53:21 -07:00
Tim Abbott 2076338eaa mark_subscribed: Add a blueslip check for color code path.
This code path might be unused, and it seems worth verifying, since if
it is, we can delete some extra complexity.
2017-03-21 23:36:47 -07:00
Tim Abbott 01904385a4 Fix thrashing color when resubscribing to a stream.
Previously, we would let the backend pick a color and send it to the
frontend; then the frontend would ignore that color and pick a
different color and send it to the backend, which would in turn resync
to us.

Fixes #3572.
Fixes #3858.
2017-03-21 23:35:50 -07:00
Tim Abbott 832aa398b0 subscription_settings: Move email address into toggled area. 2017-03-21 23:09:32 -07:00
Tim Abbott 1ad0d35966 subs: Clean up ancient collapsing logic. 2017-03-21 23:09:32 -07:00
Tim Abbott bfc67f6602 subs: Toggle notification settings on subscribe. 2017-03-21 23:09:32 -07:00
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
Eeshan Garg b8f71c5d24 Document how to set up an Asana integration via Zapier.
Fixes #3948.
2017-03-21 19:56:47 -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 920b082e08 Fix animation speed bug with > going at a different pace than text.
The issue is that stacking the two transitions appears to make the
::after pseudo-element slower for some reason than its parent. This
visually appears to fix it.
2017-03-21 14:10:27 -07:00
Yago González 0c6251e58d docs: Add reference to tilde-fenced code blocks. 2017-03-21 13:58:40 -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
adnrs96 257187a239 Clean zulip.css to use 4 space indents. 2017-03-21 13:40:05 -07:00
adnrs96 a91012bd70 Move thirdparty-fonts.css from static/styles to static/third. 2017-03-21 13:40:05 -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
Jeremy Philemon d13901c22b Changed "Choose a user" to "Click on a user to log in".
- Set the width of .login-page-header to 100% to make it responsive on
smaller screens. Previously, the header went off screen for screen
widths <360 px.

Tweaked by tabbott to remove unnecessary translation tags.

Fixes #4106.
2017-03-20 21:55:11 -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