Commit Graph

50927 Commits

Author SHA1 Message Date
Alex Vandiver daba72c116 error_notify: Drop any remaining browser-side errors in RabbitMQ queue. 2023-04-13 14:59:58 -07:00
Alex Vandiver e536a14b61 report_error: Remove API endpoint for client error reporting. 2023-04-13 14:59:58 -07:00
Alex Vandiver cb7bc1b7b9 report_error: Remove reference to old non-existant path. 2023-04-13 14:59:58 -07:00
Alex Vandiver 2d5c678614 blueslip: Only show in dev mode, or report to Sentry.
This removes the production reporting to `/json/report/error` upon
`blueslip.error`, and replaces it with reporting to Sentry, if
enabled.  Sentry provides better reporting and grouping for exceptions
than the email- and `#errors`-reporting provided by the
`/json/report/error` endpoint.

The development behaviour of rendering `blueslip.error` messages and
stacktraces immediately, and stopping execution, is preserved.

To better chain exception information, the whole previous exception is
passed to `blueslip.error`, not just the stack, and the second
parameter is formalized to be an object to map to Sentry's "context"
concept.
2023-04-13 14:59:58 -07:00
Alex Vandiver f9f7c7b114 docs: Document Sentry frontend reporting. 2023-04-13 14:59:58 -07:00
Alex Vandiver 7152278463 blueslip: Remove unused blueslip.timings store.
This was a write-only store which was never accessed.
2023-04-13 14:59:58 -07:00
Alex Vandiver 6882ec8087 blueslip: Remove unused preview_node.
It is unused, and an XSS waiting to happen if misused.
2023-04-13 14:59:58 -07:00
Alex Vandiver 52c4cae239 blueslip: Remove unused ui_message / show_ui_msg codepath.
This was last used in 71e14674aa, a decade ago.
2023-04-13 14:59:58 -07:00
Alex Vandiver 1833afee6a js: Enable cross-origin error debugging with crossorigin="anonymous".
If the script comes from a different origin than the requesting page,
and is not marked `crossorigin="anonymous"`, the `window.onerror`
handler receives no information other than "Script error." in the
event of a runtime error.

This effectively silences blueslip errors in development if the user
is developing on a remote host (such as a DigitalOcean droplet), since
static resources are served from `hostname.zulipdev.org`, and the
realm is served from `realmname.hostname.zulipdev.org`.  It also
silenced blueslip reporting in production for any non-default (non-"")
realms.  Sentry reporting, Vagrant developments, and truly ancient or
insecure browsers were unaffected.

Add the necessary `crossorigin="anonymous"` attribute to the
`<script>` tag to allow blueslip access to this error information.
2023-04-13 14:59:58 -07:00
Joelute a96cfb58bd timerender: Remove "Active just now" user status.
Currently, we only show the "Active just now" status once a user has gone
offline within the last 2 minutes. This ends up never showing up the
threshhold which the client marks an user as user is longer than 3 minutes.
Thus deemingthe user status as useless. After a discussion on CZO, it was
decided that we should remove this status altogether as the phrasing doesn't
make sense as well.
2023-04-13 14:59:08 -07:00
Joseph Ho 1e98a659c1 timerender: Revert extra changes to time in recent conversations.
In #25012, which was intended to only modify the buddy list, we
accidentally changed the rendering of times for several other code
paths, including recent conversations, that were using the
last_status_from_time function, whose name really suggested it only
was used for the buddy list.

Extract a new function with a better name for the more common relative
time use case.
2023-04-13 14:59:08 -07:00
PALASH BADERIA 85029d604a
tippy: Use delay on all compose and message feed tooltips.
Currently, most of the Tippy tooltips on icons in both the message feed
and the compose box have a delay, so they don't appear immediately
on hover, which can be distracting.

This commit adds this same delay to a few elements in these components
that had an inconsistent essentially 0 delay; the buttons located on the right side
of the compose box as well as the messagebox copy codeblock button tooltip.

Fixes part of #24825.
2023-04-13 13:16:18 -07:00
Daniil Fadeev a385f65126 tooltips: Fix text overflowing. 2023-04-13 11:29:11 -07:00
sayamsamal 9f6f77f6bc icons: Change bot icon from GitHub logo to Google material icon.
We currently use the GitHub logo to show the bots settings in both
personal and organization settings. This icon is not a correct
representation since we use have support for several different bots
including but not limited to a GitHub integration bot.

This commit replaces the GitHub logo with Smart Toy material icon
from Google, while also adding the required licencing details at
docs/THIRDPARTY.

Part of #19797.
2023-04-13 10:47:09 -07:00
Sahil Batra c29ccb6a3f app_components: Refactor css from stream-privacy-type-icon.
This commit refactors the CSS for stream-privacy-type-icon
element to avoid duplication.
2023-04-13 10:46:14 -07:00
Sahil Batra 2b84b86027 templates: Fix vertical alignment of globe icon.
This commit fixes the vertical alignement of globe icon in
inline_decorated_stream_name template by setting it using
relative units instead of px so that it is better aligned
at multiple places with different sizes.
2023-04-13 10:46:14 -07:00
Sahil Batra 66b6151f61 dropdown_list_widget: Add privacy icons for stream options.
This commit adds privacy icons before the stream names in
dropdown-list widget for "New user announcements",
"New stream announcements" settings and for stream dropdown
in "Move message" and "Move topic" modal.

Fixes part of #22355.
2023-04-13 10:46:14 -07:00
Sahil Batra 067c71adc4 templates: Use new lock and hashtag icons for stream privacy.
This commit updates inline_decorated_stream_name template to
use the new lock and hashtag icons for stream privacy added
in 8c744752.
2023-04-13 10:46:14 -07:00
Anders Kaseorg b3a185103d ruff: Enable new lints INT, PYI.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-12 17:32:38 -07:00
Anders Kaseorg bb2c0ad3bf ruff: Enable Django rules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-12 17:32:38 -07:00
Anders Kaseorg 0a3dc8a944 ruff: Fix DJ012 Order of model's inner classes, methods, and fields.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-12 17:32:38 -07:00
Alex Vandiver cdaf12da44 jinja2: Make sure that 500 pages have support_email set. 2023-04-12 16:41:07 -07:00
Daniil Fadeev 40f0663d9d emails: Fix background-color styling.
This issue was introduced after we changed the library we use for
inlining CSS into email HTML. For some reason, the styles in
email.css were not applied earlier but were applied after we
migrated to css-inline. With this commit, we have fixed the
regression in background-color of email body.

Fixes #25083.
2023-04-12 15:48:32 -07:00
Daniil Fadeev f5190ea4de emails: Fix footer styling.
This issue was introduced after we changed the library we use for
inlining CSS into email HTML. For some reason, the styles in
email.css were not applied earlier but were applied after we
migrated to css-inline. With this commit, we have fixed the
regression in footer styles.

Fixes part of #25083
2023-04-12 15:48:32 -07:00
evykassirer b07bc23e07 upload: Separate uploads into one upload bar per file.
Fixes #24287.
2023-04-12 15:42:07 -07:00
evykassirer 4e7f9100fc upload: Rename hide_upload_status to hide_upload_banner.
This will be clearer naming for when there are multiple banners,
but is likely a more intuitive name even for the current state
of the code.
2023-04-12 15:42:07 -07:00
Joelute be38730d05 time_picker: Set minutes to zero in global time picker.
Usually when a user uses the time picker, they're most likely going to
set the time to the hour rather than the current minute. These changes
will set the minutes to zero whenever we are opening the global time
picker.

Fixes: #23874.
2023-04-12 15:39:49 -07:00
Alex Vandiver d0fc3f1c2e puppet: Add prod hooks to push zulip-cloud-current and notify CZO. 2023-04-12 11:36:33 -07:00
Lauryn Menard 8552ff677d search: Improve suggestions for `is:resolved` and `group-pm-with`.
Improves suggestions to not include `is:resolved` for searches
that have already specified a narrow with direct messages, since
there are no topics for direct messages. And improves suggestions
for searches that already have `is:resolved` to not include options
that narrow to direct messages.

Improves suggestions to not include `group-pm-with` for searches
that have already specified a narrow for stream messages. And
improves suggestions for searches that already have `group-pm-with`
to not include options that narrow to stream messages.
2023-04-12 11:32:52 -07:00
Lauryn Menard b9023db04e node-tests: Remove mock of `topic_list` in `topic_list_data.test`.
With commit f0d1332ba2, we no longer need to mock `topic_list.js`
in the `topic_list_data` node test. Instead, we can pass a string
directly to that function. The default is an empty string unless
there is a search input. Also, updates the default of the zoom to
be false instead of undefined in the tests.
2023-04-12 11:30:56 -07:00
Anders Kaseorg 9ed1c79f1b dependencies: Downgrade autosize to 5.0.2 to fix scrollbar regression.
https://chat.zulip.org/#narrow/stream/9-issues/topic/compose.20box.20scrollbars/near/1531138

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-11 21:21:34 -04:00
Tim Abbott c43d551c5f Revert "markdown: Fix lists with 3+ digit markers retaining alignment for 2 digits."
This reverts commit d0f9e23ec6.

This didn't work correctly for lists containing more complex syntax inside.
2023-04-11 16:07:17 -07:00
Alex Vandiver f34509bbdd tippyjs: Only destroy tippy popups if they exist at all. 2023-04-11 14:34:53 -07:00
N-Shar-ma 4e2931cefd compose: Disable "Message X" button for DMs when DMs are not allowed.
When in a private narrow, the "Message X" button is disabled if direct
messages are not allowed in the organisation and the current recipient
is not a bot.

Note that when the recipient is a user group with 1, more or all bots,
the button is disabled then too as such PMs are not allowed. Only when
the recipient is a single bot, then it's not disabled, as DMs with one
bot are allowed even in organisations where DMs are disabled.
2023-04-11 11:35:37 -07:00
Sahil Batra 6e4c844907 tests: Fix comment about number of database queries.
This commit fixes the comment about number of database queries
when moving message from muted topic to mention clearly about
the number of queries added due to original topic being muted.

We do not include the queries that is executed to check whether
the topic is muted or not, as they will be executed in all cases.
2023-04-11 11:07:23 -07:00
Sahil Batra f9eff1c478 stream_popover: Disable topic input in "Move topic" modal.
This commit adds code to disable the topic input in "Move topic"
modal if user cannot edit topics as per edit_topic_policy setting.
We do not check time-based permissions here as the first message
of the object may not be available. This commit also fixes a small
typo in the comment for that code along with updating the comment
to mention about disabling topic input.
2023-04-11 11:07:23 -07:00
Sahil Batra 6dc54d3738 message_edit: Show modal when trying to move older messages.
If user tries to move messages older than the allowed time limit,
we show a confirmation modal stating that the older messages will
not be moved and only the alloed messages are moved if user clicks
on "Confirm" button.
2023-04-11 11:07:23 -07:00
Sahil Batra bd7f728796 message: Don't allow moving messages that have passed the time limit.
We previously allowed moving messages that have passed the time limit
using "change_all" value for "propagate_mode" parameter. This commit
changes the behavior to not allow moving messages (both stream and
topic edit) that have passed the time limit for non-admin and
non-moderator users.
2023-04-11 11:07:23 -07:00
Sahil Batra 440f9e397a message_edit: Apply topic edit restrictions to "(no topic)" messages.
Previously, editing topic of "(no topic)" messages was allowed
irrespective of time limit or the "edit_topic_policy" setting.
Since we are working in the direction of having "no topic" messages
feel reasonable, this commit changes the code to not consider them
as a special case and topic editing restrictions apply to them as
well now like all other messages.

We still highlight the topic edit icon in recipient bar without
hovering for "no topic" messages, but it is only shown when user
has permission to edit topics.
2023-04-11 11:07:23 -07:00
N-Shar-ma 61fa24fd5e compose: Have at least 1 new line before and after a giphy gif.
Until now, a giphy gif was inserted in an inline manner, but now we insert
it as a block, with 0 blank lines before and after it.
2023-04-11 10:40:19 -07:00
N-Shar-ma 64ec503994 compose: Have at least 1 new line before and after an attachment.
Until now, an attachment was inserted in an inline manner, but now we
insert it as a block, with 0 blank lines before and after it.
2023-04-11 10:40:19 -07:00
N-Shar-ma 2961da5ea0 compose: Have at least 1 new line before and after a video call link.
Until now, a video call link was inserted in an inline manner, but now
we insert it as a block, with 0 blank lines before and after it.
2023-04-11 10:40:19 -07:00
N-Shar-ma 9d4cec6e87 compose: Make count of new lines inserted around content block customizable.
Until now, we had been inserting a hard-coded number of new lines before
and after a quoted message. Now we replace that with an optional parameter
to make it customizable for different use cases.

This is a preparatory commit for the next commits, which will allow
inserting other elements as a block in the compose box.
2023-04-11 10:40:19 -07:00
Hardik Dharmani 7105a232aa topics_sidebar_actions: Update topics_sidebar to include unmute option.
Updated topics_sidebar_actions.hbs to include a option to add/remove
unmute visibility_policy for a topic is in a muted stream,
if in development environment.

Added 2 new classes sidebar-popover-unmute-topic and
sidebar-popover-remove-unmute for unmute topic option. Also, Renamed
previous sidebar-popover-unmute-topic to sidebar-popover-remove-mute.

Added 4 new click handlersthat uses
user_topics.set_user_topic_visibility_policy() to update
topic's visibility_policy.

Fixes #24244
2023-04-11 09:51:01 -07:00
Hardik Dharmani aab252f657 user_topics: Update user_topics.js to include all visibility policies.
Updated user_topics.js to include all visibility policies
rather than just mute/inherit visibility policies.

Replaced muted_topics Map with `all_user_topics` Map which has
structure: {stream_id:{topic_name:{date_updated,visibility_policy}}}.

Removed add_muted_topic, remove_muted_topic functions which were
adding/removing topics in muted_topics Map. Added new function
update_user_topics which take parameter stream_id, topic,
visibility_policy, and date_updated(optional) which adds a topic
to all_user_topics with date_updated and visibility_policy,
if visibility_policy is not equal to inherit.
else, removes topic from all_user_topics.

Added get_topic_visibility_policy which returns visibility_policy
if stream_id is not undefined else return false.

Added 2 helper functions is_topic_muted and is_topic_unmuted which
uses get_topic_visibility_policy and return true if topic is
muted and unmuted respectively else return false.

Replaced switch case statement which was using add_muted_topic
and remove_muted_topic functions in set_user_topic with new function
update_user_topics.

Fixes #24244
2023-04-11 09:51:01 -07:00
Hardik Dharmani 46cabdd59e user_topics: Use new API endpoint to update topics_visibility_policy.
Removed functions mute_topic and unmute_topic in muted_topics_ui.js
which were using old API endpoints to mute/unmute topics.

In user_topics.js added new function set_user_topic_visibility_policy
which uses new API endpoint `/user_topics` to update the topic's
visibility_policy to visibility_policy passed to
set_user_topic_visibility_policy function as a parameter.

In functions toggle_topic_mute and mute_or_unmute_topic, replaced
the calls of mute_topic and unmute_topic with the new
user_topics.set_user_topic_visibility_policy function.

Added "web/src/user_topics.js" in EXEMPT_FILES in test-js-with-node
as adding function `set_user_topic_visibility_policy` resulted in
user_topics.js losing 100% test coverage.

Fixes #24244
2023-04-11 09:51:01 -07:00
Hardik Dharmani 83fae2f710 user_topics: Rename global map visibility_policy to all_visibility_policies.
Fixes #24244
2023-04-11 09:51:01 -07:00
Sahil Batra e010cb3d5a settings_config: Add "Nobody" group option to system_user_groups_list.
This commit adds "Nobody" group option to system_user_groups_list in
settings_config.js. We do not allow can_remove_subscribers_group to
be set to "Nobody" group currently, but it is nice to add support
for this here since it will be used in more settings in future.
2023-04-11 09:02:09 -07:00
Sahil Batra 9278a219ea user_groups: Refactor get_realm_user_groups_for_dropdown_list_widget.
This commit refactors get_realm_user_groups_for_dropdown_list_widget
function to use "group_permission_settings" module instead of
passing variables like "allow_internet_group", etc. individually
for each settings.

We lose some test coverage due to this commit, but that would be
fixed when we add some more group-based settings and allow groups
other than system groups in the group based settings.
2023-04-11 09:02:09 -07:00
Sahil Batra a5cbf95c12 settings: Add group_permission_settings.ts.
This commit adds a new module group_permission_settings.ts
which is used to define configuration options like
allow_owners_group, allow_nobody_group, etc. for group-based
settings similar to GroupPermissionSetting dataclass we have
in backend.
2023-04-11 09:02:09 -07:00