Commit Graph

767 Commits

Author SHA1 Message Date
Anders Kaseorg 85d5669a4a web: Fix selectors to correspond with annotated types.
TypeScript does not check that these annotations are consistent with
the given selector strings.  We need to ensure that ourselves for
runtime safety.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-19 13:14:27 -07:00
shashank-23002 b74dabfaa4 alert_words: Highlight overlapping alert words more accurately.
This fixes a bug where alert words that are contained in another alert
word would have only the smaller alert word highlighted.

Note that it does not handle weirder cases, like "one two" and "two
three" being alert words; "two three" will always be highlighted, and
not "one"; this is probably fine in practice.

Fixes: #28415
Co-Authored-By: danieldotcomcoder <daniel_shdeed@hotmail.com>
2024-03-19 11:20:16 -07:00
Mahhheshh e7adde96e0 message_edit: Reimplement message history modal as an overlay.
We redesign the message history modal to make it look similar to the
drafts and scheduled messages, using the shared styling/rendering
logic for that those existing elements to have a less goofy widget.

Fixes #28695.
2024-03-18 17:26:28 -07:00
Pratik Chanda a504753961 stream-settings: Fix right panel resetting on filter change.
Earlier in stream settings, filtering for streams by search stream
name would reset the right panel to default if a stream was selected
from stream row.

This commit fixes the behaviour by keeping the stream open in right
panel in stream settings even on any filter change.
2024-03-15 17:22:10 -07:00
Anders Kaseorg 959e51fe58 tests: Replace unneeded override_rewire uses by whole-module mocks.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-15 17:29:47 -04:00
Anders Kaseorg 45cfa42469 tests: Avoid override_rewire for bootstrap_typeahead.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-03-15 12:56:03 -07:00
Mahhheshh 1c48ed0a1c stream picker: Remove stream colorblock.
To achive this the `stream_header_colorblock` div was removed from
`dropdown_widget_with_stream_colorblock.hbs` template. this change made
the file name irelevenet so it was necessary to rename the file to
`dropdown_widget_wrapper.hbs`. After removing the html strcuture for
colorblock from templates the css for colorblock was also removed.
followed by the javascript which was used to add colorblock to the
stream picker. After removing javascript tests were updated.
Fixes: #28796.
2024-03-15 11:11:04 -07:00
evykassirer db24df488c typeahead: Convert from a jQuery plugin to a normal exported function. 2024-03-15 10:05:44 -07:00
N-Shar-ma ef5cdff9d9 settings: Scroll save button into view when a change made needs saving.
Whenever a setting that needs confirmation to save is tweaked, and the
save button is not visible, we scroll it into view, to ensure the user
does not mistake it for an automatically saved change and misses saving
their change.

Fixes: #29290.
2024-03-14 17:31:39 -07:00
N-Shar-ma f4d58f1ba6 compose: Show counter inside Drafts button for the current recipient.
Now we show the number of drafts that are addressed to the current
recipient selected in the compose box, if any, in the Drafts button
within parentheses (whether it is next to the Send button, or in the
Send options popover), and explain that it is the number of drafts for
this conversation in the tooltip.

Fixes: #28696.
2024-03-13 16:53:45 -07:00
Sohaib-Ahmed21 7e99c90190 typeahead: Improve compose topic typeahead behaviour.
Fixes: #29006

We make the following changes:
* Do not show the typeahead menu when there are no matching topics.
* When the typeahead is not shown, pressing Tab in the topic field
should move the cursor to the compose box.
* When the typeahead is shown, pressing Tab should select the
currently focused option (as it does now), but put the cursor at
the end of the topic, rather than at the beginning.
2024-03-13 10:00:56 -07:00
N-Shar-ma f16208d9f1 message_view: Allow quoting selected message text, via hotkey and menu.
Whenever the user has text selected within a single message, and uses
the hotkey to quote and reply, this selection will be quoted. In case of
no selection or selection not within a single message, the entirety of
the currently focused message will be quoted like before.

Similarly, when the user selects text within a single message, opens
that message's actions menu, and clicks the "Quote and reply" option,
the selected text will be quoted. In case of no selection or selection
containing any other message/s, the entirety of the message whose menu
was opened will be quoted like before.

When partially quoting a message, it is the markdown version of the
selection that is quoted, hence preserving any formatting. Any other
elements of the message, outside of the content, selected presumably by
accident (like the timestamp or sender name), are ignored.

Fixes: #19712.
2024-03-12 12:29:30 -07:00
Aman Agrawal 374e09b2da message_fetch: Check filter instead of message list.
Reduces use of `message_lists.home`.
2024-03-12 11:31:23 -07:00
Karl Stolley 2cf726c53b rendered_markdown: Refine templates and logic for REPL, copy buttons.
Co-Authored-By: shashank-23002 <21bec103@iiitdmj.ac.in>
2024-03-11 15:38:03 -07:00
Aman Agrawal 233bbbaa5f reload: Remove redundant parameter.
`save_narrow` is always true right now and it makes sense
to always save the current narrow when reloading the app.
2024-03-11 14:13:26 -07:00
evykassirer 2140138f5e typeahead: Confirm that highlighter text is safe html.
All existing typeaheads have values for highlighter that are one
of the following:

* render_search_list_item (a handlebars render function)
* render_typeahead_item which calls a handlebars render function
* another function in typeahead_helper which eventually calls
  typeahead_helper
2024-03-11 09:56:18 -07:00
N-Shar-ma 90cf911e89 typeahead: Update activity score computation algorithm for streams.
Earlier, streams were prioritised like this: pinned streams > subscribed
streams > other streams, with message volume serving as the tie breaker.

Now we prioritise them like: stream being composed to > pinned unmuted
streams > unpinned unmuted streams > pinned muted streams > unpinned
muted streams > unsubscribed streams, with the same tie breaker.

Fixes: #20618.
2024-03-08 16:11:17 -08:00
evykassirer 0062d3f999 reactions: Deduplicate shared code.
Creates a function for code shared by update_user_fields
and make_clean_reaction.
2024-03-05 14:54:45 -08:00
evykassirer 2de1486719 reactions: Send full message object to update_ui_and_send_reaction_ajax. 2024-03-05 14:54:45 -08:00
Mateusz Mandera 1ede8da46c events: Change format of authentication_methods realm_update_dict event.
Makes the event in line with state_data.realm_authentication_methods.
2024-03-05 11:48:58 -08:00
Mateusz Mandera da9e4e6e54 backends: Implementation of restricting certain backends by plan.
Only affects zulipchat, by being based on the BILLING_ENABLED setting.

The restricted backends in this commit are
- AzureAD - restricted to Standard plan
- SAML - restricted to Plus plan, although it was already practically
  restricted due to requiring server-side configuration to be done by us

This restriction is placed upon **enabling** a backend - so
organizations that already have a backend enabled, will continue to be
able to use it. This allows us to make exceptions and enable a backend
for an org manually via the shell, and to grandfather organizations into
keeping the backend they have been relying on.
2024-03-05 11:48:58 -08:00
N-Shar-ma bff750e825 copy_and_paste: Fix formatting of code pasted from VS Code.
Since the html copied from VS Code is not structured as code but as
styled divs for each line, any code copied from it would be pasted
unformatted with blank lines between each line of code.

This has now been fixed, by detecting VS Code style code blocks by the
CSS property `white-space: pre` and pasting the text within as is, as
code.
2024-03-05 11:34:22 -08:00
evykassirer af8263fb87 people: Don't refetch user when we already have it. 2024-03-05 11:27:34 -08:00
Sayam Samal 24e5004a54 compose_tooltips: Rename "non-stream" to "non-specific" type/view.
We want to name types/views that are not Stream or Direct related to be
"non-specific". The previously used term "non-stream" could be confusing
since it would literally mean any type/view which is not a stream type/
view, which would encapsulate the Direct type/view also.

Thus, we finally use the following terms to describe the type of
conversation:
1. Stream type (Streams or Topics)
2. Direct type (A)
3. Non specific type (Inbox, Recent conversation, All messages)
2024-03-05 10:55:20 -08:00
evykassirer fb7d77545f reactions: Convert module to typescript. 2024-03-04 19:07:49 -08:00
evykassirer 07671997ca reactions: Calculate vote_text before creating clean reaction.
This is essential for converting to typescript, because
we can't create half a clean reaction and then calculate
vote_text afterwards. Instead, we should calculate it
with the information we already have, and create the
clean reaction object afterwards, all at once.
2024-03-04 19:07:49 -08:00
N-Shar-ma b4d53c7930 compose: Fix bug where inserted content would not be scrolled into view.
On chromium browsers, the scroll position is not restored when the text
in a textarea is replaced. So instead of directly replacing the text,
we call the `insert_and_scroll_into_view` function with `replace_all`
set to true.
2024-03-04 17:14:11 -08:00
nimishmedatwal 3d30fcd10a onboarding: Improve placeholder message for dm with yourself.
Fixes #29078
2024-03-01 16:09:54 -08:00
evykassirer e26b4bbd3e drafts: Reimplement handlers for buggy drafts using zod. 2024-03-01 15:49:53 -08:00
evykassirer e8d5241c0d drafts: Return updatedAt timestamp in snapshot_message.
It was always being set after the fact, and it will
be easier to manage types for the conversion to
Typescript if we just set this when setting the
rest of the data for the draft message.
2024-03-01 15:49:53 -08:00
evykassirer 97c46a7375 stream_data: Allow undefined stream_id in get_color.
Sometimes get_color is called with undefined
stream ids. This change makes more clear
what was already happening, and allows
for smoother conversion of other files
to typescript, including an upcoming
conversion of the drafts module, which
can call `get_color` with a draft with
undefined stream_id.

This keeps the color logic contained in
the `get_color` function, which seems
cleaner than the alternative of exporting
DEFAULT_COLOR to be used wherever sream_id
might be undefined.
2024-03-01 15:49:53 -08:00
evykassirer 34b6be668e util: Add test coverage for lower_same. 2024-03-01 15:49:53 -08:00
Anders Kaseorg 13115c8180 Revert "copy_and_paste: Fix formatting of code pasted from VS Code."
This reverts commit 4a1423b34a.
2024-02-29 20:44:43 -05:00
N-Shar-ma 4a1423b34a copy_and_paste: Fix formatting of code pasted from VS Code.
Since the html copied from VS Code is not structured as code but as
styled divs for each line, any code copied from it would be pasted
unformatted with blank lines between each line of code.

This has now been fixed, by detecting VS Code style code blocks by the
CSS property `white-space: pre` and pasting the text within as is, as
code.
2024-02-29 15:12:13 -08:00
Lauryn Menard ad9f7a4549 corporate: Update directories for activity and support frontend files. 2024-02-29 15:11:48 -08:00
Anders Kaseorg 1118b2cc19 web: Convert uses of deprecated text-field-edit function aliases.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-29 13:24:27 -08:00
Aman Agrawal 8a6455551c narrow: Merge narrow activate and deactivate calls.
Fixes part of #23812.
2024-02-27 19:43:31 -08:00
Anders Kaseorg 664fdf1a92 channel: Use base_page_params.
Fixes errors on /devtools/integrations/ and /emails/.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-27 21:18:00 -05:00
Prakhar Pratyush fe1a20ebb3 settings: Add realm-level setting 'zulip_update_announcements_stream'.
This commit adds a realm-level setting named
'zulip_update_announcements_stream' that configures the
stream to which zulip updates should be posted.

Fixes part of #28604.
2024-02-25 09:33:00 -08:00
Aman Agrawal de0db7ad1a filter: Make excludes_muted_topics a method of the `Filter` class. 2024-02-24 08:31:18 -08:00
Aman Agrawal c20340a5a6 narrow_state: Use `message_lists.current` to return current filter.
It doesn't make sense for us to track a separate current filter when
it should just the be filter of current message list if there is one.

This will reduce possible confusion in the codebase where filter
returned by narrow_state is different from message_lists.current.
2024-02-24 08:31:18 -08:00
Aman Agrawal f630272b4c message_lists: Set `current` to be `undefined` for non message view. 2024-02-24 08:31:18 -08:00
Aman Agrawal 4ccf64b02b narrow: Use update_current_message_list instead of set_current.
It's important to remove the focused class and remote the
old message list from DOM which only happens in
update_current_message_list.
2024-02-24 08:31:18 -08:00
Sayam Samal a7e7176aae uploads: Improve abstraction of `upload.js` by removing object exports.
The `upload_objects_by_message_edit_row` map object was being exported
to handle the uploads during the editing of a message. To improve the
abstraction, we move the logic being used to access
`upload_objects_by_message_edit_row` and itself into `upload.js`.

Similarly, the `compose_upload_object` constant which was being exported
to handle the cancelling of compose uploads. This commit removes this
export and instead defines a new method `compose_upload_cancel` to
handle the same.
2024-02-23 16:46:40 -08:00
evykassirer 44b07094df stream_list: Convert module to typescript. 2024-02-23 16:18:48 -08:00
Aman Agrawal a9dc669f3c dropdown_widget: Migrate to typescript. 2024-02-22 16:38:25 -08:00
evykassirer ea2818786e buddy_list: Convert module to typescript. 2024-02-22 16:05:27 -08:00
evykassirer be033394b1 stream events: Rebuild buddy list when user is subscribed or unsubscribed. 2024-02-22 16:05:27 -08:00
evykassirer 5434130171 buddy list: Calculate render data once per view.
The work now being done in set_render_data used
to be done in render_more, which is called in
batches of 20 rows at a time. This work only
needs to be done once per narrow/view, so this
is a great performance improvement.
2024-02-22 16:05:27 -08:00
evykassirer 231c0087a4 compose fade users: Remove fade logic in favor of buddy list split.
This also removes buddy_list.get_items which were only used
for compose_fade logic.
2024-02-22 16:05:27 -08:00