Commit Graph

6997 Commits

Author SHA1 Message Date
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