Commit Graph

57025 Commits

Author SHA1 Message Date
Karl Stolley 2df6b6c02a rendered_markdown: Present REPL and Copy buttons with modern techniques.
This also removes the `.btn` class and interference from Bootstrap
on the code Copy buttons.

Fixes: #29165
2024-03-11 15:38:03 -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
Alex Vandiver d460743705 realm_activity: Correct the "messages sent" column. 2024-03-11 14:39:03 -07:00
Aman Agrawal 73370087ed message_feed_top_notices: Simplify check for all message view. 2024-03-11 14:14:36 -07:00
Aman Agrawal fa8b7d898b stream_muting: Refactor to not use message_lists.home. 2024-03-11 14:14:34 -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
Aman Agrawal 19af746ce4 reload: Avoid using message_lists.home. 2024-03-11 14:13:26 -07:00
Aman Agrawal 5548a28980 message_fetch: Allow spectators to access all messages view. 2024-03-11 14:13:26 -07:00
Aman Agrawal 2b12c8b4b9 narrow: Fix comment. 2024-03-11 14:13:26 -07:00
Aman Agrawal 8204abf1ce unread_ops: Minor refactor. 2024-03-11 14:13:26 -07:00
evykassirer 03ec788a91 typeahead: Move module to web/src. 2024-03-11 09:56:18 -07:00
evykassirer a55979ebf8 typeahead: Fix buggy advanceKeyCodes code.
The `advanceKeyCodes` option was introduced in #10092.
It included a buggy check for `$.inArray` that returned
a falsey value only when the keycode was the first
element of `advanceKeyCodes`.

Because the only instance of `advanceKeyCodes` right now
is for search and contains only one element, this change
is functionally equivalent.
2024-03-11 09:56:18 -07:00
evykassirer 99c119b01b typeahead: Add missing option to lookup call. 2024-03-11 09:56:18 -07:00
evykassirer 593784b35f typeahead: Remove unused on_move option. 2024-03-11 09:56:18 -07:00
evykassirer aa4e92ee18 typeahead: Stop using html() to set value from updater().
I confirmed that updater() only returns a string or undefined.

composebox_typeahead.js

- compsebox calls `content_typeahead_selected` which returns the composebox
  text content
- stream and PM: implicitly returns undefined

pill_typeahead.js

- implicitly returns undefined

search.js

- narrow_or_search_for_term — returns `get_search_bar_text` or empty string

custom_profile_fields.js, settings_playground.js

- no updater function

If no updater function is provided, then updater returns the
value passed to it, which is
`this.$menu.find(".active").data("typeahead-value")`, which is a string.
2024-03-11 09:56:18 -07:00
evykassirer 30ecf6fafd typeahead: Don't call html with a jquery object.
This is helpful beyond appeasing the linter, because TypeScript only
[permits](https://unpkg.com/browse/@types/jquery@3.5.29/JQuery.d.ts#L5287)
`.html(…)` to accept a `string` or `HTMLElement` argument (or
function returning those), not JQuery. The behavior with a JQuery
argument is also [undocumented](https://api.jquery.com/html/#html2).
2024-03-11 09:56:18 -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
evykassirer 7219e3835d typeahead: Confirm that header text is safe html.
All current definitions of header(), which is renamed to
header_text() in this commit:

composebox_typeahead.js
- `get_header_html` uses `_.escape`
- `render_topic_typeahead_hint` — is a handlebars function
- third typeahead doesn’t have a header function

custom_profile_fields.js, pill_typeahead.js, search.js,
and settings_playground.js have typeaheads, but none of them
have header functions.
2024-03-11 09:56:18 -07:00
evykassirer 135395e8ce typeahead: Remove unused header_html option. 2024-03-11 09:56:18 -07:00
evykassirer babe525b5c linter: Add _html as a variable name for safe html. 2024-03-11 09:56:18 -07:00
evykassirer 60018dfd12 typeahead: Use text() instead of html() in set_value.
This particular codepath is never reached right now,
because set_value is only called when `naturalSearch`
is `true`, and the only instance of `naturalSearch`
isn't for a `contenteditable` field.

But we don't need to use `html()` here because it's
displaying a plain string typeahead option.
2024-03-11 09:56:18 -07:00
evykassirer 099810e80f typeahead: Import jquery instead of passing it to a wrapper function. 2024-03-11 09:56:18 -07:00
evykassirer 827b42dd9f typeahead: Replace substring with slice.
https://github.com/sindresorhus/eslint-plugin-unicorn/blob/main/docs/rules/prefer-string-slice.md
2024-03-11 09:56:18 -07:00
evykassirer d131f4119f typeahead: Remove unused `hideOnEmpty` option. 2024-03-11 09:56:18 -07:00
evykassirer dc4244b9d8 typeahead: Rename e to event for legibility. 2024-03-11 09:56:18 -07:00
evykassirer 6d30e3e01c typeahead: Stop using deprecated window.event.
See https://developer.mozilla.org/en-US/docs/Web/API/Window/event
for more about this.
2024-03-11 09:56:18 -07:00
evykassirer 8986846436 typeahead: Remove unnecessary that = this.
This isn't needed with arrow functions.
2024-03-11 09:56:18 -07:00
evykassirer 331efb0def typeahead: Refactor to avoid no-case-declarations issue. 2024-03-11 09:56:18 -07:00
evykassirer e12543f957 typeahead: Use const instead of let when not reassigned. 2024-03-11 09:56:18 -07:00
evykassirer 0a321f5e16 typeahead: Fix no-jquery/variable-pattern. 2024-03-11 09:56:18 -07:00
evykassirer 40b4db3323 typeahead: Refactor switch statements to avoid fallthrough. 2024-03-11 09:56:18 -07:00
evykassirer ff1f62bc56 typeahead: Use ?? instead of ||. 2024-03-11 09:56:18 -07:00
evykassirer 64b262d514 typeahead: Replace empty backup functions with inline functions. 2024-03-11 09:56:18 -07:00
evykassirer bb68dde1da typeahead: Use `startsWith` instead of a falsey index check. 2024-03-11 09:56:18 -07:00
evykassirer b034875216 typeahead: Replace ~ operator with includes().
Before ES2016, `indexOf` and jQuery's `inArray`
were used more often. They return -1 for a missing
element, and 0 is the only integer that’s falsy, so
-1 is the only integer whose bitwise complement is
falsy. Using bitwise not (~) like this is no longer
common practice and is a lot more confusing to read.
Now that we have `includes` we can use that instead.
2024-03-11 09:56:18 -07:00
evykassirer 2085d90736 typeahead: Change unused expression to just function calls. 2024-03-11 09:56:18 -07:00
evykassirer 624a879b4e typeahead: Remove unused variables. 2024-03-11 09:56:18 -07:00
evykassirer bcdde201ec typeahead: Use !== instead of !=. 2024-03-11 09:56:18 -07:00
evykassirer 7ccb833b35 typeahead: Run prettier for automatic format cleanup. 2024-03-11 09:56:18 -07:00
evykassirer 99ee72860e typeahead: Run eslint for automatic format cleanup. 2024-03-11 09:56:18 -07:00
Jerry Yang 8a257d59e1 docs: Fix typo in screenshot and gif software tutorial.
Remove the redundant closing bracket in the Gifski link.
2024-03-11 09:26:08 -07:00
Alex Vandiver 6e91e326e9 deferred_work: Reduce batch size due to bad statistics.
PostgreSQL's estimate of the number of usermessage rows for a single
message can be wildly off, due to poor statistics generation.  This
causes this query, with 100-message batch sizes, to incorrectly
estimate millions of matched rows, causing it to perform a full-table
index scan, rather than piecemeal using the `message_id` index.

Reduce the batch size to 50, which is enough to tip in favor of a
rational query plan.
2024-03-11 09:24:59 -07:00
sujal 29ca4ba662 stream_settings: Convert name to pills.
Convert anchor tag to pills containing an image/avatar
and username within both existing and new stream
subscriber member lists and group member lists
using the new user_display_only_pill.hbs template.
If user has long username that breaks the UI,
overflow is handled with ellipsis.
add a context class (panel_subscriber_member_list)
to add 'padding 5px'to 'pill_value' for stream
subscriber member list and group member list.

To retrieve  an avatar of a user add a
'img_src: people.small_avatar_url_for_person(user/person)'
field in 'stream_editsubscriber.js', 'user_group_edit_members.js',
'stream_create_subscribers.js' and 'user_group_create_members.js'.

Fixes: #25724.
2024-03-08 17:33:14 -08: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
Alex Vandiver 5123477d55 upgrade-zulip-from-git: Provide a flag to use a local branch.
While this could be done previously by calling
`upgrade-zulip-from-git --remote-url /srv/zulip.git`, the explicit
argument makes this more straightforward, and avoids churning the
`refs/remotes/origin/` namespace.
2024-03-08 12:15:25 -08:00
Tim Abbott 6e18c84048 policies: Repeat that we do not sell Personal Data. 2024-03-08 11:58:49 -08:00
Mahhheshh 073b70a516 csp_violations: Migrate has_request_variables to typed_endpoint.
Refactor `report_csp_violations` view to use `typed_endpoint` decorator
instead of `has_request_variables`. This change improves code
consistency and enhances codebase comprehension.
2024-03-08 11:26:00 -08:00
Temidayo32 11e498f937 resize_handler: Convert module to Typescript. 2024-03-08 10:49:52 -08:00
Alex Vandiver b0283c42f9 create-database: Treat "zulip" db without "zerver_messages" as empty.
A user who somehow got an empty `zulip` database, but without a
`zerver_messages` table in it, would get stuck in the installer at:

```
++ su postgres -c 'cd / && psql -v ON_ERROR_STOP=1 -Atc '\''SELECT COUNT(*) FROM zulip.zerver_message;'\'' zulip'
ERROR:  relation "zulip.zerver_message" does not exist
LINE 1: SELECT COUNT(*) FROM zulip.zerver_message;
                             ^
+ records=
```

Treat a failure to select from `zerver_messages` as having 0 messages,
and continue with the `DROP DATABASE IF EXISTS` / `CREATE DATABASE`
that `create-db.sql` usually does.

Fixes: #29110.
2024-03-08 10:10:19 -08:00
Lauryn Menard 4d470a52f8 remote-support: Highlight if audit log data is stale or current.
Includes has_stale_audit_log boolean in the remote support view
data so that we can style the last audit log data for the remote
server to visually highlight if it is stale or current.
2024-03-08 09:40:43 -08:00