Commit Graph

49011 Commits

Author SHA1 Message Date
Anders Kaseorg d494181127 ruff: Enable more errors.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg 3d853caf16 ruff: Fix C417 Unnecessary `map` usage.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg ab864be904 ruff: Fix C416 Unnecessary `set` comprehension (rewrite using `set()`).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg 77c15547e6 ruff: Fix C414 Unnecessary `list` call within `sorted()`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg 69e94b5991 ruff: Fix C413 Unnecessary `list` call around `sorted()`.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg 9e53f0c756 ruff: Fix C405 Unnecessary `list` literal (rewrite as a `set` literal).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg 033d2615f6 ruff: Fix B017 `assertRaises(Exception):` should be considered evil.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg e1a2894af9 ruff: Fix B011 Do not `assert False` (`python -O` removes these calls).
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg 9d2d6c8eb7 ruff: Fix M001 Unused `noqa` directive.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Anders Kaseorg adffad384c lint: Replace pycodestyle and pyflakes with ruff.
https://github.com/charliermarsh/ruff

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-03 12:10:15 -07:00
Mateusz Mandera 05913f5e3a saml: Extract logic for enabling wantMessagesSigned locally.
As explained in 158287f998,
wantMessagesSigned can't be enabled globally (as it'll break setups with
IdPs that sign SAMLResponse assertions) - but is needed for
LogoutRequests, and will be for LogoutResponses in the SP-initiated SLO
flow in future commits.

We extract a function with the necessary hacky logic for re-use in the
SP-initiated SLO implementation.
2022-11-02 21:58:46 -07:00
Tim Abbott 931ed069b3 tools: Don't display release candidate as forks. 2022-11-02 21:38:24 -07:00
Tim Abbott f0d3793c97 i18n: Update translations from Transifex. 2022-11-02 21:35:19 -07:00
Tim Abbott 873ab01c7a message_flags: Fix accidentally quadratic behavior. 2022-11-02 21:05:24 -07:00
Alya Abbott d9dde2b4d9 help center: Add a detail to /help/mute-a-stream.
Indicate that muted streams are sorted to the bottom of their section.
2022-11-02 17:05:28 -07:00
Anders Kaseorg ccfb516a79 lint: Enable caching for Prettier.
Caching is new in Prettier 2.7.0, but broken before 3.0.0-alpha.4.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-02 16:50:37 -07:00
Anders Kaseorg 683a6b0411 dependencies: Upgrade Prettier to 3.0.0-alpha.4.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-11-02 16:50:37 -07:00
evykassirer 6ef5736bfe drafts: Rename undefined draft topics to empty string.
This fixes an error state that came out of #22094.
The code causing the error was fixed in #23238 but some
drafts still have undefined topics which has some strange
side effects. One day we'll have typescript help catch
this kind of thing!

More details on CZO: https://chat.zulip.org/#narrow/stream/9-issues/topic/live.20update.20issue.20with.20drafts/near/1457913
2022-11-02 16:36:36 -07:00
evykassirer 919f08d80f drafts: Catch and log error caused by drafts with undefined topics.
This is a bandaid fix to an error that came out of #22094.
The error was fixed in #23238 but some drafts still have
undefined topics which is raising this error.

More details on CZO: https://chat.zulip.org/#narrow/stream/9-issues/topic/live.20update.20issue.20with.20drafts/near/1457913
2022-11-02 16:20:40 -07:00
Imran 1fadb7cbd9
stream_settings: Link to stream description help center article.
This lets us provide a hook to where we've written some advice both on
what makes a good stream description, and also what Markdown formatting
is supported there.

Fixes #23376.
2022-11-02 16:19:53 -07:00
Rohitt Vashishtha 1db901cded keydown_util: Check Enter events properly for IME edge cases.
We now check whether an IME is currently composing and do not
process any such key==="Enter" events as the Enter/Return key.

Fixes #22062.
2022-11-02 15:42:42 -07:00
Rohitt Vashishtha 56970ee117 message_edit: Refactor message edit keydown handler.
This commit modifies handle_message_row_edit_keydown to use
keydown_util.is_enter_event(). This is a precursor to fixing #22062.
2022-11-02 15:05:33 -07:00
Rohitt Vashishtha 836f0fed10 message_edit: Refactor topic edit keydown handler.
This commit modifies handle_inline_topic_edit_keydown to use
keydown_util.is_enter_event(). This is a precursor to fixing #22062.
2022-11-02 15:05:33 -07:00
Rohitt Vashishtha d4379f9528 keydown_util: Extract all 'Enter' events to one place.
This is a prep commit to fix #22062.
2022-11-02 15:05:33 -07:00
Sahil Batra aeb9a27d0e message: Ignore messages in unsubcribed streams when marking them unread.
Zulip's unread messages design has an invariant that all unread stream
messages must be in streams the user is subscribed to. For example, We
do not include the unread messages from unsubscribed streams in the
"unread_msgs" data structure in "/register" response and we mark all
unread messages as read when unsubscribing a user from a stream.

Previously, the mark as unread endpoint allowed violating that
invariant, allowing you to mark messages in any stream as unread.

Doing so caused the "message_details" data structures sent with
"update_message_flags" events to not contain messages from
unsubscribed streams, even though those messages were present in the
set of message IDs. These malformed events, in turn, caused exceptions
in the frontend's processing of such an event.

This change is paired with a separate UI change to not offer the "Mark
as unread" feature in such streams; with just this commit, that will
silently fail.

With some additions to the tests by tabbott.
2022-11-02 14:49:23 -07:00
Chris Bobbe b52e83281b shared: Bump version to 0.0.16 2022-11-02 13:59:05 -07:00
Mateusz Mandera 6e336ef6f6 delete_topic: Use the same timeout pattern as /mark_all_as_read.
We don't want to use the nginx 502 timeout as an API pattern. In
/mark_all_as_read we've already figured out how we want to handle this
instead.
2022-11-02 16:50:06 -04:00
Lauryn Menard 66da42bbae popovers: Do not show option to mark unread for unsubscribed streams.
In the message actions popover menu, adds an additional check for
whether the mark as unread option should be displayed based on if
the message is a stream message and if the user is subscribed to
the message's stream.
2022-11-02 13:39:20 -07:00
Tim Abbott a1aba2869b settings_org: Fix exception processing stream type events.
The previous check looked at whether the settings overlay as a whole
was open, not whether the specific panel we're going to update was
rendered.

The other code paths calling from server_events_dispatch into this
module already correctly check meta.loaded.
2022-11-02 11:43:07 -07:00
Ganesh Pawar 3a9730b7c6 gear_menu: Change sponsored plan name. 2022-11-02 09:55:23 -07:00
Tim Abbott 3ea1311f56 unread: Downgrade unread race logging to not an error.
We added this logging statement in
8d33a62eca, and we now have the data to
suggest this will happen in normal operation.

I left this as a blueslip.log, since it may be useful to see in the
leadup to another exception.
2022-11-01 22:47:52 -07:00
Aman Agrawal 8dd3579885 unread: Use `unread_topic_counter` to get message details.
The message we are trying to remove from unread mentions might not
have been fetched locally.

Fortunately, the `unread_topic_counter` data structure is designed to
support exactly this kind of lookup.
2022-11-01 22:41:07 -07:00
Aman Agrawal 2e480b0b09 unread: Move some functions.
Moved these functions to be able to access `unread_topic_counter`
inside them.
2022-11-01 22:32:07 -07:00
Greg Price 8810203a4c shared: Prescribe atomic push when bumping version.
This way, if the maintainer isn't able to update `main`,
the push doesn't add the shared-VERSION tag either.
That avoids ending up with a tag that potentially doesn't
get included in the history of the main branch.

The Git docs warn that servers might or might not support this
feature, but GitHub does -- indeed they boasted about it when it
first came out, in Git 2.4 back in 2015:
  https://github.blog/2015-04-30-git-2-4-atomic-pushes-push-to-deploy-and-more/
2022-11-01 22:25:37 -07:00
Alex Vandiver 521ec5885b puppet: Rename autossh tunnel, as it is no longer for just munin. 2022-11-01 22:24:40 -07:00
Alex Vandiver 42f84a8cc7 puppet: Use existing autossh tunnels as OpenSSH "master" sockets.
A number of autossh connections are already left open for
port-forwarding Munin ports; autossh starts the connections and
ensures that they are automatically restarted if they are severed.

However, this represents a missed opportunity.  Nagios's monitoring
uses a large number of SSH connections to the remote hosts to run
commands on them; each of these connections requires doing a complete
SSH handshake and authentication, which can have non-trivial network
latency, particularly for hosts which may be located far away, in a
network topology sense (up to 1s for a no-op command!).

Use OpenSSH's ability to multiplex multiple connections over a single
socket, to reuse the already-established connection.  We leave an
explicit `ControlMaster no` in the general configuration, and not
`auto`, as we do not wish any of the short-lived Nagios connections to
get promoted to being a control socket if the autossh is not running
for some reason.

We enable protocol-level keepalives, to give a better chance of the
socket being kept open.
2022-11-01 22:24:40 -07:00
Alex Vandiver e05a0dcf98 puppet: Support FQDNs in puppet zulip.conf names. 2022-11-01 22:24:40 -07:00
Alex Vandiver df201bd132 puppet: Monitor "hosts_fullstack" hosts (e.g. CZO).
These hosts were excluded from `zulipconf_nagios_hosts` in
8cff27f67d, because it was replicating the previously hard-coded
behaviour exactly.  That behaviour was an accident of history, in that
4fbe201187 and before had simply not monitored hosts of this class.

There is no reason to not add SSH tunnels and munin monitoring for
these hosts; stop skipping them.
2022-11-01 22:24:40 -07:00
Alex Vandiver 951dc68f3a autossh: Drop unnecessary -2 option.
The -2 option is a no-op.
2022-11-01 22:24:40 -07:00
Chris Bobbe 167b891d4e shared: Fix typeahead.js.flow to add Emoji['reaction_type'].
The emoji matcher uses this property in is_unicode_emoji.

It doesn't quite make sense to be talking about "reaction types"
here -- we might use this for a message-reactions UI, but we might
just as reasonably use it for emoji UI in message composing. Ah,
well: I guess that's just a bit of messiness that we can deal with.
2022-11-01 17:46:47 -07:00
Chris Bobbe 72303bc0b0 shared: Bump version to 0.0.15 2022-11-01 10:19:34 -07:00
Lauryn Menard 7b88d6d8f8 help-menu: Update tip at the bottom of search operators tab.
Updates the tip at the bottom of the search operators tab to only
state that operators can be combined as needed.

Fixes #22866.
2022-11-01 08:40:33 -07:00
Aman Agrawal 6042e91fe8 left_sidebar: Hide sub to more streams in topics list view (zoom-in). 2022-11-01 08:24:24 -07:00
Aman Agrawal 7e8ebe3aa5 recent: Fix alignment of unread mention icon. 2022-11-01 08:24:24 -07:00
Lauryn Menard af00fd05b2 narrow-banner: Check user exists with "group-pm-with" empty narrow.
When "group-pm-with" is the first operator and setting an empty
narrow banner, check that the operand matches a user and set the
title based on whether the user exists or not.
2022-11-01 08:23:43 -07:00
Lauryn Menard a2e4005279 narrow: Return default search title for "group-pm-with" operator.
Because "group-pm-with" is not a common search operator, instead of
setting a specialized title in the browser and tab, just use the
default title, "Search results".
2022-11-01 08:23:43 -07:00
Zixuan James Li da9ad7c3a7 markdown: Pass realm down into render_stream_description.
This guarantees that the Realm is always non-None when we hit the
codepath is_static_or_current_realm_url via
do_change_stream_description, so that we can properly skip rewritting
some images.

Fixes #19405

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2022-11-01 08:20:47 -07:00
Mateusz Mandera d02b1f0ae6 docs: Move OPEN_REALM_CREATION doc section to multiple-organizations.md.
Since this is being moved to admin-facing documentation, also adds a
paragraph about the main concern with enabling this on a server that's
not zulip.com.
2022-10-31 17:56:45 -07:00
Mateusz Mandera 582d5b0aa3 realm_creation: Rework error pages.
The previous error page was inadequate for serving the two different
scenarios where we show errors in realm_creations, in particular
containing a misleading sentence about realm creation being disabled
(even in the case where it was actually enabled and the user simply had
an expired link).
2022-10-31 17:35:06 -07:00
Tim Abbott b62450c7b3 docs: Update changelog for changes merged for 6.0. 2022-10-31 17:10:13 -07:00