Commit Graph

7263 Commits

Author SHA1 Message Date
Aman Agrawal 93a41e95a1 message_util: Extract get_topics_for_message_ids. 2020-09-15 17:03:27 -07:00
Anders Kaseorg b00a0bfe53 js: Use simplebar ES module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-15 16:33:28 -07:00
Anders Kaseorg a3d26d701e styles: Rename .scss files back to .css.
css-loader@4 broke @import statements referencing files with
extensions other than .css, unless those @import statements are
compiled away by another loader.  Upstream is more interested in
arguing that such @import statements are semantically incorrect than
applying the one line fix.

https://github.com/webpack-contrib/css-loader/issues/1164

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-15 16:33:28 -07:00
sahil839 ab90abfa4c stream_data: Rename sub.is_admin to sub.is_realm_admin.
This commit renames sub.is_admin to sub.is_realm_admin such that
we can clearly differentiate between realm and stream admins.
2020-09-14 22:05:31 -07:00
Ryan Rehman 20775e5429 minor: Rename `previously_selected` of message selected event.
This is done since we have logic in place which compares `event.id`
and `event.previously_selected`, both of which point to message ids.
2020-09-14 10:56:37 -07:00
Anders Kaseorg 463929f349 urls: Migrate re_path routes to path.
Django treats path("<name>") like re_path(r"(?P<name>[^/]+)") and
path("<path:name>") like re_path(r"(?P<name>.+)").

This is more readable and consistent than the mix of slightly
different regexes we had before, and fixes various bugs:

• The r'apps/(.*)$' regex was missing a start anchor ^, so it
  incorrectly matched all URLs that included apps/ as a substring
  anywhere.
• The r'accounts/login/(google)/$' regex was missing a start anchor ^,
  so it incorrectly matched all URLs that ended with
  accounts/login/google/.
• The type annotation of zerver.views.realm_export.delete_realm_export
  takes export_id as an int, but it was previously passed as a string.
• The type annotation of zerver.views.users.avatar takes medium as a
  bool, but it was previously passed as a string.
• The [0-9A-Za-z]+ pattern for uidb64 was missing the - and _
  characters that can validly be part of a base64url encoded
  string (although I think the id is actually a decimal integer here,
  in which case only 012345ADEIMNOQTUYcgjkwxyz are present in its
  base64url encoding).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-12 14:29:26 -07:00
Aryan Shridhar 4e8067aadc
message_edit: Add hide event for clipboard tooltip after copy.
The clipboard tooltip for the "copy and close" button was incorrectly staying visible after the
copy event.  Fix this by explicitly hiding tooltips in the click handler.

Fixes #16328.
2020-09-12 12:04:24 -07:00
aryanshridhar 42b1ed23a9 reactions_tooltip : Improved responsiveness of tooltip for reactions.
Improved responsiveness of message reactions tooltip .
Added css property for the reaction tooltip in ./static/js/click_handlers.js so that the tooltip doesn't exceed the sidebar .

Adressed a comment in #15364 .
2020-09-09 13:24:04 -04:00
Abhijeet Prasad Bodas 49fd272d7d invite: Fix compose box focus on clicking (Un)check All in invite window.
Fixes #16077.
2020-09-04 12:58:11 -07:00
Abhijeet Prasad Bodas e5054a3a66 invite: Scroll to top and focus email input after submit in invite.js.
Part of #16077.
2020-09-04 12:58:11 -07:00
Abhijeet Prasad Bodas b570cf1433 invite: Allow submitting invite form with Ctrl+Enter in invite.js.
Part of #16077.
2020-09-04 12:58:11 -07:00
Abhijeet Prasad Bodas 9fc10479fe invite: Focus first input in invite window in invite.js.
Part of #16077.
2020-09-04 12:58:11 -07:00
Vinit Singh 140d24ca7f compose: Update compose placeholder text if stream name is changed.
Compose box placeholder text for streams currently updates when focus
is shifted to the text area.

With this change, it will also get updated when the stream name is
changed (it already updates if topic names are changed).
2020-09-04 12:45:51 -07:00
Vinit Singh d43b1765d5 compose: Update compose placeholder text if recipients are changed.
Currently, compose box placeholder text for PMs only gets updated
when the focus shifts to it.
With this change, the text is now also updated if recipients are
added or removed.

Fixes #15897.
2020-09-04 12:45:51 -07:00
Vinit Singh c6e278ab5a input_pills: Fix `onPillCreate` to update when adding pills with typehead.
Previously, onPillCreate function was called after the individual
pill object was created.
Now, we call it after creating and adding it to the pill container.
2020-09-04 12:45:51 -07:00
Priyank Patel 551a19c90d js: Convert people module to ES6. 2020-09-01 19:55:58 -07:00
Priyank Patel aca77e9245 js: Convert pm_conversations module to ES6.
This was converted automatically using a jscodeshift script followed
by running eslint and prettier to convert let -> const (whenever
applicable) and removing "use strict;".
2020-09-01 19:55:58 -07:00
Priyank Patel b7998d3160 js: Purge people module from window. 2020-09-01 19:55:58 -07:00
Priyank Patel d774bba1b9 js: Purge pm_conversations module from window.
All the changes are done using a script followed by updates to Node
tests and running eslint and prettier to fix formatting issues.
2020-09-01 19:55:58 -07:00
Anders Kaseorg c74b1b22c1 eslint: Forbid unnecessary path segments in imports.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-01 16:43:02 -07:00
Anders Kaseorg 279e4b819e js: Elide .js and .ts extensions from imports and requires.
This will be required for TypeScript.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-09-01 16:43:02 -07:00
Aman Agrawal 2de98ab6e1 settings: Don't use css classes starting with `icon`.
Fixes #16252.

icon* classes are used by bootstrap for displaying glyphicons.
We removed these classes in our custom version of bootstrap 2.1.1;
but since our reset to v2.3.2, they have been added again and hence
any classes starting with icon* in zulip will have to be renamed.
2020-09-01 10:56:02 -07:00
Mohit Gupta 98da8cd7f2 popovers: Add keyboard support for user popovers in right sidebar.
This commits adds arrow, vim_up/vim_down and enter hotkey support for
navigating the open popover menu.
2020-08-31 22:55:29 -07:00
Mohit Gupta 937c85d278 popovers: Add keyboard support for starred message popovers in sidebar.
This commits add arrow, vim_up/vim_down and enter hotkey support for
navigating the popover menu when it is open.
2020-08-31 22:55:28 -07:00
Mohit Gupta a1d3707bfb popovers: Add keyboard support for All Messages popover in sidebar.
Even though right now it have one option added arrow, vim_up/vim_down
and enter hotkey support for navigating the popover menu if it is open.
2020-08-31 22:55:28 -07:00
Mohit Gupta 5cef548708 popovers: Add keyboard support for topic popovers in left sidebar.
This commit adds arrow, vim_up/vim_down and enter hotkey support for
navigating the popover menu.
2020-08-31 22:55:28 -07:00
Mohit Gupta 2579781a0a popovers: Add keyboard support for stream popovers in left sidebar.
This commit adds arrow, vim_up/vim_down and enter hotkey support for
navigating the open stream popover menu.
2020-08-31 22:52:28 -07:00
Vinit Singh afa87156c6 refactor: Refactor the compose placeholder text function.
This is a prep commit. Refactoring this makes it easier to reuse
these functions in other places without having to create the `opts`
object again.
2020-08-31 22:42:49 -07:00
sahil839 a01d33353f message_list: Live update trailing bookend on stream deactivation.
We were not updating the trailing bookend on deactivation of stream
if the user was narrowed to deactivated stream and this commit fixes
this.

For subscribed streams, we just show the trailing bookend with
content as 'This stream has been deactivated' and hide the
Unsubscribe button.

For unsubscribed streams, we change the content of trailing bookend
to 'This stream has been deactivated' and hide the Subscribe button.

Fixes #15999.
2020-08-31 22:28:19 -07:00
Priyansh Garg 8dd29f4e99 portico: Improve error messages display on registration page.
Improves the display of error messages on registration page fixing
mis-positioning of error messages and overlapping with other text
in some cases.

Part of: #15750.
2020-08-31 22:12:03 -07:00
Ryan Rehman 981d028411 stream edit: Allow creating stream pills when typeahead is unused.
This completes the remaining work required to support
addition of all members of another stream.
This allows the creation of stream pills on pasting
the #streamname and copying it from the stream pill.
The user pills uses email ids instead.
And also allows creating stream pills when the user
hides the typeahead.

Tested by commenting out the "set_up_typeahead_on_pills"
line in `stream_edit.js`.

A `node_tests/stream_pill.js` file has been created
for the node tests and the other half of the coverage
check takes place in `node_tests/stream_edit.js`.
2020-08-31 16:57:32 -07:00
Ryan Rehman c6d9a87d6f streams: Allow creating stream pills to submit Add subscriber form.
We update the pills typeahead logic to also include
stream results and pass the "stream" key in `opts`
to enable this option for the Add subscriber form.

This commit implements the feature of adding all the
subscribers of another stream in the "Add subscribers"
UI, with the help of a new "stream_pill.js` file.

We temporarily add `user_pill.js` to the EXEMPT_FILES
list as typeahead will be set up in `stream_edit.js`
file which does not have any dedicated tests file.

Work towards #15186.
2020-08-31 16:57:32 -07:00
Ryan Rehman b93371aa9f refactor: Remove redundant JQuery checking block.
We can safely remove the block added in commit
7d51b6a454
which checks whether the target is a JQuery object
and applies it, if it is not, because re-applying
the JQuery selector on a JQuery object returns the
same object.

We also refactor the related function calls to pass
the target instead of applying the JQuery selector
to it and finding the closest "subscription_settings"
class, as the same operation takes place in the next
line of the removed block. Thus this is redundant too.
2020-08-31 16:57:32 -07:00
Ryan Rehman 45b2e5b408 refactor: Refactor `show_subscription_settings` interface.
The `show_subscription_settings` function is only called
from one place. And the first 2 lines of this function is
redundant as the `sub_settings` are passed to this function
but we obtain it's stream id and again convert it back to
`sub_settings` from it.
2020-08-31 16:57:32 -07:00
Ryan Rehman 16ebf56fd7 ui: Add loading spinner for Move Topic popover.
We display a centered spinner and hide the Submit / Cancel
buttons in the Move Topic modal similar to what is done in
the Deleting messages modal.

This commit also makes a change where we now close the modal
after success/failure response of the second request instead
of the first.
2020-08-31 16:51:49 -07:00
Aman Agrawal 6e189b14a6 popovers: Align user profile popover with right col USERS header. 2020-08-31 14:01:11 -07:00
Aman Agrawal 5071325345 popovers: Reapply changes to bootstrap.js.
We don't modify bootstrap.js here but override its popover and
tooltip plugins. In future we will not import these plugins
via npm. We also copy all the popover code from bootstrap.css v2.1.1
to popovers.scss since all the code in bootstrap-tooltip.js is
based upon this css or vice versa.

Update THIRDPARTY info about bootstrap libraries.

There were 4 types of changes to bootstrap.js - bugfixes, file
moves, changes to typeahead plugin and changes to tooltip +
popover plugin.

Bugfixes were automatically fixed when upgrading to v2.3.2, file
moves are irrelevant to this upgrade and the plugins were
extracted into separate files.

46e562f - POPOVER
8779e55 - POPOVER
66c6423 - POPOVER
21ccf45 - POPOVER
cb9b526 - TYPEAHEAD EXTRACTED
3079cf8 - TYPEAHEAD
9ea4f50 - TYPEAHEAD
b961093 - TYPEAHEAD
0e2c509 - TYPEAHEAD
28589c5 - TYPEAHEAD
70a14d8 - TYPEAHEAD
0c42e4a - TYPEAHEAD
213b8ce - FIXED IN 2.3.2
0bac986 - TYPEAHEAD
0e3332d - FIXED IN V2.3.2
eaa777b - TYPEAHEAD
f944a8e - TYPEAHEAD
546ae10 - TYPEAHEAD
3bba0cc - FILE MOVED
b8794e1 - TYPEAHEAD
6217c1a - TYPEAHEAD
dc85fa7 - TYPEAHEAD
d329317 - TYPEAHEAD
b3ef776 - TYPEAHEAD
fcb3999 - TYPEAHEAD
0975cfa - TYPEAHEAD
fbed3e2 - TYPEAHEAD
0fa857d - POPOVER
68b890a - TYPEAHEAD
b5cadec - typeahead
441e429 - copyright
22ce2c0 Fixed In v2.3.2
d78d761- typeahead
bff933e- typeahead
ef585cf- typeahead
7e35369 - typeahead
8f1cee0 - Files moving around
1490ae1 - add file
2020-08-31 14:01:11 -07:00
Aman Agrawal 6a2c7327cc boostrap: Reset to v2.3.2.
We merge bootstrap-responsive.css into bootsrap.css since that is
how bootstrap distributes it from this version onwards.

bootstrap.js has a lot of changes to it which completely breaks
our typeaheads and popovers, so we will have to override these
plugins with our version of these plugins. In future versions
of bootstrap when we use npm, we can just choose not to
import them.
2020-08-31 14:01:11 -07:00
Gittenburg 2d30af113e compose: Restore Tab+Enter sending in Safari.
Safari doesn't make <button>s tab-accessible by default,
so this commit adds back the manual focus removed in
3b0694693b.
2020-08-30 23:51:18 -07:00
sahil839 38eac64d91 settings_account: Fix error message while deactivating account.
We were showing the incorrect error message when the user who
is trying to deactivate himself is the last owner. This commit
fixes this to show "Cannot deactivate the last organization owner"
instead of "Cannot deactivate the last organization administrator".

We had already removed the restriction for deactivating last admin
and added it for last owner, while adding the new owner role.
2020-08-30 17:12:57 -07:00
Priyank Patel 9884226ffb settings_account: Don't redirect to login page during password change.
This handles a rare race condition that occurs when the session hash
is not updated by the backend during the password change process.
This mostly occurs in puppeteer tests, but could occur to a user.
2020-08-30 14:58:49 -07:00
Dinesh 4ed4eac1f7 user_deactivation: Use fa-user-times on reactivation. 2020-08-27 11:45:35 -07:00
Sumanth V Rao 42d30bc14b markdown: Add copy-to-clipboard button in codeblocks.
Clicking on the copy-to-clipboard button triggers the clipboard.js
API to dynamically set the text to be copied. This text is the
actual code content from the sibling <code> element (extracted
though jQuery text() method).

The html structure would now look like:
<div class="codehilite">
    <pre>
        <button> The copy button </button>
        <span></span>
        <code>......</code>
    </pre>
</div>

Additionally, this preserves the original code formatting of
the codeblock during copy-paste.

Tests amended.

Fixes: #15208
2020-08-26 23:18:05 -07:00
Ryan Rehman 34b420bf59 ui: Add loading indicator for message edits.
This commit hides the "Save" and "Cancel" buttons
after the first click and shows a spinner until a
successful / failed response is received.

We do not allow sending any other message edit
requests during this time frame, similar to how
our inline topic edit ui works.

Fixes #16143.
2020-08-25 17:22:29 -07:00
Tim Abbott 1e04fad11a events: Use op rather than operation in frontend. 2020-08-24 12:44:29 -07:00
Mohit Gupta 4167517a6f filters: Fix has:image and avoid future issues for other has filters.
This fixes a bug with the original frontend-side implementation for
has: filters, where it would incorrectly not match content in cases
where the message's nesting structure did not have an outer tag.

Bug was introduced in 02ea52fc18.

Fixes #16118.
2020-08-14 16:51:26 -07:00
shanukun aa6f2b1310 navbar_alerts: Fix navbar alerts inaccessibility.
Part of #16079.
2020-08-14 15:57:48 -07:00
Gittenburg 3b0694693b compose: Make message control buttons accessible.
Previously the emoji picker, the formatting help, the button to attach
files, the video call button, the Drafts button and the Press Enter to
send checkbox were all inaccessible from the keyboard.

This does break the Tab + Enter workflow for sending messages, which is
fixed in the next commit by moving the Send button to be the first
element after the textarea.

Part of #15910.
2020-08-14 15:46:50 -07:00
sahil839 e1636d30a9 settings: Close user info popover before opening modal.
We should close user info popover for invite and bots page
before opening resend invite, revoke invite and bot edit modal.
2020-08-12 17:34:14 -07:00
sahil839 1ae00a306b settings: Hide open popovers when switching panels in settings overlay.
This is a prep commit for changing the bots list page to show normal
user popover instead of extended profile one. This is added so that any
open popovers are closed while switching panels in settings overlay.

This change was not needed previously because we were using modal for
showing extended user profile. Now as we would be adding popover, we
would need this change to close the open popovers while switching
panels in settings overlay.
2020-08-12 17:31:25 -07:00
Anders Kaseorg 4e7eda0539 lightbox_canvas: Remove movementX, movementY polyfill.
This isn’t necessary in modern browsers and throws errors with "use
strict".

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2020-08-12 16:07:28 -07:00
Gittenburg 0dbc5df42d message_edit_form: Make edit controls accessible.
Fixes #6234.
2020-08-11 12:35:15 -07:00
Anders Kaseorg fb2e56e3c9 docs: Fix capitalization of keyboard keys.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:25:53 -07:00
Anders Kaseorg c155403884 docs: Fix various capitalization errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:25:52 -07:00
Anders Kaseorg 768f9f93cd docs: Capitalize Markdown consistently.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:23:06 -07:00
Anders Kaseorg 60a25b2721 docs: Fix spelling errors caught by codespell.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-11 10:23:06 -07:00
Tim Abbott dedb28055a stats: Fix a few strings not tagged for translation. 2020-08-10 16:26:37 -07:00
Shanu b5b7bc9a7c
loading: Add aria-hidden="true" attribute to loading spinners.
Fixes #16082.
2020-08-09 16:47:56 -07:00
Anders Kaseorg f63d132276 js: Use unminified KaTeX (and minifiy it with everything else).
Since our Webpack config passes pre-minified JS files to
script-loader, they can’t be used as modules.  Use the normal
unminified version, letting Webpack minify it and give us source maps.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-07 11:27:44 -07:00
sahil839 a33b695a21 overlays: Add popovers.hide_all call to close_overlay.
This is a prep commit for changing the bots list page to show
normal user popover instead of extended profile one.
This is added so that any open popovers are closed, if one
tries to close the overlay.

This was not needed previously because we were using modal for
showing extended user profile. Now as we would be adding popover,
we would need this to close the open popovers before closing overlay.
2020-08-06 16:05:22 -07:00
sahil839 1acfb4e942 popover: Rename show_user_info_popover function.
This commit renames the show_user_info_popover function to
show_user_info_popover_for_message, as it is used to open
the popover for users which are essentially related to a
particular message, like message sender and mentioned user.
2020-08-06 16:04:13 -07:00
Sumanth V Rao 572b3930e7 invite: Use `email` rather than `values[0]` in invite.js. 2020-08-06 15:47:00 -07:00
sahil839 982fa366ae stream: Send PATCH request for stream description only if it is changed.
We should send PATCH request for changing stream description only if
it is actually changed, there is no need to send request to backend
if the description is not changed.
2020-08-06 12:15:29 -07:00
sahil839 6bad8b23fc streams: Send PATCH request for stream rename only if name is changed.
We shoudl only send PATCH request to API for stream rename only if
stream name is actually changed.

Previously, when trying to save the stream name without actually
changing it, backend returned 400 with error as "Stream already
has that name". Ideally, we should not make PATCH request if name
is not changed and it should just close the edit widget.
This commit solves this bug.
2020-08-06 12:15:29 -07:00
Tim Abbott beae13b4d6 recent_topics: Renaming confusingly named deletion handlers.
This functions were oddly named in a way that didn't make clear their
role in handling deleted messages.
2020-08-06 12:00:30 -07:00
Tim Abbott 5142bdd317 recent_topics: Fix exception processing old deleted messages.
When old messages are deleted, they may not be present in
message_store when we receive the event notifying the client about
their deletion.
2020-08-06 11:58:23 -07:00
sahil839 004b6f2e62 stream_edit: Send values of changed settings only to backend.
This commit changes change_stream_privacy function to only
send the values of changed settings to backend.
We also avoid sending PATCH request if none of the settings
in stream privacy modal are changed.

This change also fixes the bug in changing stream permissions
for realms with limited plans.

Fixes #16024.
2020-08-05 16:17:04 -07:00
Ryan Rehman 60eef68f59 refactor: Extract `set_up_typeahead_on_pills` to a new file.
We move this function from `user_pill.js` to `pill_typeahead.js`.
The function has also been renamed to `set_up`.

The move was made because there are plans to update the pills
typeahead (i.e. to include user-groups/streams in the results).
Thus this function should not belong in `user_pill.js`.
2020-08-04 15:58:12 -07:00
Ryan Rehman b4888c1251 subscriptions: Refactor template rendering of `stream_privacy_policy`.
This makes it similar to `stream_post_policy`.
2020-08-04 15:48:35 -07:00
Ryan Rehman 73fac8e1d7 toggler: Allow skipping over disabled tabs.
This commit allows skipping over any disabled tabs
that are in the middle when using the left or right
arrow keys.

We also add `enable_tab` to the `components` API.
2020-08-04 15:48:34 -07:00
Ryan Rehman 806da412ac subscriptions: Simplify the displaying of subs pane.
".stream-info-title" selector is used to hide both
"#add_new_stream_title" and "#stream_settings_title"
classes. This will be helpful when we add new html
elements to display in the title area..

`clear_edit_panel` can be removed as the next line to
where it is called makes it redundant, we only need
to de-select the stream row, as done in this commit.
2020-08-04 15:30:07 -07:00
Ryan Rehman e0b5c2ec49 subscriptions: Update `get_active_data.tabs` to be more specific.
Since the subscriptions container contains multiple toggler components,
it is helpful to know that the function's tab key returns all the active
tabs in the page (currently there are 2). Thus `tab` is changed to `tabs`.

Also, which togglers tab data is being used has been made more specific.
2020-08-04 15:30:07 -07:00
Aman Agrawal 1b05f8e6c9 stream_topic_history: Update max msg id of stream post msg deletion.
After the latest message in a stream is deleted, we should update
the max_message_id in the stream.

Removed false comment in message_util.get_messages_in_topic
this method only takes 2ms for 10,000 messages loaded locally.
2020-08-04 15:29:03 -07:00
Aman Agrawal b32dc5e58f stream_topic_history: Update topic last msg_id after msg deletion.
Fixes #15992.
If the last message of the topic was deleted, we update the stored
message_id in the topic history so that the topic order in topic_list
is updated correctly.
2020-08-04 15:29:03 -07:00
Anders Kaseorg b3ae3d6de9 settings_panel_menu: Remove leftover angry debugging assertions.
Apparently I forgot to remove these from commit
0b4483c8d2 (#15920).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-08-02 12:38:19 -07:00
Anders Kaseorg 6ec808b8df js: Add "use strict" directive to CommonJS files.
ES and TypeScript modules are strict by default and don’t need this
directive.  ESLint will remind us to add it to new CommonJS files and
remove it from ES and TypeScript modules.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 22:09:46 -07:00
Tim Abbott 4f930688cf compose: Fix buggy message post policy warning.
The previous logic with `new Date` produced invalid values for
differences longer than a year.
2020-07-31 22:07:19 -07:00
Anders Kaseorg 59ba7e38c0 settings_profile_fields: Fix sortablejs import.
Commit 114cc1ec25 (#15949) introduced a
subtle bug because sortablejs provides both a CJS module and an ES
module that expose different interfaces to CJS require() under
Webpack.  This difference will disappear when we convert
settings_profile_fields to an ES module.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-31 20:16:26 -07:00
Vishnu KS e736bc3ec6 sponsorship: Ensure that all the fields are filled in form. 2020-07-31 10:36:53 -07:00
Gittenburg 4cd23103db message feed: Make message controls more accessible.
We already have single-key shortcuts for all message controls but Zulip
should be usable from the keyboard without having to learn a bunch of
Zulip-specific keyboard shortcuts.
2020-07-30 16:53:00 -07:00
YashRE42 b4891a5841 navbar: Rename tab_bar to message_view_header.
Prior to commit eb4a2b9d4e the center
area of the navbar was based on a structure that appended crumbs or
"tabs" as <li>s, forming a tab_bar and a tab_list.

However, in eb4a2b9d4e we apply a new
style and structure to the navbar which lets go of the convention of
tabs. Hence, we'd like to purge the tab_bar and tab_list labels from
our code base.

We purged tab_list in 1267caf5009118875f47fdafe312880af08024e1.

This commit purges tab_bar, it includes:
- A blanket search and replace of tab_bar with message_view_header.
- Splitting a single line comment in
  tab_bar.js / message_view_header.js.
- The renaming of tab_bar.js to message_view_header.js.
- The renaming of tab_bar.hbs to message_view_header.hbs.
- A blanket search and replace of tab_data with
  message_view_header_data.
- Replacing the single occurrence of tabbar with message_view_header
  (it was within a comment.)
2020-07-30 16:23:13 -07:00
Anders Kaseorg 4466716f6c util: Remove unused escape_regexp function.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 17:40:09 -07:00
Anders Kaseorg 018b4fece4 typeahead_helper: Use _.escapeRegExp in build_highlight_regex.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 17:26:42 -07:00
Anders Kaseorg 1be2cf6d8a recent_topics: Avoid regexps in topic_in_search_results.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 17:26:42 -07:00
Anders Kaseorg 4a26bde4bd alert_words: Replace escape_user_regex with _.escapeRegExp.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 17:26:42 -07:00
Anders Kaseorg 8e79e0e63b emoji: Replace escape_regexp with _.escapeRegExp.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 16:51:24 -07:00
Gittenburg 2d8ed545d4 docs: Set <title> to article title.
Previously the title for all pages of the user and API documentation was
just "Zulip", which does not only bad for UX but also for accessibility.

We were already extracting the title from the Markdown for the og:title
tag, so we just need to set the <title> tag.

Since our documentation fetches pages with Ajax if you have JavaScript
enabled, we also need to save the titles in the article cache.

Part of #15948.
2020-07-29 11:40:39 -07:00
Gittenburg 0706de2305 docs: Make tabbed sections accessible from keyboard.
Part of #15948.
2020-07-29 11:40:39 -07:00
Gittenburg ccaab2d471 docs: Restore link focus outline in sidebar.
Not having a focus outline is very bad for accessibilty.
Browsers have it by default but we completely disabled it for links in
the sidebar in 9955580251.

Showing the outline when selecting a page in the sidebar can be
distracting, so we hide the outline for the highlighted sidebar link.
Since every focusable element however should have a focus outline, we
make the highlighted link unfocusable by setting tabindex=-1 (which also
makes sense since the link to the current page doesn't do anything
anyway).

Part of #15948.
2020-07-29 11:40:39 -07:00
Anders Kaseorg b9fd2a2b37 webpack: Inline getExposeLoaders abstraction.
We only have two of these and don’t intend to add more.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 11:17:24 -07:00
Anders Kaseorg 767ad1d90e debug: Remove debug from globals.
This is used rarely enough that it’s easier to document how to use it
as a non-global than to document the horrifying things that might go
wrong as a global.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 11:17:24 -07:00
Anders Kaseorg 226598edc4 js: Use Handlebars as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-29 11:17:24 -07:00
sahil839 dcc24992b9 streams: Store list of stream ids instead of names for sorting.
We will store list of stream ids to sort streams instead of names.
We have added a compare_function for sorting the list of stream_ids
by comparing stream names.

This change helps us to remove a couple of get_sub calls and using
stream ids instead of name also helps in avoiding bugs caused due
to live update on renaming of stream.
2020-07-28 17:01:17 -07:00
sahil839 ed96758614 stream_data: Add subscribed_stream_ids function.
We add a function subscribed_stream_ids which returns an array
of stream ids of all subscribed streams.

This is a prep commit for changing the logic for sorting streams
to store stream ids instead of names.
2020-07-28 16:57:50 -07:00
Aman Agrawal 08701d0287 recent_topics: Add support for vim keys.
User can now user `j`, `k`, `l`, `h` keys to navigate along
with arrow keys, which is inline with our message navigation
hotkeys.
2020-07-28 16:33:32 -07:00
Aman Agrawal b34d46e00b css: Rename #home id to #message_feed_container. 2020-07-28 16:33:32 -07:00
Aman Agrawal 0859a91b14 hashchange: Go through hashchange to narrow to All messsages.
We should not allow every function who wants to narrow to All
messages to come up with their own method to do so. This
commit makes existing such functions use hashchange library to
do so.

Remove click event on All message button, it already contains
an <a> tag which navigates correctly.
2020-07-28 16:33:32 -07:00
Aman Agrawal 8b29c38e62 info_overlay: Make them overlays from quasi-overlays.
We always use hashchange.go_to_location method now to open the
info_overlay, this makes sure that the url hash are reliable and
hotkeys don't get confused if an overlay is open or not.

We don't want to change hash to "" (this also doesn't navigates
us to 'All messages' view, hence the bug was not noticed.) on
exit of info_overlay.
2020-07-28 16:33:25 -07:00
Gittenburg 87d8a54b91 help: Stop collapsing sidebar sections.
Three reasons:

1. The sliding was disorienting.
2. The collapsing disallowed searching for other pages with Ctrl+F.
3. The collapsing mechanism wasn't accessible (not usable with the
   keyboard / no ARIA tags).

Tweaked by tabbott to center the left sidebar on the selected page.

Part of #15948.
2020-07-28 16:28:58 -07:00
Mohit Gupta 49d0d7f3cc popovers: Export user_sidebar_popped function in popovers.js.
This is a preparatory commit that exports user_sidebar_popped function
so that it can be used in hotkey.js for keyboard navigation support in
popover in right sidebar.
2020-07-28 16:17:18 -07:00
Mohit Gupta 4c8827aef6 popovers: Export popover_items_handle_keyboard from popovers.js.
This commit is a preparotory commit to add support of keyboard
navigation by enabling movement using arrow keys and clicking of items
using enter key. So popover_items_handle_keyboard function so that it
can be resused other places.
2020-07-28 16:12:29 -07:00
Mohit Gupta 6bccadd0b6 popovers: Export focus_first_popover_item function from popovers.js.
This commit is preparatory commit to adding support for keyboard
navigation by focusing om first menu item of all of our popovers. So
exporting focus_first_popover_item so that it can be reused in other
places.
2020-07-28 16:12:11 -07:00
Gittenburg 2367d56f74 integrations: Fix the search input autofocus.
There were two problems preventing the autofocus:

* The focus was triggered at the wrong time.
* transition: all; affected the visibility, making browsers
  abort the focus since the input was still hidden.
2020-07-28 15:17:00 -07:00
Anders Kaseorg e350e57747 js: Fix more incorrectly converted trigger calls.
Commit a9ca5f603b (#15863) incorrectly
converted these too; indexing a jQuery object gives you a DOM element.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 12:43:17 -07:00
Anders Kaseorg a1fec42574 blueslip_stacktrace: Add missing exception handlers.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 11:01:35 -07:00
Anders Kaseorg 0e0baca41e typescript: Enable strictNullChecks.
Let’s do this right from the beginning instead of making a mess to
clean up later.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 11:01:35 -07:00
Anders Kaseorg a43307bc4e js: Use Moment.js as a module.
Note that require("moment") and require("moment-timezone") resolve to
the same thing, but the latter adds timezone support as a side effect.
So I went with the latter in every file where .tz is used.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg 584d6bfa41 stats: Use Plotly.js as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg eb09c137cf click_handlers: Use WinChan as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg 114cc1ec25 settings_profile_fields: Use SortableJS as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg 1d59fc272c js: Use Marked.js as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg bcab7efb37 js: Use XDate as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg c66931d4cd js: Use clipboard.js as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Anders Kaseorg f0021df3d4 people: Use blueimp-md5 as a module.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-28 10:54:35 -07:00
Vinit Singh 1f54918c8a message_controls: Use a template instead of passing html as a string.
This commit adds a handlebar template for the View source/Edit message
button in message controls in the message view.

This change also fixes the broken html titles that were added in
commit fdbab54614, and adds proper
internationalization for the title text.
2020-07-27 11:05:44 -07:00
Ryan Rehman 15c5dadb73 message view: Move live update logic of stream name to `message_store`. 2020-07-27 11:00:31 -07:00
Ryan Rehman 131a1dd54f message view: Move live update logic of avatar url to `message_store`. 2020-07-27 11:00:31 -07:00
Ryan Rehman 06d0dc1ffa message view: Move live update logic of full name to `message_store`.
This is done to decouple our message view related update events
from MessageListData as there are plans to create multiple
MessageListData objects. Instead we update the `stored_messages`
which tracks the complete data for all messages.
2020-07-27 11:00:31 -07:00
Ryan Rehman e85bc853d6 message list: Refactor and update API to include `rerender_view`.
This is a necessary prep commit as our message live update
functions will call this function, outside the MessageList class.
2020-07-27 11:00:31 -07:00
Anders Kaseorg 0b4483c8d2 settings_panel_menu: Convert make_menu to an ES6 class SettingsPanelMenu.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 025f49dbc4 poll_widget: Convert poll_data_holder to an ES6 class PollData.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 2e94914be4 list_cursor: Convert list_cursor to an ES6 class ListCursor.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 9d90ae0e69 fetch_status: Convert FetchStatus to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg a1796325de buddy_list: Convert buddy_list_create to an ES6 class BuddyList.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg a1295936a4 message_list_view: Convert MessageListView to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 8e5574fbe6 message_list_data: Convert MessageListData to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Anders Kaseorg 7249103ab4 message_list: Convert MessageList to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 17:00:05 -07:00
Steve Howell 49db62c240 refactor: Have markdown depend directly on emoji.
Now that emoji is in our shared library, we can
require it directly from markdown without
re-introducing any `window` dependencies.
2020-07-26 16:50:14 -07:00
Anders Kaseorg d2520cd7e0 js: Replace underscore with lodash and remove it from globals.
Tweaked by tabbott to bump PROVISION_VERSION.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 16:12:06 -07:00
Anders Kaseorg 9c7a3cc0f4 compose: Replace accidental usage of underscore for “translation”.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-26 16:08:52 -07:00
Steve Howell 0eb206f97e mobile sharing: Make emoji.js a shared ES6 module.
This is a pretty straightforward conversion.

The bulk of the diff is just changing emoji.js
to ES6 syntax.

There is one little todo that can be deferred
to the next commit--we are now set up to have
markdown.js require emoji.js directly, since
it is no longer on `window`.
2020-07-26 16:07:17 -07:00
Steve Howell a028aa5f8a emoji refactor: Avoid util dep with minor hack.
We copy in a one-line function from util that
will soon be replaced with lodash.
2020-07-26 16:07:17 -07:00
Steve Howell 92ed76e3c1 emoji refactor: Pass in emoji_codes from ui_init.
We don't want emoji.js to depend on a JSON file
(and specifically the location of said JSON file)
when we start sharing our code with mobile.
2020-07-26 16:07:17 -07:00
Steve Howell 3e30a7f66e emoji refactor: Move function higher in file.
This preps for ES6 linting rules.  (And it's
nicer for now, too.)
2020-07-26 16:07:17 -07:00
Steve Howell 979c126b07 emoji refactor: Avoid unnecessary exports.
`default_emoji_aliases` was around for a while, and
the `server_realm_emoji_data` was added really
recently by me (oops).
2020-07-26 16:07:17 -07:00
Steve Howell aedf1660f8 dispatch tests: Make realm_emoji test more robust.
The main thing here is that we check that the
actual data got put into our data structures.

(In general we want to move away from stubbing
data modules; any place where we stub data modules
is a relic of earlier days, where we were just
trying to set the bar for 100% line coverage,
even though some of the original coverage was
quite shallow.)

I also use real stubs instead of noops for
the calls out to UI-oriented modules.

In passing I tweak some comments in the actual
dispatch code.
2020-07-26 16:07:17 -07:00
Steve Howell 69c082e2f6 refactor: Have emoji_picker pull from emoji.
This makes it so that the authoritative holder
of all emoji data is emoji.js, and all our
UI components that need emoji data consistently
pull data from emoji.js as needed.

Or to put it another way, we no longer need the
dispatch module to know that emoji_picker is
coupled to emoji precisely by the active_realm_emojis
data; it can now make fewer assumptions.
2020-07-26 16:07:17 -07:00
Steve Howell 6e9d9b42ca refactor: Rename func to emoji_picker.rebuild_catalog. 2020-07-26 16:07:17 -07:00
Steve Howell ef40767edf emoji: Promote blueslip.error to caller.
The only function that called blueslip had only
one caller, and we are trying to get emoji.js
ready for ES6.
2020-07-26 16:07:17 -07:00
Anders Kaseorg b900e38dc6 topic_list: Convert widget to an ES6 class TopicListWidget.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:58:22 -07:00
Anders Kaseorg 4517c48de2 todo_widget: Convert task_data_holder to an ES6 class TaskData.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:58:22 -07:00
Anders Kaseorg c5e397d469 tictactoe_widget: Convert tictactoe_data_holder to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:58:22 -07:00
Anders Kaseorg cd913b7ebc sent_messages: Convert message_state to an ES6 class MessageState.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:56:28 -07:00
Anders Kaseorg daf5a78e98 search_suggestion: Convert make_attacher to an ES6 class Attacher.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:56:28 -07:00
Anders Kaseorg f96bd3839c user_search: Convert user_search to an ES6 class UserSearch.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 41778d81d2 unread: Convert unread_topic_counter to an ES6 class UnreadTopicCounter.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg e5ff78e893 unread: Convert unread_pm_counter to an ES6 class UnreadPMCounter.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 44053eba3f unread: Convert make_bucketer to an ES6 class Bucketer.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 557e88df77 pm_conversations: Convert recent to an ES6 class RecentPrivateMessages.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 2bf6731f5a stream_topic_history: Convert per_stream_history to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg e47fd521e3 stream_list: Convert build_stream_sidebar_row to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 2aae92b6e3 stream_list: Convert stream_sidebar to an ES6 class StreamSidebar.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 0ad8da139e stream_data: Convert BinaryDict to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 30e4b51731 stream_create: Convert stream_name_error to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg 3319848768 stream_create: Convert stream_subscription_error to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:50:23 -07:00
Anders Kaseorg ba4ef5bf90 blueslip: Convert Logger to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:40:42 -07:00
Anders Kaseorg 58c84940f4 blueslip: Convert BlueslipError to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:40:42 -07:00
Anders Kaseorg abe52e2191 filter: Convert Filter to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:40:42 -07:00
Anders Kaseorg aee95ecf7e util: Convert CachedValue to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:40:42 -07:00
Anders Kaseorg 4ad00c1aea lightbox_canvas: Remove old-style window.onload handler.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:32:53 -07:00
Anders Kaseorg fc21417d67 lightbox_canvas: Convert LightboxCanvas to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:32:53 -07:00
Anders Kaseorg d5a0ee612f lightbox_canvas: Make parameter type error fatal.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:32:53 -07:00
Anders Kaseorg c4024e30c2 debug: Convert IterationProfiler to an ES6 class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 16:32:53 -07:00
Gittenburg 8f99820120 composebox_typeahead: Remove deprecated workaround.
The Chromium bug[1] was fixed in 2015.

[1]: https://bugs.chromium.org/p/chromium/issues/detail?id=32865
2020-07-24 15:31:26 -07:00
Anders Kaseorg 5f0bd44d58 notifications: Fix incorrectly converted focus method call.
Commit a9ca5f603b (#15863) incorrectly
converted this; window is quite obviously a DOM element, not a jQuery
element.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 14:48:47 -07:00
Anders Kaseorg f0c4cc9e46 js: Fix new import/order errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 13:04:07 -07:00
Steve Howell f5bc454b3a emoji: Remove dependence on page_params.
This sets us up to make emoji a leaf module.
2020-07-24 12:57:52 -07:00
Steve Howell 5280b87f19 emoji refactor: Let emoji.js own the data.
We now only use page_params.realm_emoji at
intialization time, and then settings_emoji
gets the data from emoji.js.
2020-07-24 12:57:52 -07:00
Steve Howell d11c6686a1 minor: Remove parameter to populate_emoji.
This is an easy prep step to help out phase
out page_params.realm_emoji.

All callers pass in what's effectively
page_params.realm_emoji.  (The dispatch
code does it indirectly.)
2020-07-24 12:57:52 -07:00
Steve Howell cc31403112 mobile sharing: Move fenced_code.js to shared/js.
We also take fenced_code out of the global namespace,
since it only requires katex and underscore.

And we fix the exports to be ES6 style.
2020-07-24 12:57:52 -07:00
Anders Kaseorg ea7effbe8a recent_topics: Skip non-stream messages in update_topics_of_message_ids.
Fixes an exception when deleting a private message, introduced by
commit 5d5434ec2f (#15803).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 10:58:21 -07:00
Vinit Singh fdbab54614 i18n: Translate Edit/View Source button's hmtl tooltip text.
This commit tags the html tooltip text for internationalization.
2020-07-24 10:54:34 -07:00
Vishnu KS 3ec64b6092 team: Include users without an associated GitHub profile.
Including anon=1 in API requests will retrieve all contributors
of the repo. If there is no asscoiated GitHub account present for
the commits then the email and name of the author mentioned in
commit messages is returned.
2020-07-24 10:51:47 -07:00
Anders Kaseorg e3b3df328d eslint: Replace sort-imports with import/order.
import/order sorts require() calls as well as import statements.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 09:42:56 -07:00
Anders Kaseorg 40be4df57a lint: Format JSON files with Prettier.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-24 09:42:56 -07:00
Gittenburg f9459bba12 upload: Do not open compose box when editing.
Previously editing a message and uploading a file in
the edit textarea opened the message compose box.

Fixes #15890.
2020-07-23 11:29:32 -07:00
Anders Kaseorg e123f8f723 subs: Fix set_muted parameter order.
The status_element parameter is optional, and the other caller in
stream_popover.js does not provide it.  This fixes a regression in
commit e6a66063a9 (#15868).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-23 11:22:47 -07:00
Vishnu KS 6b9e7a4022 team: Rename contrib_total_commits to calculate_total_commits. 2020-07-23 10:22:28 -07:00
Vishnu KS 9e0ff58a6d team: Rename contrib to contributors in page_params. 2020-07-23 10:22:28 -07:00
Vishnu KS 2190dbd4b0 team: Map repo name to tab name in frontend.
fetch-contributor-data's job is to fetch the data. How the data
is presented in frontend is something it don't have to know about.
2020-07-23 10:22:28 -07:00
Vishnu KS fe9b700fab team: Use a better API for getting contributor data. 2020-07-23 10:22:28 -07:00
Ryan Rehman 6a245d6d93 minor: Refactor `set_up_typeahead_on_pills` function interface.
This is a prep commit which passes the `update_func` and `source`
data through an object. This will be helpful as there are plans
to pass furthur information to the function (i.e. whether we should
allow creating pills from streams and/or user-groups).
2020-07-22 17:00:34 -07:00
Anders Kaseorg bc7bec9a95 landing-page: Clean up ready callbacks.
jQuery’s $(callback) already checks document.readyState to decide
whether to run the callback immediately (that’s like, jQuery’s entire
value proposition).  We probably don’t need ready callbacks at all
anymore thanks to <script defer>, but that’s a larger change.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 15:48:33 -07:00
Anders Kaseorg e9df82ac31 landing-page: Remove onunload hack.
This was there for the page transition animation that was removed in
commit a0dacea811 (#9334).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 15:48:33 -07:00
Anders Kaseorg 498fe285fa js: Access ‘disabled’ as a property, not an attribute.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg 6800c3363f message_edit: Use the jQuery css method for style, not removeAttr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg a2a5871088 js: Replace deprecated $.trim method.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg 611f2a4321 js: Replace deprecated $.unbind method.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg 7ba3a26cd5 search: Replace deprecated jQuery event trigger shorthand.
$.fn.typeahead, on the other hand, returns the jQuery object back (not
the Typeahead object, which also happens to have a select method), so
this should be converted.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-22 12:20:23 -07:00
Anders Kaseorg a8bef38151 js: Fix incorrectly converted blur, click, focus method calls.
Commit a9ca5f603b (#15863) incorrectly
converted these.  e.target is a DOM element, not a jQuery element;
likewise for the elem parameter of activate_element.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 20:01:57 -07:00
Anders Kaseorg 2d8cab2cee stream_sidebar_actions: Rename toggle_home to toggle_stream_muted.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 18:26:20 -07:00
Anders Kaseorg e6a66063a9 stream_edit: Restore keyboard accessibility to checkboxes.
Listen to change events from the checkbox and pay attention to its
actual value, rather than simulating it by toggling booleans on click
events.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 18:26:20 -07:00
Anders Kaseorg 11bde22cb3 ui_util: Fix incorrectly converted focus method call.
Commit a9ca5f603b (#15863) incorrectly
converted this; el is a DOM element, not a jQuery element.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 18:26:05 -07:00
Gittenburg 45e19dd6b9 emoji: Rename :slight_smile: to 😄.
Zulip converts :) to the 1F642 Unicode emoji and promotes the same emoji
in the popular section of the emoji picker.

Previously Zulip has labeled 1F642 as "slight smile". While that name
conforms to the Unicode standard (which describes the code point as
SLIGHTLY SMILING FACE), it didn't match our use case of the emoji.

If a user types :) or selects the first smile in the emoji picker they
probably mean to express a regular "smile" and not a "slight smile",
which raises the question why they are only smiling slightly.

This commit relabels 1F642 as 😄 and our previous 😄 263A as
:smiling_face:. Note that 263A looks different in our three supported
emoji sets, so it is not suited to be our "default smile".

This change does not require a migration since our emoji system stores
both unicode points and names and handles name changes transparently.
2020-07-21 16:49:54 -07:00
jagansivam28 5f874a51f7 upload widget: Rename image upload widget upload text CSS class.
Previously, image upload widget delete text CSS class name was
`settings-page-upload-text`.
We can change the CSS class name to `image-upload-text`
so that the name can be more generic.
2020-07-21 16:19:21 -07:00
jagansivam28 ad0ff10598 upload widget: Rename image upload widget delete text CSS class.
Previously, image upload widget delete text CSS class name was
`settings-page-delete-text`.
We can change the CSS class name to `image-delete-text`
so that the name can be more generic.
2020-07-21 16:19:21 -07:00
jagansivam28 90cb72b103 upload widget: Rename image upload widget delete button CSS class.
Previously, image upload widget delete button CSS class name was
`settings-page-delete-button`.
We can change the CSS class name to `image-delete-button`
so that the name can be more generic.
2020-07-21 16:19:20 -07:00
jagansivam28 1702f7f802 upload widget: Change image upload widget CSS class name.
Previously, image upload widget CSS class name was
`avatar-icon-logo-settings`  it is not relevant to the widget so
we can change the CSS class name to `image_upload_widget`
so that the name can be more generic.
2020-07-21 16:13:23 -07:00
Tim Abbott 51d4d210d4 stream_edit: Use preventDefault and stopPropagation.
We should be using these patterns consistently in our click handlers.
2020-07-21 13:32:31 -07:00
SiddharthVarshney fb3484df52 stream-settings: Change checkbox UI.
These checkboxes will now be more consistent
in design as we have in other part of the UI.

e.preventDefault() is added inside the
stream_is_muted_clicked function will disable
the default checkbox and make sure click event
come from only <span> part of the checkbox.
2020-07-21 13:27:21 -07:00
Anders Kaseorg 96dcc0ce6e js: Use ES6 object literal shorthand syntax.
Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:42:22 -07:00
Tim Abbott 9b8255d741 compose: Rename blur_textarea to better describe its purpose.
This blurs all the input elements in the compose area, not just the
textarea for the message body.
2020-07-21 12:08:40 -07:00
Gittenburg ed5a56ce53 composebox: Blur PM recipient input after close.
Previously the private_message_recipient input remained focused after
closing the composebox with Escape. On Firefox this resulted in it
gobbling up all further keyboard shortcuts until you clicked
somewhere. On Chromium this bug didn't occur because it automatically
blurs hidden inputs.

Introduced in 3a1bf04a56.

Fixes #15849.
2020-07-21 12:02:31 -07:00
Anders Kaseorg a9ca5f603b js: Replace deprecated jQuery event trigger shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 4e42137bd9 js: Replace deprecated jQuery event handler shorthand.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 97feea42a1 js: Replace deprecated jQuery.fn.hover.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Anders Kaseorg 25883d7827 copy_and_paste: Replace deprecated jQuery.fn.bind.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-21 12:01:26 -07:00
Ryan Rehman 1696c9ac20 ui: Fix loading spinner glitch.
On calling `loading.make_indicator` for the second
time or more no spinner is being displayed.

This bug can be viewed on visiting a `near: 1` narrow
and the spinner for the newer messages is displayed
only once (i.e. the first time it is rendered), while
the logo is displayed every time.

This happens because `loading.destroy_indicator` sets
the css of that container to display: "none". This can
be removed as we are emptying the container just above.

Introduced in 953d475274.
2020-07-20 11:00:37 -07:00
Anders Kaseorg b65d2e063d js: Reformat with Prettier.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:25 -07:00
Anders Kaseorg 8046b6477a js: Remove extra consecutive spaces.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:25 -07:00
Anders Kaseorg 883e2fd325 js: Remove inner spacing from object literals.
We’re configuring Prettier with bracketSpacing: false.  Generated by
ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:25 -07:00
Anders Kaseorg a20c12366f js: Use inside variant of IIFE wrappers.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:25 -07:00
Anders Kaseorg 6924d501bc js: Indent case clauses in switch statements.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:25 -07:00
Anders Kaseorg f3726db89a js: Normalize strings to double quotes.
Prettier would do this anyway, but it’s separated out for a more
reviewable diff.  Generated by ESLint.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:31:24 -07:00
Anders Kaseorg 67773bc834 support: Move eslint-disable comment to Prettier-compatible position.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:30:52 -07:00
Anders Kaseorg 569b38fe34 js: Fix no-useless-escape errors.
Generated manually, since ESLint doesn’t have a fixer for this.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-17 14:30:52 -07:00
Gittenburg e15189b20c click_handlers: Don't focus links on middle / right click. 2020-07-16 10:50:40 +02:00
Anders Kaseorg ffdbf1afec favicon: Replace favicon PM indicator with red dot.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-16 01:37:08 -07:00
Anders Kaseorg c2f9db4602 logo: Update Zulip logo.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-16 01:37:08 -07:00
Gittenburg c42c2a9a22 click_handlers: Don't focus elements on dragstart.
Chrome focuses elements when you start dragging them,
which can confuse users because of our focus outline.
2020-07-16 01:32:26 -07:00
Rohitt Vashishtha ea1c178305 markdown: Format spoilers for desktop notifications.
We hide the spoiler content in browser/desktop notifications.

Note: its not worth adding zjquery tests for this bit of code because
the tests do not operate on the actual data and are likely to get stale
if we change the syntax for spoilers.
2020-07-15 23:30:28 -07:00
Anders Kaseorg c080b4da06 favicon: Remove ancient browser workarounds.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-15 20:56:58 -07:00
YashRE42 78d511fd03 navbar: Clean up implementation of tab_bar.narrow_description hover.
This handler adds a neat little effect whereby hovering over the
clickable region to open the navbar triggers the search_icon hover
effect and is a neat little visual cue about what happens onClick.

The previous implementation was slightly messy because it fetched the
color and applied it via ".css(". This commit cleans it up by creating
and using the class "search_icon_hover_highlight" instead. We also
make the selectors more specific, ensuring they target children of
"#tab_bar", this was so because it was reasonable to expect someone to
define eg `search_closed` elsewhere and we wanted to prevent bugs when
that happened.
2020-07-15 18:56:06 -07:00
Tim Abbott a785a74fd0 timerender: Fix use of page_params.timezone.
The page_params.timezone feature is perhaps a misfeature, but
importantly it's not what is used to display the time in the message
feed (it's mainly used to show others your timezone).

Given that reality, we shouldn't use it for a feature whose whole
purpose is to display the time using the same timezone we use in the
message feed.

Fixes #15790.
2020-07-15 17:01:42 -07:00
Sebastian Morr bb12e407d2 timestamp: Observe user's 24-hour clock setting.
Fixes #15791.
2020-07-15 17:01:42 -07:00
Aman Agrawal 5d5434ec2f recent_topics: Update topics post message deletion.
Delete stored topic data in `recent_senders` and `recent_topics`
about the message's topics and re-render them. The process is similar
to topic editing. See `recent_senders.process_topic_edit` for
logical details.
2020-07-15 12:35:24 -07:00
Tim Abbott 35023824b0 condense: Add missing stopPropagation/preventDefault.
This fixes an issue where an open compose box would close when
clicking to expand a condensed message.

Fixes #15808.
2020-07-15 10:42:22 -07:00
Aman Agrawal 19b7ef3888 list_render: Use simplebar container to track scroll event.
We have changed our all instances of list_render to use
simplebar and thus, we will now use simplebar container
to track scroll event for all the lists created by
list_render.

This fixes the bug of new subscribers not rendering on
scrolling at the end of subscriber list in stream settings
and similar bug in some other lists also.

This commit also removes scroll_util.get_list_scrolling_container
function as this is no longer used.

Fixes #15637.
2020-07-15 10:16:56 -07:00
sahil839 d41f66a917 muted_topics: Rerender list only if modal is opened and section is loaded.
We should rernder the muted topics list in settings only if the settings
modal is opened and the muted topics section is loaded.
2020-07-15 10:16:56 -07:00
sahil839 6259456df1 settings: Do not use list_render for stream specific notification settings.
We do not need to use list_render for displaying list of streams specific
notification settings, as this is not scrollable and we do not provide
option to sort or filter this list as well.

After this change, all our list_render instances will be using simplebar
and we can change the code accordingly to fix the behaviour of scrolling.
2020-07-15 10:16:56 -07:00
Aman Agrawal c4bbdf040e recent_topics: Fix search clear icon overflowing in next line.
Sometimes, the clear icon overflows on the next line on specific
widths. This makes sure it never happens by wrapping them in a
block.
2020-07-15 10:00:52 -07:00
Gittenburg 953d475274 settings: Fix saving indicator glitch.
jQuery's fadeOut() sets display: none using inline CSS.
This was overriden by .alert-notification since it used !important
to override the display: block set in loading.js.  Removing the latter
allows us to remove the !important, and doesn't seem to break anything.

Fixes #15759.
2020-07-14 16:29:39 -07:00
Anders Kaseorg f1d475206e search: Fix ESLint prefer-arrow-callback error.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-07-14 12:38:25 -07:00
Tim Abbott cb54e30832 Revert "search: Fix blur event handler for `search_query_box`."
This reverts commit 63643c9d9d.

As the commit mentions, it makes a UI change for legacy search which
has largely been considered a regression.  We've been running with
this reverted in zulip.com essentially since it was first merged.
2020-07-14 12:26:28 -07:00
Tim Abbott 42d601e214 help: Fix exception with invalid fragment causing bogus extra scrollbars.
Apparently, our scrollbar logic crashed with an invalid URL fragment
(hash), which resulted in initialization not completing and thus the
logic failing.

In my view the root issue here is that we're not doing a good job of
catching JavaScript exceptions in portico pages.

Fixes #15706.
2020-07-14 12:19:52 -07:00
Gittenburg bc1f2fa80e reactions: Add back missing e.stopPropagation().
In 42f20e81be I fixed an edge case but
also accidentally made clicking on reactions open the compose box.

This commit adds back the e.stopPropagation(); and explicitly hides the
emoji picker popover, to address the inconsistency fixed in the previous
commit.
2020-07-14 00:38:36 -07:00
SiddharthVarshney d0fd0cae3f message-controls: Use <i> tag for starred message icon.
Throughout the codebase we use <i> tag for icons.
This commit will add <i> tag inside the starred message
div and fa classes are now used with this <i> tag.

The starred message div is now consistent with other
message_controls divs.

Tweaked by tabbott to use the name star_container for better
readability.
2020-07-13 15:59:12 -07:00
YashRE42 ae7ff04fe6 navbar: Purge tab_list label from code base.
Prior to commit eb4a2b9d4e the center
area of the navbar was based on a structure that appended crumbs or
"tabs" as <li>s, forming a tab_bar and a tab_list.

However, in eb4a2b9d4e we apply a new
style and structure to the navbar which lets go of the convention of
tabs. Hence, we'd like to purge the tab_bar and tab_list labels from
our code base.

It would have been nicer if we could simply purge tab_bar from the
codebase and rename "#tab_list" so that we have an anchor and wrapper
structure in the html, but dropping the float: left on tab_bar causes
some confusing problems such as causing the horizontal border to
disappear and the search_box to shift out of its intended position and
so its simpler to get rid of tab_list from our code base first.

This commit:
- Removes the #tab_list wrapper div from tab_bar.hbs.
- Removes any #tab_list selectors from night_mode.scss so that they
  simply target based on "#tab_bar" instead of "#tab_bar #tab_list".
- Removes tab_list selectors from zulip.scss, so that #tab_list
  attributes now apply to the #tab_bar, in the process we drop the
  duplicated width property and reorder the attributes.
- Replaces all mention of #tab_list with #tab_bar in JS files.
2020-07-13 15:39:36 -07:00
YashRE42 25765faf58 navbar: Live update sub_count.
Previously, the navbar sub count would not live update as users
subscribed or unsubscribed, this commit adds the relevant calls in
stream events.

It would have been better to just have a single call within
server_events_dispatch but it seems difficult due to the way of
mark_subscribed and mark_unsubscribed are structured.

stream_events.mark_unsubscribed conditionally calls
subs.update_settings_for_unsubscribed which calls
subs.rerender_subscriptions_settings and as such handles the update
for the subscriptions modal on its own. Hence, we simply rely on the
stream_data.update_calculated_fields to ensure the subscriber counts
are updated and make a call to
tab_bar.maybe_rerender_title_area_for_stream(sub).

stream_events.mark_subscribed is similar.
2020-07-13 15:38:15 -07:00
YashRE42 0667925c93 refactor: Extract maybe_rerender_title_area_for_stream(modified_sub).
Previously, we had the lines from this block being duplicated in all
the stream update paths, which is a little brittle.

Hence, in this commit, we extract it out with a comment explaining
what it does and call it in all the duplicated spots.
2020-07-13 15:36:53 -07:00
sahil839 fff7fe21cb stream_edit: Use narrow_state.stream_sub instead of narrow_state.stream.
We use narrow_state.stream_sub instead of narrow_state.stream to directly
get the sub object instead of stream name, while subscribing to a stream
from the stream narrow.
2020-07-13 13:09:17 -07:00
sahil839 a0d2c7db16 stream_data: Modify is_user_subscribed to use stream id.
This commit changes stream_data.is_user_subscribed to use stream id
instead of stream name.
We are using stream ids so that we can avoid bugs related to live
update after stream rename.
2020-07-13 13:09:17 -07:00
Ryan Rehman 14c869d803 message send: Update failed message ui on re-send success.
We have logic in place to update the ui for re-sending messages
on recieving the acknowledgement from the server on that API call.

However, if the acknowledgement is recieved through the get events
request before the `on_success` of `resend_message`, the message
gets re-rendered allowing the failed message actions to be clickable.

Now, we update the ".message_failed" ui for both cases. This helps
in preventing the "Trying to get local_id from row that has reified
message id" exception.

Fixes #15351.
2020-07-13 12:29:33 -07:00
Aman Agrawal 55f80a2502 recent_topics: Don't render topic of deactivatedstreams.
Fixes error when trying to render topic of a deactivated stream in
the Recent Topics widget.
2020-07-13 11:22:43 -07:00
Aman Agrawal c32f27a05d hash_util: Show error if url is invalid.
For urls we cannot handle, we inform user via a nice
error message.

See comment in decodeHashComponent for some of the cases it
fixes for us.
2020-07-10 11:01:31 -07:00
Aman Agrawal f97d35ebd2 ui_report: Use fadeOut to hide error.
fadeTo is not a good method to hide elements since it sets
opacity to 0 in which the element still can consume space and
be clickable. We set it's display to None using fadeOut method.

Also, allow this method to be called via ui_report.error.
2020-07-10 11:01:31 -07:00
sahil839 67ea4bd937 stream: Fix incorrect dispaly of stream notifications settings.
The stream notification settings checkboxes were not checked
even when the notifications were turned on for the stream.
This was happening because we were passing stream name to
receives_notifications instead of stream id.

This commit fixes the bug by passing stream id to
receives_notifications. This change should have been done
in f3604fb while refactoring receives_notifications to use
stream id instead of name.
2020-07-09 12:46:44 -07:00
Vinit Singh bf31d92fa7 emoji_picker: Fix keys not working if search yields no results.
As a consequence of commit 1113589b9d the backspace key and some other
keys did not respond if the search yielded no results.
This change fixes that bug.
2020-07-09 11:55:13 -07:00
Vinit Singh 8b54cce833 emoji_picker: Improve emoji picker search results.
This sorts the emoji picker's search results using the same
`typehead.sort_emojis` function as the compose typehead.

Resolves #15694.
2020-07-08 13:47:03 -07:00
Gittenburg 6e5fb85ade refactor: Improve method name in emoji_picker. 2020-07-08 13:25:49 -07:00