Commit Graph

7208 Commits

Author SHA1 Message Date
Anders Kaseorg 8d44cd78ec eslint: Fix unicorn/no-this-assignment.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg a679ee12f3 eslint: Fix unicorn/prefer-regexp-test.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg a77120279d eslint: Fix unicorn/prefer-default-parameters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 2e501c8667 eslint: Fix unicorn/consistent-destructuring.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 6cd694b8e3 eslint: Fix unicorn/no-array-callback-reference.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 552f4e3d22 eslint: Fix unicorn/no-array-for-each.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg aa7df21265 js: Convert _.chain to array methods.
Signed-off-by: Anders Kaseorg <anders@zulipchat.com>
2021-01-25 14:53:19 -08:00
Anders Kaseorg 1fd4762063 topic_generator: Remove overengineering.
topic_generator previously included an entire lazy generator
combinator library that was used four times.  These straightforward
equivalent loops might not be as fun but they are way simpler.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2021-01-25 14:53:19 -08:00
Aman Agrawal f8aea9aecb postcss_vars: Use underscore to follow better naming convention. 2021-01-25 14:49:32 -08:00
Aman Agrawal adb860f75b css_variables: Add specific breakpoints for mobile devices. 2021-01-25 14:49:32 -08:00
Aman Agrawal e941ee4a15 media_query: Use 767px instead of 775px as md breakpoint.
We use 767px for hiding left column.

The components changed here were tested to be working fine.

This change is not likely to introduce any regression as the
calculations in the components here were not dependent upon the
breakpoint being at 775px.
2021-01-25 14:49:32 -08:00
Aman Agrawal 5a8150e34b media_query: Use 1199px instead of 1165px as xl breakpoint.
We use 1199px for hiding right column.

The components changed here were tested to be working fine.

This change is not likely to introduce any regression as the
calculations in the components here were not dependent upon the
breakpoint being at 1165px.
2021-01-25 14:49:32 -08:00
Aman Agrawal 599b86241f postcss-simple-vars: Add media query breakpoint variables. 2021-01-25 14:49:32 -08:00
ganpa b1f4c98730 custom_emojis: Fix unresponsiveness after submitting without a name.
While adding custom emojis, when a user clicks on the submit
button without providing a name to the emoji, the submit button
becomes unresponsive. This commit fixes that.

Fixes #16921
2021-01-21 15:51:09 -08:00
Steve Howell 2382fa7a19 refactor: Pass stream_ids to is_subscriber_subset.
After this change all peer_data functions consistently
use stream_id rather than some "sub" object whose
data type is complicated by all sort of fields that
don't really concern how we track subscribers.
2021-01-17 10:40:17 -08:00
Steve Howell 355f44ef13 refactor: Only pass stream_id for set_subscribers.
The goal here is to make all our peer_data functions
basically work in id space.  Passing a full `sub`
to these functions is a legacy of when subscriber
info was attached to a full stream "sub" object,
but we don't care about anything sub-related
(color, description, name, etc.) when we are
dealing with subscriptions.

When callers pass in stream_id, you can be more
confident in a quick skim of the code that we're
not mutating anything in the "sub".
2021-01-17 10:40:17 -08:00
Steve Howell 6cc880c858 refactor: Extract peer_data.js.
This de-clutters stream_data a bit.  Since our
peer data is our biggest performance concern,
I want to contain any optimizations to a fairly
well-focused module.

The name `peer_data` is a bit of a compromise,
since we already have `subs.js` and we use
`sub` as a variable name for stream records
throughout our code, but it's consistent with
our event nomenclature (peer/add, peer/remove)
and it's short while still being fairly easy
to find with grep.
2021-01-17 10:40:17 -08:00
Steve Howell 58dcc70a35 refactor: Remove subscribers from stream_data subs.
This sets us up to use better system-wide data structures
for tracking subscribers.

Basically, instead of storing subscriber data on the
"sub" objects in stream_data.js, we instead have a
parallel data structure called stream_subscribers.

We also have stream_create, stream_edit, and friends
use helper functions rather than accessing
sub.subscribers directly.
2021-01-17 10:40:17 -08:00
Steve Howell a175ce65cf minor: Inline add_sub into create_sub_from_server_data.
We now use add_sub only in tests.

The line to defensively initialize subscribers does
not get copied from add_sub, since we know that
create_sub_from_server_data always initializes
subscribers via set_subscribers.
2021-01-17 10:40:17 -08:00
Anders Kaseorg df9e40491d ui_init: Unnest an if statement.
This is equivalent because we cannot have delta < 0 && delta > 0.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-22 16:44:46 -08:00
Anders Kaseorg d72f7d1d69 eslint: Fix unicorn/prefer-number-properties.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v24.0.0/docs/rules/prefer-number-properties.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-22 16:14:28 -08:00
Anders Kaseorg dd8e14d3e6 eslint: Fix unicorn/prefer-date-now.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v24.0.0/docs/rules/prefer-date-now.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-22 16:14:28 -08:00
Anders Kaseorg 2f80415756 eslint: Fix unicorn/no-lonely-if.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v24.0.0/docs/rules/no-lonely-if.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-22 16:14:28 -08:00
Anders Kaseorg 6acbcec39d eslint: Fix unicorn/error-message.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/v24.0.0/docs/rules/error-message.md

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-22 16:14:28 -08:00
Anders Kaseorg 0c4239e387 js: Convert Object.assign({…}, …) to spread syntax.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-21 15:37:36 -08:00
Pranav2612000 38a0a4f62f lightbox: Fix images not opening after navigating through back button.
After exiting lightbox view by pressing the browser back button,
future requests to open images were failing. This was because the
handler called on back button press- close_for_hash_change() was not
closing the currently open overlays gracefully. This commit fixes the
problem by calling the close_handler function inside
close_for_hash_change().

Fixes #16726
2020-12-18 12:57:20 -08:00
Anders Kaseorg 40b8943505 eslint: Remove unused exemptions to no-unused-vars rule.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-10 19:57:53 -08:00
Anders Kaseorg 2c5e9f65f8 eslint: Fix new-cap errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-10 19:52:22 -08:00
Anders Kaseorg c7a6902fe3 eslint: Remove and prohibit unused eslint-disable directives.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-10 18:08:45 -08:00
Anders Kaseorg 984a5bb737 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-09 23:07:38 -08:00
Anders Kaseorg bfd9999cf8 desktop_integration: Handle logout et al. events from desktop app.
I added these hooks in Zulip Desktop 5.5.0; handling these events in
the frontend will let us remove the janky desktop-side fallback code
that uses fake click events on menu items with specific indexes.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-12-08 16:39:17 -08:00
Camelid b559da68bf
markdown: Default to 2018 edition for Rust Playground.
rustc's default edition is 2015 to preserve backwards compatibility, and
the playground appears to follow this scheme. However, 2018 edition Rust
is the current standard and is the default that Cargo uses when
initializing new projects. It adds support for various features,
including async/await and a new module system. As a result, I think
Zulip should default to 2018 edition when linking to the playground.
Users can always select a different edition once in the playground if
they would like.
2020-11-29 18:09:10 -08:00
ryanreh99 7562886cef ui: Hide loading indicators for non-existant narrows.
We were still displaying the loading spinner
even after displaying the error text, which
was confusing as we do not try to fetch again.
This fixes it.
2020-11-29 18:07:56 -08:00
Tim Abbott d3ebfce4ae message_fetch: Refactor logic for constructing data.narrow.
This refactoring should have no functional effect for any call points,
but makes the function behave more naturally.  The comments explain
the situation, but specifically:

* There's the page_params.narrow hack that affects both narrows and
  home_msg_list.

* There's the shared data for home_msg_list and all_msg_list that
  requires we modify the query from home_msg_list.data.public_operators().

And otherwise the logic should just use the operators associated with
the message_list.data object (allowing us to remove the force_fetch
hack added in the last commit).

Hopefully in some future refactoring, we'll be able to migrate those
hacks to live in the Filter object construction and eliminate this
block of conditionals entirely.
2020-11-20 11:50:01 -08:00
Ryan Rehman ec3df8cb4f message fetch: Pass narrow param for recent topics message list.
In commit ebea17b9a6,
we added an extra fetch to get accurate data for the top
items in recent topics table.
But the `narrow` parameter wasn't passed to the endpoint,
this resulted in fetching the user's overall message
history including the muted streams/topics which aren't
required by the recent topics table.

`operators` can be replaced as we set the same value for
the `narrow_state` module and the narrowed message list's
filter, when activating the narrow.
2020-11-20 11:47:46 -08:00
ryanreh99 e5779c1ca0 message events: Refactor `reify_message_id` codepath.
The changes made in this commit are as follows:

* The `remove_messages` is moved to the `message_events.js`
  file from `ui.js`.

* We refactor `MessageListData.change_message_id` to no
  longer require an `opts` parameter as this function
  just returns whether we need to rerender or not.

  The blueslip error block can be removed since we made
  the change to no long defer the data updates in
  commit 3b5ba6b2c1,
  this case can no longer occur.
2020-11-16 17:23:15 -08:00
ryanreh99 59e5f2d8fc message events: Refactor `remove_and_rerender` codepath.
The changes made in this commit are as follows:

* We remove the now unused `ui.find_message` which was added
  in commit 1666403850.

* We change the function paramter to now accept message ids
  instead of messages to eliminate redundant message ids to
  message convertion as only the id is required.

* The remove method in MessageListData did not remove the
  messages from the hash, it removed only from the items,
  this fixes it.

* This commit also fixes a bug where messages are not added
  to the current message list if an event is recieved where
  messages are moved to this current narrow.
  Only the message removal logic was present, which has been
  refactored in this commit.
2020-11-16 17:23:15 -08:00
YashRE42 d9b14b5b74 widgetize: Don't warn for deleted tictactoe widget. 2020-11-09 06:01:39 -05:00
Suyash Vardhan Mathur 6b48fb3c08 streams: Fix live update of stream name when renamed.
Currently, the Stream Name change isn't reflected in the streams
sidebar when a stream is renamed if the order of streams in the
sidebar remains unchanged, because the optimization to avoid
rerendering when nothing changes about the order prevents the
rerendering code from running.

We fix by this adding a flag in build_stream_list and
update_streams_sidebar functions to force a rerender, and pass that
when a stream is renamed.

Fixes #16026.
2020-11-05 11:45:44 -08:00
Tim Abbott ebea17b9a6 message_fetch: Add an extra fetch for Recent Topics.
The comment explains the problem statement in some detail, but
basically this algorithm ensures that the top items in "Recent Topics"
on page load are always the very most recent topics the user has
received messages in (well, ignoring muted topics in this iteration).
2020-11-05 10:38:45 -08:00
YashRE42 967efc32d2 widgets: Remove tictactoe example widget.
Steve asked me to remove this, since the tictactoe game was always
intended as a proof of concept. Now that we have poll and todo
widgets, the sample code for tictactoe has much less value.

We replace the content and type in test_widgets.py to maintain
coverage.
2020-11-03 14:46:39 -08:00
Aman Agrawal 87cdd8433d home: Allow logged out user through home.
We allow user to load webapp without log-in. This is only
be enabled for developed purposes now. Production setups will
see no changes.
2020-11-02 17:07:12 -08:00
YashRE42 13f95dfc2b composebox_typeahead: Refactor content_highlighter to use switch/case.
This refactor should make no functional changes.
2020-11-02 16:50:51 -08:00
YashRE42 f843c2285d composebox_typeahead: Use switch case for content_typeahead_selected.
This refactor should make no functional changes.
2020-11-02 16:50:51 -08:00
aniketsonu 28aaf24a61 invite: Add Copy-to-Clipboard button for multiuse links.
A convenient copy-to-clipboard button was added in the Invite users to
Zulip modal, to make it slightly more convenient to share the
generated links.

The formatting is extracted to a template to make i18n and variable
substitution simpler.

Tweaked by tabbott significantly to simplify JS, HTML, and CSS.

Fixes #16442.
2020-11-02 15:34:50 -08:00
Aman Agrawal 22e598715e create_stream: Remove no longer required condition.
The issue raised in the comment here seems to have been
fixed on its own. Tested on chrome and safari on macOS.

This was introduced in 2dd36aa422.
2020-11-02 12:12:01 -08:00
Anders Kaseorg 192f1eb0fc styles: Convert [disabled] selectors to :disabled pseudo-class.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2020-10-30 11:46:57 -07:00
aryanshridhar c591141d7c popover: Fixed color-picker popover responsiveness.
Color-picker overflows the screen width when an user
attempts to change color of the stream in small devices.

Fixed by making it fullscreen in narrow devices.

Fixes #16477
2020-10-29 16:56:02 -07:00
Vishnu KS 2ae70ff76c i18n: Translate who reacted tooltip message. 2020-10-29 16:50:01 -07:00
Harsh Sharma 966bbf6b3d right_sidebar: Change keyboard help tooltip to float left.
Floating upwards caused a weird flickering effect if the mouse floated
onto the tooltip's body, and it's still reasonable UI floating left
(and also there's guaranteed to be space).

Fixes #16438.
2020-10-29 16:17:33 -07:00