Commit Graph

1112 Commits

Author SHA1 Message Date
Lalit ae6063807b ts: Convert `poll_data` to typescript.
Used zod schemas to validate inbound data types and removed some over
defensive code.
2023-07-06 16:21:52 -07:00
Lalit 3fb27c9b1c poll_data: Move `handler` class property inside the constructor.
Declares the `handler` property inside the class constructor and not
after the constructor to avoid eslint and typescript errors when we
convert this module to typescript.
2023-07-06 16:21:52 -07:00
Wladimir Ramos b80a205dbe
portico: Polish UI for portico pages copy-codeblock button.
* Add a Copy code tooltip.
* Add cursor pointer.
* Add a hover effect.
* Move variables to snake_case.

Fixes: #25962.
2023-07-06 16:18:59 -07:00
palashb01 4ce720f0da upload: Rename the switch case of close button to hide button.
With the previous commit, we now have two buttons. One button cancels
the upload, while the other simply hides the upload banner. This
commit renames the switch case inside upload.js so that instead of
'upload_banner_close_button', it is now called
'upload_banner_hide_button', which appears to be more aligned with
the actual functionality of the icon.
2023-07-06 16:11:09 -07:00
Palash Baderia 624fea2e8e upload_banner: Add a cancel button.
This commit adds a cancel button to the upload banner, replacing
the previous close icon. Now, the cancel button is used to cancel
the upload process, while the close icon is used to remove the
upload banner without interrupting the upload.

A new case has been added to the switch statement in the 'upload.js'
file to handle the functionality of hiding the banner called
'upload_banner_hide_button'.

Replaced the functionality of the 'compose_banner_close_banner' case
inside the switch statement with a new case called
'upload_banner_cancel_button'. The cancel button is now assigned
the selector 'upload_banner_cancel_button'.

`Cancel` button is only preset for banner which tracks
progress while a file is being uploaded.

To maintain consistency with other banners, the cancel button's
dimensions and color have been adjusted to match the style of other
buttons present in different banners.

Fixes: #21156
2023-07-06 16:11:09 -07:00
Ujjawal Modi a45853d313 streams: Warn when archiving a notification stream.
Archiving a user/stream notification stream disables
user/stream notifications.This commit adds a warning
that notifications will be disabled while archiving
any notification stream.

Fixes #22110.

Co-authored-by: Victor Fróes <71036803+vfroes21@users.noreply.github.com>
Co-authored-by: Isabella Carmo <isabella.carmo@hotmail.com>
2023-07-06 16:04:11 -07:00
Lalit 3b270ed159 popovers: Fix giphy being mocked but not used.
While running test for `popovers.js` we get warning that `giphy` is
mocked but never used.
This bug was introduced in #25676.
2023-07-06 10:34:40 -07:00
Aman Agrawal fa9fa9f7f2 stream_ui_updates: Check if sub/unsub button is rendered.
It might be possible that an event can come while we are in the
middle of rendering the stream settings overlay. This can cause
`hash_util.is_editing_stream(sub.stream_id)` to be `true` while
the `sub/unsub` button still hasn't been rendered yet.
2023-07-06 09:29:41 -07:00
Daniil Fadeev 9c675ce62d giphy: Migrate Giphy popover to Tippy. 2023-07-05 14:43:19 -07:00
Daniil Fadeev 4976655dda compose: Remove unused styles for `compose_gif_icon`. 2023-07-05 14:43:19 -07:00
Daniil Fadeev 37b9e96790 compose: Remove unused `hide` styles for `compose_control_button`.
We use the styles from `app_components.css`.
2023-07-05 14:43:19 -07:00
Lalit d44f7da1e1 dialog_widget: Remove redundant `preventDefault` calls.
Removes redundant `preventDefault` and `stopPropagation` calls for the
users of `dialog_widget.ts` module since we are already calling those
functions in the submit button click handler now.
2023-07-05 14:25:10 -07:00
Lalit d14caa8400 dialog_widget: Prevent default action when submitting the form.
We should prevent the default html behavior when submitting the forms
in the dialog_widgets to avoid reloading the whole page when the user
clicks the submit button.

Fixes: #26104
2023-07-05 14:25:10 -07:00
Joelute 086d6be8e2 unread_banner: Update all unread banners to an info/notice banner.
Previously, some unread banners were warning banners, but it made more sense
for all the unread banners to match and display as more of an info/notice
banners instead. This change matches all unread banners to be info/notice
banners.
2023-07-04 11:51:31 -07:00
Karl Stolley b98bae948c message_edit: Suppress message controls popover in edit views. 2023-07-03 21:51:20 -07:00
Karl Stolley 2508081a64 blueslip: Simplify expectOne error message.
This error is logged if there are 0 or 2+ elements, so the generic
language here is meant to cover both cases.
2023-07-03 21:50:38 -07:00
Sahil Batra e4dad94cba portico: Define variable for modal background color.
The CSS for modals uses "--color-background-color" to set
background color of modal. But the variable is defined in
zulip.css which is not available for portico pages and thus
the email visibility modal was not rendering as expected in
"Terms of service" page.

This commit defines the "--color-background-color" variable
in portico.css such that it is available for portico pages
as well.
2023-07-03 21:49:34 -07:00
Aman Agrawal 7b6d549604 compose_pm_pill: Fix `compose_recipient` being mocked but not used.
While running test for `compose_pm_pill` we get warning that
`compose_recipient` is mocked but never used.
This bug was introduced in #26052.
2023-07-03 21:48:58 -07:00
Aman Agrawal d547b838ac theme: Change recipient bar color and theme in the same paint.
`update_recipient_bar_background_color` changes in a paint
after change in theme without using `requestAnimationFrame` to
make sure they happen in the same paint..

Replaced `setTimeout` with `requestAnimationFrame` in
`server_events_dispatch` since `requestAnimationFrame` already
ensures that they happen in the next paint, assuming that was the
intention of `setTimeout` being preset there.
2023-07-03 21:47:45 -07:00
Lalit 1c8bf4f050 people: Make `get_by_user_id` type-safe.
We should make `get_by_user_id` type-safe in the sense that it's caller
should not expect undefined values and hence it's caller should not
need to validate the user ids.

To do this I extracted a method `maybe_get_user_by_id` which is
type-unsafe version of this function which will allow undefined values
and will behave exactly the same as the previous version. So the callers
which expects the undefined values from this function should use this
new function `maybe_get_user_by_id`.

Probably about half of these callers are implicitly iterating through
all users in the people.js data set and thus by construction should
never fail, but it's simpler to just convert all existing callers than
do that audit.
2023-07-02 16:57:16 -07:00
Lalit 9b0e7a3eae people: Add `make_user` helper function.
Made this function to avoid having incomplete `people` objects floating
around resulting in better type safety when using TypeScript. This function
has three required parameters - `user_id`, `email` and `full_name` and adds
default values to all other required properties.
2023-07-02 16:57:16 -07:00
Lalit 21ec6ff97f people: Extract `get_involved_people` function.
Also removed the `user_id` field in case of `stream` type messages in favor
of `id` field because it will help us to form a well-defined object for involved
people.
2023-07-02 16:57:16 -07:00
Lalit 5140b76f71 people: Use `location.origin` instead of just `location`.
Used `location.origin` instead of plain `location` because even though
passing just `location` is valid here and works because it has a
stringifier but still it will give us type error when we move this
module to TypeScript because of the expected `string` type here.
2023-07-02 16:57:16 -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
Sahil Batra 95f8ab1626 templates: Improve email confirmation page.
This commit updates the text on email confirmation page to
make it more clear what's going on and why the user needs
to check their email.

Fixes #25900.
2023-07-02 16:14:41 -07:00
Palash Baderia 987bbb641f message_feed: Fix edited notice to appear for disabled edit_history.
This commit fixes the bug where the edited notice is not displayed
for edited/moved messages when the edit_history is disabled for
the organization. However, this is incorrect because the edited
notice should still be shown for messages that are edited/moved,
even if the edit_history is disabled. This issue occurred because
the edit_history variable was not set in the message object when
the edit_history is disabled. Therefore, in this case, we check
for the availability of last_edit_timestr. If it is available, we
display the edited notice. Since we cannot determine if the message
was moved or edited, we show the edited notice for both cases.
2023-06-30 17:33:45 -07:00
Sahil Batra 632191b8c4 composebox_typeahead: Hide user groups from mention typeahead.
This commit adds code to hide the user groups which a user is
not allowed to mention from the mention typeahead.

Fixes a part of #25927.
2023-06-30 17:28:33 -07:00
Sahil Batra 767c2ebbe4 user_groups: Add can_mention_group_id field to user_group objects.
This commit adds can_mention_group_id field to user_group objects
in webapp.

Fixes a part of #25927.
2023-06-30 17:28:33 -07:00
Sahil Batra e6accb0ad9 user_groups: Add can_mention_group_id field to UserGroup objects.
This commit adds code to include can_mention_group_id field to
UserGroup objects passed with response of various endpoints
including "/register" endpoint and also in the group object
send with user group creation event.

Fixes a part of #25927.
2023-06-30 17:28:33 -07:00
evykassirer 9265954fd2 search: Fix bug where textarea placeholder text didn't update for DMs.
When c0e9e463fb was merged, the
placeholder text started updating *before* we updated the recipient
information, so it wasn't updating with correct data. This commit
fixes that by moving the onPillCreate() call below the update.
2023-06-30 12:20:26 -07:00
evykassirer 367030ebfe search: Stop disabling and enabling the search close button.
This is logic from 10 years ago (dbc4798594)
that is no longer relevant. It seems like we used to show the
search bar open all the time and only showed the buttons when
there was focus in the search bar. Now we close the search bar
when it's not being used, and no longer need to update button
visibility or disable the search close button.
2023-06-30 12:05:30 -07:00
Anders Kaseorg a07bdb3fdb recent_topics_data: Simplify .entries() loop to .values().
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-06-29 15:54:40 -07:00
Karl Stolley 7f4fe7282f search: Adjust text in has: message suggestions. 2023-06-29 13:02:06 -07:00
Karl Stolley 0c55fb7e89 stream_settings: Fix scroll at max-height.
Simplebar seems unaware of the `max-height: 1000px` on
`.subscriptions-container`, and therefore does not properly provide
a scrollbar when it's needed.

This commit adds a `max-height` to the stream Simplebar container,
ensuring that otherwise hidden content that Simplebar believes to
be visible can be scrolled to.

Finally, rather than rely on magic numbers or math done in comments,
this commit establishes CSS variables for all relevant modal-element
heights, doing the math inline using CSS calc().

Fixes #26107.
2023-06-29 11:19:01 -07:00
Lalit 1676d0b638 settings_emoji: Fix file upload bug in upload emoji modal.
Before this commit if a user pressed enter to submit the add emoji form
the uploaded emoji was getting cleared.

This was happening because when we pressed enter the browser tried to
submit the form, because we had two buttons inside that form one for
clearing uploaded emoji and one for uploading emoji they were being
treated as "submit" button and hence their callback ran which in result
was responsible for the bug.

Fixed this by explicitly setting the `type` attribute for those buttons
to `type=button` so that they will not be treated as "submit" button.
Also added the `form_id` option for `dialog_widget` which is needed if
we do want to correctly submit the form by pressing enter.

Fixes: #24972
2023-06-29 10:16:28 -07:00
Lauryn Menard 0d1c43d1d9 server-events: Remove unused home_view_loaded.zulip event trigger.
In commit 92ad988144, we removed the local echo code that tried
to re-render locally echoed messages that were rendered right before
a server/browser restart. These changes removed the only event
triggered by `"home_view_loaded.zulip"`.

This removes the remaining `"home_view_loaded.zulip"` event trigger
in web/src/server_events.js since it no longer triggers any events.
2023-06-27 18:04:04 -07:00
evykassirer c4de46d910 navbar: Fix background-color inconsistency in dark theme. 2023-06-27 11:28:49 -07:00
Daniil Fadeev 74c8852233 giphy: Set focus to the query input after clearing it.
These changes improve keyboard navigation in the Giphy popover.

Fixes: #26096.
2023-06-27 11:06:28 -07:00
Lauryn Menard 0d16683c5f rendered-markdown: Update reference to "private message" in comment.
Updates a code comment to use "direct message" instead of "private
message".
2023-06-27 11:03:17 -07:00
Evy Kassirer adcf088740
filter: Rename describe to search_description_as_html.
Changing this since wobbly naming on HTML variables is dangerous.
2023-06-26 11:11:17 -07:00
Lauryn Menard c8b04fc562 web-shared: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/shared`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Lauryn Menard 85096cfb4d web-styles: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/styles`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Lauryn Menard 73e5812831 node-tests: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/tests`
directory to instead use "direct messages".
2023-06-26 11:07:28 -07:00
Lauryn Menard 7c47616ffa web-e2e-tests: Update references to "private message" and "PM".
Updates any use of "private message" and "PM" in the `web/e2e-tests`
directory to instead use "direct messages" or "DM".
2023-06-26 11:07:28 -07:00
Lauryn Menard 4d3d9bcefa web-src: Update comments with "private message" or "PM".
Updates comments in files the `web/src` directory to use "direct
message" instead of "private message" or "PM".
2023-06-26 11:07:28 -07:00
Lauryn Menard 5be0f80135 recent-topics-ui: Rename constant for direct message columns.
Renames constant for the number of direct message columms from
`MAX_SELECTABLE_PM_COLS` to `MAX_SELECTABLE_DIRECT_MESSAGE_COLS`.
2023-06-26 11:07:28 -07:00
Lauryn Menard 842623c294 unread: Update class name for unread direct message counter.
Renames the class name in `web/src/unread.js` from `UnreadPMCounter`
to `UnreadDirectMessageCounter` and renames the associated instance
of `unread_pm_counter` to `unread_direct_message_counter`.
2023-06-26 11:07:28 -07:00
Lauryn Menard 4b2b278a53 dm-conversations: Update direct message data structure name.
Updates data structure class name in `web/src/pm_conversations.js`
from `RecentPrivateMessages` to `RecentDirectMessages`.
2023-06-26 11:07:28 -07:00
Lauryn Menard 3c6d283aa9 compose-actions: Update trigger for composing a new direct message.
Updates the trigger in the compose box from "new private message"
to "new direct message".
2023-06-26 11:07:28 -07:00
Zixuan James Li dd3fad4b30 mute users: Remove leftover check for muting bot users.
This was missed in #26005. The user popover button does not appear
for bot users. We complete the TODO here and simplify the
calculation for show_manage_menu so that we always show it if not in
spectator view and not showing the popover for self.
2023-06-26 11:01:40 -07:00