Commit Graph

29 Commits

Author SHA1 Message Date
Anders Kaseorg 94fe3f6194 rendered_markdown: Move thumbnail rewriting to postprocess_content.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-07-23 13:26:37 -07:00
roanster007 66a96bee71 settings: Add setting to control how animated images are played.
Previously animated images were automatically played in the
message feed of the web app.

Now that we have still thumbnails available for them, we can add a new
personal setting, "web_animate_image_previews", which controls how the
animated images would be played in the web app message feed -- always
played, on hover, or only in the image viewer.

Fixes #31016.
2024-07-22 14:53:31 -07:00
Alex Vandiver 60fc9eae2f thumbnail: Swap in our preferred thumbnail format. 2024-07-21 18:41:59 -07:00
Anders Kaseorg 139d6ff81b markdown_timestamp: Remove incorrect space.
The space wasn’t visible because it was narrower than the padding on
`.rendered_markdown time`, but it showed up in copy-and-paste.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-06-20 16:04:30 -07:00
Sahil Batra a70eb21ea1 settings: Use page_params.is_spectator field for spectator checks.
Instead of current_user.user_id we use page_params.is_spectator
field to check the spectator cases as it makes it more clear
to the reader about what is the condition checking.
2024-06-14 17:11:23 -07:00
nimishmedatwal acf13e49cf rendered_markdown: Fix code getting copied when visiting playground.
Fixes #29844.
2024-05-06 15:50:39 -07:00
Anders Kaseorg abee323c77 web: Convert .data("code-language") to .attr.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-05-03 12:45:46 -07:00
Karl Stolley f2a1c96940 spoilers: Adjust HTML source order to match presentation. 2024-04-12 17:39:36 -07:00
Anders Kaseorg 8fb1117cef eslint: Fix no-jquery/no-append-html errors that need test changes.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-04 10:11:57 -07:00
Anders Kaseorg 4dc27216f4 rendered_markdown: Fix HTML injection bug in update_elements.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-04-03 13:11:47 -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
Anders Kaseorg 10892f1d60 tests: Fix direct mutation of ES modules again, again.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-19 21:20:35 -05:00
Anders Kaseorg b9e62c7af8 page_params: Split out state data for realm.
For spectators, the chunk of page_params that originates from
do_events_register isn’t assigned until ui_init.js.  That means the
TypeScript type of page_params is mostly a lie during module load
time: reading a parameter too early silently results in undefined
rather than the declared type, with unpredictable results later on.

We want to make such an early read into an immediate runtime error,
for both users and spectators consistently, and pave the way for
runtime validation of the page_params type.  As a second step, split
out the subset of fields that pertain to the entire realm.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2024-02-15 10:22:52 -08:00
evykassirer 1948cf15a4 rendered markdown: Assert data-user-group-id is always defined. 2024-01-19 17:54:07 -08:00
Evy Kassirer 6e902defba
node tests: Use noop helper function pattern in test files.
Some files already were using `noop` in place of `() => {}`.
It's both clearer what it means and is easier to type.
This updates all test files to fully use `noop`, and
adds a shared import from the test lib file.
2023-12-14 14:51:33 -08:00
Sahil Batra ce6dc40a42 markdown: Handle mention pill behavior for inaccessible users.
We do not update the name for mention pills of inaccessible users
and keep it same as it was in the message content, and we show
the "Unknown user" popover on clicking the pill.
2023-12-07 19:34:07 -08:00
Prakhar Pratyush 0c159c5f47 mention: Fix mention highlighting in unsubscribed streams.
Rules followed:
1. Bold and highlighted background if the mention was processed
as a mention that includes you.
2. Bold personal mention (but not highlighted) if you were mentioned
but not subscribed at the time.
3. Otherwise not bold, no highlighting.

As we plan to keep the mention pill CSS the same if a user
was mentioned via that personal/wildcard/usergroup mention
irrespective of whether the user is subscribed or not, we use
usermessage flags to determine when to add 'user-mention-me' class.

Fixes #27654.
2023-11-24 07:10:20 -08:00
Prakhar Pratyush 64005c03b6 topic_mentions: Highlight the @topic mention for topic participants.
This commit adds support to highlight the '@topic' wildcard
mention text for the users having 'topic_wildcard_mentioned'
flag set.

Fixes #27497.
2023-11-13 08:29:16 -08:00
Sahil Batra 70c9d0765f rendered_markdown: Add "(guest)" to user name in mention pill.
This commit adds "(guest)" indicator to user names of guests
in mention pill if the enable_guest_user_indicator setting is
enabled for the organization. Note that the actual message
content does not include the indicator.
2023-10-12 12:06:10 -07:00
Aman Agrawal 6fb7a64cd0 rendered_markdown: Fix video thumbnail not present in Safari. 2023-10-02 22:39:02 -07:00
Aman Agrawal bdf6b210b8 copied_tooltip: Remove tippyjs import cycle by extracting it.
Moving show_copied_confirmation to a new library breaks the
dependency cycle of popover_menus and tippyjs.
2023-09-24 15:16:27 -07:00
Anders Kaseorg 63c9296d53 tests: Fix direct mutation of ES modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 18:00:38 -07:00
Anders Kaseorg 407c16fc77 eslint: Expand no-unused-vars check to all function parameters.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-02 16:16:38 -07:00
Aman Agrawal 5efa32be66 wildcard_mention: Don't highlight for unsubbed users. 2023-06-23 11:20:28 -07:00
Alex Vandiver 64b277d845 blueslip: Reduce cardinality of blueslip.error() calls.
Particularly when grouping in Sentry, pushing the ids and such into
the additional data section helps group like errors together better.
2023-05-09 13:16:28 -07:00
Deekshith S Shetty 596abf6190 popovers: Add Copied! tooltip when `copy code` button is clicked.
`copy code` button now show a `Copied!` tooltip when clicked.
It implements a similar function used on `saved as draft` notice.

We need to modify the copy_code_button template to limit
data-tippy-trigger to not include click; otherwise, repeated clicks to
copy code will incorrectly also display the "Copy code" tooltip
alternating with "Copied".

Fixes part of #21036.
2023-04-24 11:10:19 -07:00
Anders Kaseorg 96e657a954 install-node: Upgrade Node.js from 18.14.1 to 18.15.0.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 12:32:28 -07:00
Daniil Fadeev a0d15f3029 i18n: Localize date and time displays across the app.
Implemented date localization using native Intl object.
Created special function get_localized_date_or_time_for_format
Made necessary string formatting changes in 'timerender.ts'.
Fixed tests and added some localization tests too.

Tested on my local development server, with some random languages.

Fixes #23987.
2023-02-26 17:43:47 -08:00
Anders Kaseorg cea1119423 node_tests: Move to web/tests.
This lets us simplify the long-ish ‘../../static/js’ paths, and will
remove the need for the ‘zrequire’ wrapper.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-23 16:04:17 -08:00