Commit Graph

46312 Commits

Author SHA1 Message Date
Lauryn Menard 3be622ffa7 backend: Add request as parameter to json_success.
Adds request as a parameter to json_success as a refactor towards
making `ignored_parameters_unsupported` functionality available
for all API endpoints.

Also, removes any data parameters that are an empty dict or
a dict with the generic success response values.
2022-02-04 15:16:56 -08:00
Lauryn Menard 6f7e53c517 lint: Remove custom python rule for json_success without parameter.
As a preparatory step to refactoring json_success to accept
request as a parameter, removes custom lint python check for
calling json_success without a parameter.
2022-02-04 15:16:55 -08:00
Lauryn Menard c532829c35 backend: Change `do_report_error` return value.
As a preparatory step to refactoring json_success to accept
request as a parameter, change `do_report_error`, which is
called from the events queue for "error_reports", to return
None instead of json_success.

Adds an assertion error to `ErrorReporter` queue processor
and removes `JsonableError` from `do_report_error`.

It is likely that `do_error_report` was moved from a view in a
previous refactor, but was not updated to no longer return an
HttpReponse.
2022-02-04 15:16:55 -08:00
Lauryn Menard dbddbee5a1 backend: Change return value of `compose_views`.
As a preparatory step to refactoring json_success to accept
request as a parameter, update helper function `compose_views`
in `views.streams.py` to return the response data and call
json_success from view functions that utilize `compose_views`.

Also, updates related test in `zerver.tests.test_subs.py`.
2022-02-04 15:16:55 -08:00
Lauryn Menard a4b347bb5f backend: Move json_success to callers vs helper functions.
As a preparatory step to refactoring json_success to accept
request as a parameter, change interface of helper functions:
`handle_deferred_message` in `views.message_send.py` and
`mute_topic` and `unmute_topic` in `views.muting.py`, so
that they return None or data for json_success.

Instead call json_sucess in the caller function, which already
has the HttpRequest as a parameter.
2022-02-04 15:12:22 -08:00
Austin Riba 81b1b18886 lightbox: Prevent undesired closing of lightbox during pan.
This commit adds a method of marking an overlay as being meant to be
left open despite click events triggering that would normally close it.
This is to prevent the case where a user drags an image and "unclicks"
in an area where normally clicking would close the overlay.
2022-02-04 14:58:36 -08:00
Austin Riba 1c2fd19d69 lightbox: Revert state of lightbox when closing the overlay.
This commit attempts to revert the lightbox state (at least
the pan/zoom part of it) when the lightbox is closed. The open()
function has been turned into a factory function so that the zoom
control which is instantiated on initialization of the lightbox can be
passed in to the on_close handler of overlay.open().
2022-02-04 14:58:36 -08:00
Austin Riba 5f83bc5cfe lightbox: Replace lightbox_canvas with PanZoom library.
This PR changes how the Pan & Zoom feature of images displayed in the
attachment lightbox are handled.

The existing method of using a canvas element is replaced by the Panzoom
library (timmywil/panzoom). This library is lightweight and has 0
transitive dependencies.

This fixes #20759 where the issue is that the viewport of a zoomed image
was not expanding to fill the available space on the page. Switching to
this new library also solves several other UX issues:

    * Images are no longer blurred when in Pan & Zoom mode.
    * The zoom behavior itself uses focal point zooming: zooming occurs
      where the cursor is on the image instead of at the center of the
      image, reducing the need for extra panning.
    * CSS transitions are used for a more visually pleasing experience
      when switching images, toggling zoom off, etc.
    * The library has the potential to open other file types which
      leaves that option open for us in the future.
2022-02-04 14:58:36 -08:00
Jai soni 97ffe2b123
left-sidebar: Allow up to 2 lines for group PMs.
This change makes it easier to see who is present in a group private message conversation
when some of the users in it have long names.

We disable a stylelint rule for this line, because this particular -webkit prefixed CSS rule 
works in all modern browsers including Firefox.

Fixes #21003.
2022-02-04 14:43:13 -08:00
NerdyLucifer 666fe465dd poll_widget: Fix the position of poll title editing button.
Places poll editing button in the same line of poll title by changing
display property of poll title from inline-block to inline.

Fixes #20753.
2022-02-04 13:43:05 -08:00
Steve Howell 05ff904378 presence: Extract $active_color CSS variable. 2022-02-03 15:31:21 -08:00
Steve Howell 498b02dfb2 presence: Avoid doc/naming references to "orange".
It seems like orange is the loudest possible color to
denote a quasi-neutral-idle state, so we hope to
replace it with another color.

This commit does not change any styling.

I removed the sentences in the doc, since they are
kind of too vague to be useful. If we want to say that
the idle state is correlated with the half-orange
circles in the buddy list, then we want to say that
more specifically.
2022-02-03 15:31:21 -08:00
Steve Howell a9ea525757 pm list: Remove obsolete user_circle_fraction class. 2022-02-03 15:31:21 -08:00
Puneeth Chaganti 3d55a1a5bf emoji: Make large square emoji names consistent. 2022-02-03 15:08:34 -08:00
Anders Kaseorg df304c40da markdown: Use built-in hex formatting for unicode_emoji_to_codepoint.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2022-02-03 11:00:04 -08:00
Sahil Batra 984040fd39 js: Remove unused buddy_data.huddle_fraction_present function.
This function is not used currently after we removed the
"Group PMs" section from right sidebar in 43e5b2d28b.

This commit also removes presence.is_active function as it
was only used in buddy_data.huddle_fraction_present.
2022-02-03 10:59:33 -08:00
Alex Vandiver ca0bf10712 portico: Add an infra engineer position. 2022-02-03 09:42:34 -08:00
Alex Vandiver 9cc61a56dc portico: Remove an unnecessary <p>..</p>. 2022-02-03 09:42:34 -08:00
Alex Vandiver 490862922e portico: Remove designer position. 2022-02-03 09:42:34 -08:00
N-Shar-ma ec25310654 typeahead: Fix typeahead for custom selection triggers.
Now checking for custom trigger keys will happen during `keydown`
instead of `keyup` so that if the key is printable, `preventDefault`
can prevent it from appearing in the compose box.

This fixes the case when jumping to topic, would eat up any space
or new line after the cursor, due to wrong splitting around the
cursor, which was a result of using the printable custom trigger key,
the ">", in contrast to a non printable one like Enter.

The problem was that custom trigger keys like `>` that the browser's
default behavior is to type (vs. others like RightArrow where that
isn't the case) can result in extra characters being emitted, which
is not wanted.
2022-02-02 17:27:08 -08:00
Lauryn Menard cc712dbade api_docs: Add check for extra `additionalProperties` in return vals.
Adds a check for `additionalProperties: true` when there are no
properties listed in the schema.

This currently only happens in one place, but will be helpful for
deduplicating text between the `register-queue` and `get-events`
endpoints.
2022-02-02 17:25:58 -08:00
Puneeth Chaganti d55c137277 emoji: Add yellow_large_square and green_large_square emojis.
Wordle has recently become a thing and it uses green, yellow and white (or
black in dark mode) large square unicode characters to let people share their
gameplay. Zulip converts the white and black large square unicode characters to
emojis, but not the green and yellow ones. This causes the Wordle grid to be
misaligned when shared on Zulip.

This commit adds green and yellow large square emojis to our emoji list to fix
the problem.
2022-02-02 16:26:31 -08:00
Puneeth Chaganti 6beb84b553 emoji: Use str.rjust to pad codepoint strings instead of a loop. 2022-02-02 16:26:30 -08:00
Puneeth Chaganti 0eeb74b3c2 emoji: Fix minor typo in unicode_emoji_to_codepoint comment. 2022-02-02 16:26:28 -08:00
Sahil Batra d83b50d39f compose: Update error shown on sending message with no topic.
This commit updates the error message shown on sending a message
with no topic in an organization with mandatory_topics setting
set as true to match the error message in API.
2022-02-02 10:11:35 -08:00
Sahil Batra 9f0d498994 message: Check mandatory_topics setting in backend as well.
Previously, we only checked mandatory_topics setting before
sending message in frontend and there was no restriction in
backend. This commit adds the check in backend also making
sure messages without topic cannot be sent through API as
well if mandatory_topics setting is set to True.
2022-02-02 10:11:35 -08:00
Aman Agrawal acbfdb1c36 compose: Use flexbox to align items in compose top right.
This will help us align components on compose box top better
on small screen sizes.

We also center align the compose_top elements.
2022-02-02 10:04:38 -08:00
Aman Agrawal 1f812df0d2 compose: Use tippy to show tooltips for top right compose icons. 2022-02-02 10:02:49 -08:00
Aman Agrawal a38b11d188 resize: Rename reset_compose_textarea_max_height.
This no logner just resets the max-height of compose-textarea
but also preview_message_area.
2022-02-02 10:01:27 -08:00
Aman Agrawal adf8446b51 compose: Resize compose-textarea after exit from markdown-preview.
Autosize library can miss resize of compose-textarea when
compose is collapsed / expanded while preview box is displayed
and compose-textarea is hidden. So, we force a autosize.update
of compose-textarea, when user exits markdown preview, to ensure
that the textarea is of correct size.

Fixes #19353
2022-02-02 10:01:27 -08:00
Aman Agrawal 31dd1d554c compose: Avoid preview message area overlap with last message.
Instead of blindly adjusting `compose-textarea` on resize,
we adjust the height of `compose-textarea` or `preview_message_area`
based on which is visible.
2022-02-02 10:01:26 -08:00
Priyam Seth 17f74a3f57 compose: Show warning while composing to a resolved topic.
This commit creates the function warn_if_topic_resolved that checks if
the topic to which the user is composing is resolved or not. First it
checks if the stream exists and then if the topic name starts with the
RESOLVED_TOPIC_PREFIX. If the conditions are true, a warning banner is
shown to the user.

It also shows to the user a button to unresolve the topic, if he has
the permission to do so.

Fixes #20584.
2022-02-01 17:50:17 -08:00
Alex Vandiver d1234ef18c string_validation: Prohibit non-printable characters in stream names.
Fixes part of #20128.

Co-authored-by: Shlok Patel <shlokcpatel2001@gmail.com>
2022-02-01 16:04:34 -08:00
Mateusz Mandera 8affb8e4a3 migrations: Remove disallowed characters from stream names.
character_is_printable logic is taken from similar work by @madrix01
2022-02-01 15:14:57 -08:00
Tim Abbott 4989a300f8 message_edit: Fix internationalization of edited notices.
The previous internationalization approach didn't support languages
with a different word order than English.

We also switch to using "moved" to explain topic/stream moves,
consistent with how the message feed explains it.
2022-02-01 14:09:19 -08:00
Tim Abbott b7a07a753f message_edit: Fix display of repeated stream moves.
The recent commits to display the previous and new streams for a moved
message did not correctly handle messages moved multiple times.

To do this, we need to do a somewhat awkward loop, at least until we
modify the API to do this loop for us.
2022-02-01 13:59:31 -08:00
somesh202 71ce154a02 i18n: Add missing translation tags in edit history strings. 2022-02-01 12:25:40 -08:00
somesh202 2b10f958bb message-edit-history: Show the edited stream in the edit history.
Previously, message edit history never displayed stream moves.

Fixes #20452.
2022-02-01 12:22:46 -08:00
Tim Abbott 438af33b19 create_user_messages: Rename mark_as_read_user_ids.
This should use a name that follows the naming pattern of adjacent
fields.
2022-02-01 12:01:03 -08:00
Tim Abbott 1a46df40c3 resolve topic: Limit unread flag on automated notifications.
Previously, users found it annoying that the automated "Resolve topic"
notifications triggered an unread for everyone in the stream; this
discouraged some users from using the feature on older threads for
fear of being annoying. We change this to a better default, of only
users who participated in the topic (via either messages or reactions)
being eligible for the new message being unread.

We will likely want to create global and stream-level notifications
settings to control this behavior as a follow-up -- some users, like
me, might prefer the simpler "Always unread" behavior in some streams.

Note that the automated notifications that a topic was resolved will
still result in the topic being moved to the top of the left sidebar.
This would be somewhat difficult to change, since the left sidebar
algorithm just looks at the highest message ID in the topic.

Fixes #19709.

Tests added by Aman Agrawal (amanagr@zulip.com).
2022-02-01 11:35:50 -08:00
jai2201 38003408cb settings: Make authentication settings more like other panels.
This may still needs further work to replace the table with a more
standard implementation.

Fixes part of #21001.
2022-02-01 11:28:27 -08:00
Alya Abbott 30fec0c701 docs: Clarify that only issues tagged "help wanted" should be claimed. 2022-02-01 11:26:09 -08:00
Sahil Batra 8565aad3fa stream_settings: Fix color of icon of the title in right column.
This commit fixes two things -

- We use the exact same color that is used for stream name in
day mode.

- Previously, we were passing black color explicitly to the
stream_privacy_icon template. This commit changes it to pass
different color in the night mode which is the same used for
stream name in night mode.
2022-02-01 11:25:01 -08:00
Aman Agrawal b4075b78eb message_feed_errors: Don't show search public stream to spectators.
Fixes #20299.
2022-01-31 17:12:03 -08:00
Tim Abbott c528e768ff message_scroll: Remove misleading comment.
The hacky code referenced in this comment was removed in
d59ccd4c0f.
2022-01-31 17:10:06 -08:00
Aman Agrawal f00db27b64 message_feed_errors: Convert to handlebars. 2022-01-31 17:10:05 -08:00
Aman Agrawal 8f2e973ab2 message_list_view: Cleanup unused bookend code.
`bookend_top` is already defined firmly for `group` in
`add_subscription_marker`, so no need to redefine it.

`bookend_bottom` is no longer used anywhere in the codebase. Not
sure what the history is here.
2022-01-31 16:50:54 -08:00
Aman Agrawal 93a03dcf3a message_list_view: Mark trailing bookend using a new variable.
We need to mark trailing bookends differently to identify them
in DOM easily. This fixes a bookend replication bug which can
happen sometimes when rendering.
2022-01-31 16:42:46 -08:00
Aman Agrawal 0bde50b851 stream_data: Set can_toggle_subscription to false for spectator. 2022-01-31 16:39:17 -08:00
Tim Abbott 6065d66d3d bookend: Simplify can_toggle_subscription variable flow. 2022-01-31 16:39:16 -08:00