Commit Graph

739 Commits

Author SHA1 Message Date
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
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
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
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 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 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
Aman Agrawal 8c744752ed stream_privacy: Use new lock and hashtag icons.
This commit doesn't modify the lock and hashtag icon in settings.
2023-04-10 23:41:30 -07:00
Aman Agrawal bc8d136d5c css: Implement new design for recipient row.
This mostly includes the CSS changes for recipient row design,
most of the HTML and JS changes are present in previous commits to
this.
2023-04-10 23:41:30 -07:00
Aman Agrawal 3711d0ae69 message_list: Update recipient bar color on theme change. 2023-04-10 23:41:30 -07:00
Aman Agrawal 4b35164bca recipient_row: Add a user icon at start of PMs. 2023-04-10 23:41:30 -07:00
Aman Agrawal 819bf9b2aa recipient_row: Add `>` icon between stream name and topic. 2023-04-10 23:41:30 -07:00
Aman Agrawal 7e473003a6 recipient_row: Use a dimmed stream color for background.
Following important changes are being made here:
* color_class lib is removed since it not used anywhere now.
* We don't need the `dark_background` class since the background
  color is already adjusted based on color scheme. So, all
  instances of it being used is removed.
2023-04-10 23:41:30 -07:00
Aman Agrawal 023584e049 recipient_row: Set color of privacy icon as a shade of stream color. 2023-04-10 23:41:30 -07:00
Aman Agrawal ff6d04f88c drafts: Use generic template to show stream icon. 2023-04-10 23:41:30 -07:00
Aman Agrawal 12ac459379 recipient_row: Use generic template to show stream icon.
stream_privacy template has conditions to show stream privacy icon
for all the cases, so we use it here since we also want to show
`#` icon for public streams.
2023-04-10 23:41:30 -07:00
Aman Agrawal 17a4140773 ui_util: Extract listener for change in `preferred-color-scheme`.
This will further be used for recipient bar colors since they
have different colors in dark and light color scheme.
2023-04-10 23:41:30 -07:00
Aman Agrawal 397ca97060 stream_color: Remove redundant `update_historical` option.
This option has no significance anymore. Both the callers to this
function pass it as `true`, so it is always true when it is being
run.
2023-04-10 23:41:30 -07:00
Aman Agrawal e37f5082de recipient_row: Remove message-header-wrapper div.
This div serves no purpose. Just removed the div and shifted
corrected alignment for other divs.
2023-04-10 23:41:30 -07:00
N-Shar-ma d0f9e23ec6 markdown: Fix lists with 3+ digit markers retaining alignment for 2 digits.
Until now, lists with 3+ digit markers would have their beginnings cut off
to align with 2 digit markers. We fix that by having custom styling for
markers where we align markers only up to 2 digits, and let larger numbers
take up more space pushing the list item content forward as required to fit
the marker.
2023-04-10 21:54:51 -07:00
Lakshay Mittal 4478f8cc55 local echo: Fix tooltip over locally echoed spinner.
Despite the timestamp being hidden while sending the message, the link
on the timestamp (message url) was still hoverable and clickable, and
had a tooltip.

Here we disable the tooltip, but
https://github.com/zulip/zulip/issues/25069 remains open for the link
part.
2023-04-10 17:36:26 -07:00
Lakshay Mittal e86fe4e57c messages: Add spinner for messages sent on slow connections.
At times, it might get confusing for users who are on
slow connections if their messages has not been sent
even after 5s. Including a spinner that will only show
up after 5 seconds has elapsed will keep user informed
about their slow connection.

5s is set as minimum time because showing up a spinner
before than might be distracting for users on normal
connections.

Fixes: #19328.
2023-04-10 17:36:26 -07:00
Mateusz Mandera 1a15449e16 support: Rename "downgrade plan" to "modify plan".
Just a naming change to facilitate adding more options to that <select>
- mainly, an option to upgrade the plan to Plus.
2023-04-10 17:32:45 -07:00
Ujjawal Modi 10adb6c183 settings: Reword permissions notice banners.
Reworded the permissions notice banners on
adding bots panel,user groups panel and custom
emoji panel.
2023-04-10 16:28:12 -07:00
Ujjawal Modi c89ca2e862 settings: Improve permissions notice banners.
This commit changes behaviour of banners
in user groups panel and emoji settings panel
under organization settings.

Now banner in these panels is only
shown when user is an administrator or user
does not have permissions to perform actions
on panel.

Fixes #24157.
2023-04-10 16:28:12 -07:00
Elizabeth Funk bff6be22eb flatpickr: Add check for undefined 'hotkey' to fix type errors.
The flatpickr keyboard UI functions are very confusing. We previously
had a bug where typing keys that were not keyboard shortcuts or
numeric values could throw an exception due to accessing hotkey.name
when hotkey was undefined.

Fix this, and add a bundle of comments improving the documentation of
this confusing code path. Unfortunately, the implementation is still
somewhat mysterious; we leave debugging that to future work.

Fixes #24773.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2023-04-10 12:56:30 -07:00
Tim Abbott c76adf1e89 compose: Ensure compose box is focused after inserting any content.
In `insert_syntax_and_focus`, we now explicitly focus the textarea
before inserting the content, rather than relying on insert() to do
this for us. A comment is added documenting the quirks of insert that
require this.

This fixes a bug where the compose box might not be focused after
inserting video call links, emojis from the picker, GIPHY gifs, and
some other buttons.
2023-04-10 12:46:44 -07:00
AcKindle3 02364dd69f web: Use `uri` instead of `url`.
Following the issue #23380 and PR #25038, this commit changes all
occurences of `uri` into `url` in all comments, local variables,
handlebars templates (.hbs) function names and their callers in
all `.js` and `.ts` files.
2023-04-10 10:26:48 -07:00
Lakshay Mittal 5a89d3b4d2 search: Fix selecting all messages from recent conversations.
When there are no operators to narrow down
the search to, pass into `deactivate()` if
we're in `recent conversations`.

If we are, it will go to `all messages`.

This is done by using `is_visible()`
function of `recent_topics_util`.
2023-04-10 10:24:00 -07:00
Lauryn Menard af0b450817 templates: Update `invite_users_modal.hbs` for undefined variables.
Removes undefined `time_input` from  `invite_users_modal.hbs`.
The default input value for the expiration custom time limit is
not set until the "custom" option is selected from the dropdown.

Removes the undefined `csrf_input` from the same template. And
imports `csrf.ts` into `invite.js` to get the csrf token and
add it to the request data, which is the current pattern used
in other `/web/src` modules.
2023-04-10 09:07:11 -07:00
sbansal1999 ea2de5b0a4 js: Break cyclic dependency between topic_list and topic_list_data.
This commit breaks the cyclic dependency between "topic_list.js"
and "topic_list_data.js".

It achieves this by passing "search_term" generated by the
"get_topic_search_term" function to "topic_list_data.js" directly
through the function call from "topic_list.js".
2023-04-10 08:55:06 -07:00
Hardik Dharmani daad0a6618 navbar: Fix alignment of `search_close` icon on device width < $sm_min.
This commit fixes the alignment of the `search_close` icon on devices
with a width less than $sm_min (576px) by removing a top padding
of 5px and adjusting the position to top 5px from the previous 4px.
2023-04-10 08:09:18 -07:00
Lauryn Menard 95d48bc2ad topic-list-data: Increase max topics shown in left sidebar.
Incresase the max number of stream topics shown when not zoomed
into the stream for more topics in the left sidebar to be a max
of 8 unread conversations and 12 when there are unreads.
2023-04-07 15:10:24 -07:00
sbansal1999 e1a2789de2 js: Break cyclic dependency between top_left_corner and unread_ui.
This commit breaks the cyclic dependency between "top_left_corner.js"
and "unread_ui.js".

It achieves this by shifting the "animate_mention_changes" function
from "unread_ui.js" to "top_left_corner.js".
2023-04-07 15:04:26 -07:00
brijsiyag ee1a83996a user-profile: Prevent unintended clicks through profile modal overlay.
When a user opens a profile modal, the overlay is clicked
through in responsive mode, which results in unintended button/link
clicks. This commit removes the causing CSS properties
`pointer-events:none;` which was passing pointer-events to other
elements and `pointer-events:all` which is experimental and do no
effect.
2023-04-07 10:09:04 -07:00
Deekshith S Shetty fc1477499b hotkey: Toggle gear_menu on clicking `g` hotkey.
This commit toggles the gear_menu on pressing the `g` keyboard hotkey,
if it's already open.

Fixes: #24417.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2023-04-07 10:00:41 -07:00
Aman Agrawal a62fcb1fd9 do_render_buddy_list_tooltip: Don't show tooltip on touch devices.
Read the comment for details.
2023-04-07 09:27:50 -07:00
Aman Agrawal 13e0986091 buddy_list_tooltip: Directly get target node.
On mobile, the tooltip is triggered at the same time when right
sidebar is hidden when user clicks on a user name in the buddy
list. So, `instance.reference` node no longer exists in DOM.
2023-04-07 09:27:50 -07:00
Ujjawal Modi 915084fe82
timerender: Reword user activity info from "Last active:" to "Active".
Fixes #22758.
2023-04-07 09:24:15 -07:00
Sahil Batra 9ccc45b700 dropdown_list_widget: Refactor code to select option using "Enter".
This commit moves the code to select option on pressing "Enter" in
dropdown_keyboard_events as we handle other "keydown" events there.
This change is done for both MultiSelectDropdownListWidget and
DropdownListWidget components.
We also remove the usage of now depreceated "keypress" event with
this change.
2023-04-07 09:19:39 -07:00
Sahil Batra 35433c02b3 dropdown_list_widget: Select first option on pressing enter in search.
This commit updates the code for MultiSelectDropdownListWidget and
DropdownListWidget components to select the first option on pressing
enter when focus is on search input.

Fixes #25024.
2023-04-07 09:19:39 -07:00
Sahil Batra fc251fd464 dropdown_list_widget: Rename dropdown_focus_events.
This commit renames dropdown_focus_events function in
DropdownListWidget and MultiSelectDropdownListWidget
components to dropdown_keyboard_events, as we will be
adding other keyboard events to select an option in
this function further commits.
2023-04-07 09:19:39 -07:00
Lauryn Menard b821c90f44 narrow-filter: Update `Filter.describe_is_operator` for "resolved".
Updates `Filter.describe_is_operator` to use switch/case instead
of if/else and adds case for "is:resolved" narrow so that it is
not shown as invalid when used with other search narrow filters.
2023-04-07 09:18:52 -07:00
Lauryn Menard 982a37aece tests-narrow: Remove unneeded helper function in `narrow.test.js`.
In commit aa002f5c6d, a handlebars template was created for empty
narrow feed messages, which removed a number of div element ids,
and updated `narrow_banner.show_empty_narrow_message` to first
empty the main empty narrow div of any previous message content.

Removes the helper function for hiding the empty narrow messages
as `narrow_banner.show_empty_narrow_message` should empty the
empty message div of any text before rendering the updated empty
narrow for the new empty narrow banner text.

Also, cleans up a missed instance of 'uri' from commit b22578f
in the same test.
2023-04-07 09:18:16 -07:00
brijsiyag 95f2ead33d streams: Add an explanatory notice when left panel is empty.
This commit adds a message and link to view or create streams on
empty streams panel. It conditionally renders the message when
there is no stream to show and also when any stream
event (delete,create,subscribe) occurs.

Co-authored-by: Tim Abbott <tabbott@zulip.com>

Fixes #21870.
2023-04-06 19:33:13 -07:00
Lakshay Mittal f76ea24988 style: Fix dropdown icon partially visible on small screens.
The dropdown icon for direct messages is partially visible
on small screens. This was due to removing padding when the
screen size is below a certain size by media query.

The intent of the original code appears to have been to remove top
padding, so make the CSS do just that.
2023-04-06 18:25:09 -07:00
Hardik Dharmani f41cc29ce3 markdown: Change search and alert word highlight colors.
As part of the redesign project, this highlight colors are changed:

Light theme:
Search highlight yellow: #FFEF95 - hsl(51deg 100% 79%)
Alert highlight orange: #FFC6AE - hsl(18deg 100% 84%)

Dark theme:
Search highlight yellow: #756400 - hsl(51deg 100% 23%)
Alert highlight orange: #98491b - hsl(22deg 70% 35%)

Fixes #24922
2023-04-06 18:13:43 -07:00
atharmohammad e55f5a1b59 compose: Remove vertical shifts in compose when toggling preview mode.
The vertical shifts in message body was due to the <p> tags it gets when
converted to markdown. Removing the top margin from the first <p> child
and bottom margin from the last <p> child resolves this issue as due to
those default margins in <p> tags there was vertical shifts in message
body.

Fixes: #21276.
2023-04-06 17:57:24 -07:00
AcKindle3 ac4ec8888a ts migration: Convert `favicon.js` to `favicon.ts`.
Added type annotations to function parameters, function return
values and local variables. Added neccessary `if` statements to
enforce the objects having proper type before executing the later
operations.

An error type check in the catch block in `update_favicon`
function is added because the statement in the catch block requires
error to be a type `Error` in order to access `error.stack`.
2023-04-06 13:56:59 -07:00
xoldyckk c575d62d5a ts: Migrate header.js to typescript.
Added strict if block check to make sure `labelID` is defined at
runtime.
2023-04-06 13:27:43 -07:00
palashb01 e646ed957b css: Refactor the topic_menu sidebar popover css.
This commit adds the <p> tag used for the topic name inside the
Tippy CSS for dark theme.
2023-04-05 16:47:39 -07:00
palashb01 af3e62b2ae popovers: Refactor topic_menu visible check and hide logic.
This commit refactors the topic_menu visible check and hide logic,
since we have already migrated the popover from stream_popover.js.
This last bit of code related to topic_menu is also migrated to
popover_menus.js, and the code is refactored to use the new logic,
which is more common for the popover_menus.js system.

To hide the popover, one possible solution could be to use the
hideAll method from TippyJS. However, this could lead to
unintentional behavior for all the popovers. To prevent this, the
hide method is used for the topic_menu only.
2023-04-05 16:47:39 -07:00
palashb01 dbd945eb96 popovers: Refactor keyboard handling for the topic_menu popover.
This commit removes the use of a separate keyboard handler for
the topic_menu, as we are already using a common keyboard handler
for all Tippy popovers.
2023-04-05 16:47:39 -07:00
palashb01 28f2124feb popovers: Migrate the topic_menu popover to Tippy.
This commit migrates the topic_menu popover from stream_popover.js
to popover_menus.js. Since the data required for rendering is large,
it has been moved inside popover_menus_data.js to improve code
readability.

Getting the link of the topic for the clipboardJS inside the onMount
instance was not working with the existing method. To make it easier
to work with, a new attribute, data-clipboard-text, is added to the
'Copy link to topic' anchor tag. This allows the clipboardJS to catch
the URL. The value of data-clipboard-text is sent from popover_menus.js
to the topic_sidebar_actions template.

Fixes: #23891
2023-04-05 16:47:39 -07:00
palashb01 84a5c1907f popovers: Export stream_popover.elem_to_stream_id.
This is a prep commit for migrating the topic popover to a Tippy
popover.

'elem_to_stream_id' function is used for the topic menu to find the
stream_id of the target topic menu.
2023-04-05 16:47:39 -07:00
Ishita Gupta 8951319e98 refactor: Refactor progress_bar CSS to remove redundant code.
In this commit we remove any explicit references to the polyfills and
replace all the color codes to the hsl() format. We also remove any
other redundant code, after testing for any regressions.
2023-04-05 15:47:14 -07:00
Ishita Gupta fc03c19ba2 bootstrap: Move progress bar styling out of bootstrap CSS.
In this commit, we move the progress bar styling out of the legacy
bootstrap.css and move it to a dedicated CSS file. This is a step
forward towards the ongoing effort to remove the use of Bootstrap
from the Zulip codebase.

The new CSS file, progress_bar.css, is added to common.ts, since it
is used in both the webapp and portico pages.

Fixes #23628.
2023-04-05 15:47:14 -07:00
Anders Kaseorg b533cd979e templates: Enable Handlebars strict mode.
https://handlebarsjs.com/api-reference/compilation.html

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-05 15:23:54 -07:00
Anders Kaseorg c2458bfe94 help: Fix TypeError on missing article pages.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-05 12:18:41 -07:00
Lalit fd830ce453 popover_menus: Change the selector `.enter_sends` for opening tippyjs popover.
Changed the `.enter_sends` css selector for launching tippyjs popover from
`compose.hbs` because it was colliding with `.enter_sends` selector present in
`organization_user_settings_defaults.hbs`.

Before this change when an admin tried to change user realm default setting of
`enter_sends` it was opening a tippyjs popover despite being a checkbox and it
was hitting `/json/settings` endpoint instead of `/json/realm/user_setting_defaults`.
2023-04-05 12:05:44 -07:00
Alex Vandiver d0a8ae0c87 hashchange: Handle when history object has been marked dead. 2023-04-05 10:29:31 -07:00
Lalit bbf2f5f91f ts: Convert `emoji.js` to TypeScript.
Converted `emoji.js` to TypeScript by adding relevant type definitions,
also modified `target` option in our tsconfig to 'ESNext' so that types
for object methods like `hasOwn` which is being used in `emoji.js` are
included.
2023-04-05 10:29:01 -07:00
Lalit 6f46c4830f emoji: Refactor `get_emoji_details_by_name` function.
This is a prep commit for typescript migration of `emoji.js`. This
commit refactors the code for generating emoji rendering details such
that we avoid writing an ugly code which will involve writing an
incomplete type object when we migrate to TypeScript.
2023-04-05 10:29:01 -07:00
Anders Kaseorg a0447bbb5f markdown_help: Fix reference to possibly missing variables.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-04 12:56:18 -07:00
Anders Kaseorg 620b1aa1bd Revert "ts: Convert css_variables.js to TypeScript."
This reverts commit 5f4bdfe6bc (#24630).

This was causing Webpack to trigger type checking with the TypeScript
compiler, which is very expensive.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-04 10:54:01 -07:00
Anders Kaseorg e9c1d72771 stylelint: Fix media-feature-range-notation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-04 10:54:01 -07:00
Anders Kaseorg 2ce8357009 codespell: Fix newly found typos.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-04-03 22:39:21 -07:00
Sahil Batra c37bd3cbd9 settings: Increase width of textarea field in profile settings.
This increases width of textarea field in profile settings to
match it with other inputs.
2023-04-03 16:59:51 -07:00
Sahil Batra 9612125481 settings: Increase width of person picker in profile settings.
This commit increases width of person picker element in profile
settings to match the width of other inputs.
2023-04-03 16:59:51 -07:00
Sahil Batra 16f8a83c32 settings: Increase width of text inputs.
This commit increases width of text inputs in settings, stream
settings and user group settings to be 325px, which is the
minimum width of select elements on these pages.
2023-04-03 16:59:51 -07:00
Sahil Batra fc929e9eb6 settings: Update class of custom profile field select elements.
We now add settings_select class to custom field select elements
in "Profile" section and modal_select class to select elements in
"Manage user" modal.
2023-04-03 16:59:51 -07:00
Sahil Batra 9546fb6c5b settings: Update class of custom profile field text inputs.
We now add settings_text_input class to custom field text
inputs in "Profile" section and modal_text_input class to
inputs in "Manage user" modal.
2023-04-03 16:59:51 -07:00
Sahil Batra cf13bdba94 settings: Add modal_text_input class to inputs in "Manage user" modal.
This should have been added in 1c6bed55, but was missed there.
2023-04-03 16:59:51 -07:00
N-Shar-ma dceb49011a css: Fix misaligned invite link.
Remove unnecessary `relative` positioning from the invite link.
2023-04-03 15:07:38 -07:00
palashb01 84b4f498d5 tippy: Fix compose close button tooltip when no input.
The tooltip of the compose_close_button changes only when something
is typed into the input box. However, the state of the tooltip
remains the same until someone types into the input box again, even
if they close and reopen the compose box.

The function 'expand_compose_box' from 'compose_actions.js' is
called every time the compose box is opened. Since the input field
is emptied every time the compose box is closed, this function is
used to set the default tooltip for the close button. We want it to
say 'Cancel Compose' every time the compose box is opened since the
input field is always going to be empty whenever the compose box
reopens.
2023-04-02 16:45:53 -07:00
Palash Baderia 9809d229de tippy: Fix compose close button logic.
There are two different tooltips for compose close button
in compose box. One is when there is no text in the inputbox
that says 'Cancel compose' and if there is text in the inputbox
then it says 'Cancel compose and save draft' however the logic
of these two tooltips was reversed. This commit fixes that.
2023-04-02 16:45:53 -07:00
Hardik Dharmani ebc07c0dd7 ts: Covert `dialog_widget.js` to typescript.
Created `WidgetConfig` type which has all the parameter that can be
passed launch(). Except html_heading, html_body, and on_click all
other fields are optional. Therefore, removed checking of undefined
mandatory fields as it will be done by typescript.

Co-authored-by: Hardik Dharmani <Ddharmani99@gmail.com>
2023-04-01 11:54:53 -07:00
Lalit fcbc6dcae4 ts: Convert `overlays.js` to TypeScript.
Refactored some code as well to avoid unneccesaary `undefined`
checks in `overlays`. To be exact created an action_overlay
object of type `Overlay` such that the `reset_state` is just
`action_overlay = undefined` and having attributes like `$element`
and `close_handler`.

This would ensure that if you have an `active_overlay`, there will
be a registered `close handler` attached to it without needing to
write additional checks for `close_handler` just to satisfy type
checker.
2023-04-01 11:54:53 -07:00
human 0de0743e91
ts: Migrate debug.js to TypeScript.
TypeScript doesn't understand Array.prototype.slice.call; rather than dealing with the
type-checking issues around it, we remove it; it was only necessary for ancient browsers where
NodeList isn’t directly iterable.
2023-04-01 11:50:34 -07:00
Adarsh Tiwari eed6f67fca
ts: Migrate scroll_bar.js to typescript.
Remove the winjs specific `getScrollbarWidth` property while we're at it; 
WinJS isn't relevant anymore.

Reorders methods due to TypeScript files enforcing define-before-use when
this commit was drafted.
2023-04-01 11:43:58 -07:00
Anders Kaseorg 6199be39da web: Add missing CSS.escape calls.
When referring to <div id="my-id" class="my-class">:

- my-id is an id
- #my-id is a selector
- my-class is a class name
- .my-class is a selector

When an id or a class name is interpolated into a selector, it needs
to be escaped with CSS.escape.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-31 18:31:30 -07:00
Alex Vandiver ecd559edd4 settings: Point the "moving messages" help link to the right place. 2023-03-31 14:49:25 -07:00
aparna-bhatt 998f0b3735 stream settings: Fix cancel button in create stream to update the URL.
Clicking cancel button in create stream form wasn't updating the URL hash.
2023-03-31 14:27:36 -07:00
aparna-bhatt 710e42f862 stream settings: Fix archiving of a stream opened in right panel.
We expect the URL to be of stream if it is opened in right panel.
As archiving a stream extracts stream id from hash,
but while a stream is opened and we switch between `All Streams` or
`Subscribed` tabs, the url changes, causing bug in archiving the stream.

As as fix for this issue if a stream is opened in the right
panel the hash of the URL remain of the stream and doesn't update.
If it is archived then the URL updates accordingly.

Fixes #23855.
2023-03-31 14:27:36 -07:00
Lauryn Menard 344d26d936 pm-list-data: Clean up node test for `pm_list_data.js`.
Cleans up node test to use helper functions when setting a filter
and narrow state for private messages and when checking the return
value for `pm_list_data.get_list_info`.

Also, reduces the number of users in the test by creating more
group direct message conversations.
2023-03-31 14:22:30 -07:00
evykassirer 1e62a42d75 compose: Reduce height of compose banners to better match designs.
Figma: https://www.figma.com/file/jbNOiBWvbtLuHaiTj4CW0G/Zulip-Web-App?node-id=2441%3A180271&t=tFynBT5Akes5HJ95-0
2023-03-31 13:52:31 -07:00
evykassirer 4cfafa382a compose: Rename recipient selector classes to be more descriptive. 2023-03-31 13:45:24 -07:00
evykassirer 83b484db32 compose validate: Rename overflow verifier.
This makes it clearer what the return value means.
2023-03-31 13:40:41 -07:00
N-Shar-ma b406cc84ff Revert "typeahead: Fix bug where typeahead showed momentarily on shift + tab."
This reverts commit fa37befe3c, which broke
the topic typeahead after a complete stream name.
2023-03-31 11:08:45 -07:00
Tim Abbott 6c82772e15 compose: Fix incorrect scroll down notice in recent view.
The logic for whether one needs to scroll down to view messages sent
by the current client was incorrectly not checking whether a message
feed was visible at all.
2023-03-31 10:41:06 -07:00
Tim Abbott 872a336598 insert_new_message: Rewrite using all_rendered_message_lists.
This replaces one of the our larger remaining blocks of code with
explicit logic for message_lists.home with logic that should correct
if we support maintaining a different set of rendered message lists.

This should have identical behavior to the previous implementation
given that all_rendered_message_lists is either just
message_lists.home or that plus the current narrowed message list;
can_apply_locally() is always true for the home message list, and the
list === message_lists.current check is equivalent to the more complex
narrow_state.active() check.
2023-03-31 10:41:06 -07:00
Tim Abbott f165e59273 message_events: Check is_message_feed_visible in callbacks.
Because we don't call this function with home_msg_list, I believe the
existing msg_list !== message_lists.current check would have always
been false when the new check is false, but this is more explicit
about the logical intent.
2023-03-31 10:41:06 -07:00
Sahil Batra 2ebb9834cd modal: Fix flex-direction property for modal__content.
The flex-direction property for modal__content should
be set to column as we want to display the elements.

This does not affect most of the modals since they
do not have multiple direct child elements that are
visible at same time and the data-simplebar attribute
already sets the "flex-direction: column" property to
the elements where it is used.

But in the email address visibility modal on user
registration page, there are multiple direct child
elements for the "modal__content" element and we need
to set "flex-direction: column" property for them to
work correctly. We also change the width of select
element in the modal to "fit-content" to avoid it
taking the whole width even when not required.

This commit also fixes the bug in login_to_access
modal, since the `modal__content` for it also
has two direct child elements.
2023-03-31 10:02:42 -07:00
Palash Baderia d5a12a7348 read_receipts: Open the help link in a new tab.
This commits improves the read link present inside the read receipts
to open the help page in a new tab.

Fixes: #24778
2023-03-30 09:10:20 -07:00
evykassirer e786c3ac98 dropdown list: Separate get_data() function, no functional change. 2023-03-29 21:58:17 -07:00
evykassirer e5dd2810ee puppeteer: Move functions around in common.ts.
They need to be declared higher so that a future
commit can use them.
2023-03-29 18:14:54 -07:00
evykassirer 01643d1d19 compose: Use stream_name() and topic() abstraction everywhere. 2023-03-29 18:14:54 -07:00
Aman Agrawal d564025d6a css: Integrate newly designed header. 2023-03-29 17:59:00 -07:00
Adarsh Tiwari 78fdb6135a
ts: Migrate gear_menu.js to TypeScript.
Includes adding various missing values to page_params.
2023-03-29 09:36:52 -07:00
Ujjawal Modi de8148bc9e notifications: Warn if all PM notifications will be disabled.
This PR adds a modal to warn when user unchecks a box on the "PMs,
mentions, and alerts" line of notifications panel that will result in
all notifications for private messages and mentions being disabled.

Fixes #24151.
2023-03-28 18:36:56 -07:00
Aman Agrawal ddb0a6bae9 recent_conversation: Fix possibility of undefined topic row.
`topic_row_top = $(topic_row).offset().top;` returns an error
while calling `topic_offset_to_visible_area` since we cannot
find the `topic_row` for some reason which doesn't seem logically
possible but we add logic to handle that case as well.
2023-03-28 17:01:31 -07:00
Tim Abbott b75b40cfa3 compose: Hide compose loading spinner after all failures.
The compose send button spinner (which disables the send button while
present) was correctly hidden in both the happy case of a sent message
as well as for all locally echoed message, in both cases via
clear_compose_box to reset the compose box for a new message.

But for a message that was not locally echoed, and failed to send,
nothing hid the compose spinner, resulting in the user being unable to
attempt to resend the message.
2023-03-28 16:47:12 -07:00
Tim Abbott 43fe61df1f compose: Fix disabled state for compose send button.
Disabling the send button was intended to prevent sending the same
message twice in immediate succession via the enter key.

Since a13058223d, this logic duplicates
the compose_spinner_visible check inside finish(), and more
importantly, was not cleaned up correctly if the message fails to send
without having been locally echoed, resulting in the compose box not
allowing you to send further messages after such a failure.

For successfully sent messages, the disabled state was cleared by
clear_compose_box calling check_overflow_text, which unconditionally
sets the disabled state on the send button based on whether the
message is too long.

Rather than try to clean this state up in the right places, remove
this duplicate mechanism for disabling the compose box.
2023-03-28 16:47:12 -07:00
nzai 97ff259506 ts: Migrate narrow_error to TypeScript.
This commit migrates narrow_error.js to TypeScript by inferring the
required types in the file and defining types in types.ts.
2023-03-28 15:04:57 -07:00
Daniil Fadeev 602be3ed68 popovers: Refactor compose_enter_sends popover. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 39936dee5d popovers: Refactor compose_control_buttons visibility checking. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 729d3cfc30 popovers: Refactor compose_mobile_button visible check logic. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 2bc6fdca23 popovers: Refactor stream_settings popover keyboard handling. 2023-03-28 14:51:56 -07:00
Daniil Fadeev a0c98bc70a popovers: Refactor message_actions popover keyboard handling. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 1337c0fec1 popovers: Migrate "all messages" popover to Tippy. 2023-03-28 14:51:56 -07:00
Daniil Fadeev edb293c3da popovers: Migrate "drafts" popover to Tippy. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 22561e2f3b popovers: Refactor keyboard handling for starred messages popover. 2023-03-28 14:51:56 -07:00
Daniil Fadeev 1f24addb88 popovers: Add shared keyboard handling for popovers.
This new system lets us handle detection and keyboard navigation in
popovers with just a a few lines of simple code for each individual
popover.
2023-03-28 14:51:56 -07:00
Daniil Fadeev db61dd71e3 popovers: Extract default tippy options for the left sidebar. 2023-03-28 14:51:56 -07:00
Ujjawal Modi f404dbddb2 recent_conversations: Exclude muted user PMs from recent conversations.
Earlier muted private conversations were shown in recent
conversations. This commit excludes them from recent conversations.

Fixes #24299.
2023-03-28 14:40:50 -07:00
Ujjawal Modi bfc5092082 recent_conversations: Change name of muted user in group PMs huddle.
Earlier in recent conversations panel full name
was displayed in group PMs huddle even if the user
was muted.
This commit change the display name of such users to
`Muted Users`.
2023-03-28 14:40:50 -07:00
Ujjawal Modi 87215d1a98 recent_conversations: Parsing of user_ids is done using function call.
This commit refactors the code for parsing the user_ids in
`pm_conversations.js` by making a function call to parse user_ids.
2023-03-28 14:40:50 -07:00
Pranav2612000 ecead64718 markdown: Render larger emojis inside headings
Previously, the emoji size was fixed to 20px by 20px irrespective of
whether the emojis were inside a heading or not. This looked weird when
a small emoji was rendered next to a large h1 text.

This commit fixes that by setting the emoji height to 1.4em
which proportionately increases the size of the emojis as the text size
increases for different headings.

Fixes #12857
2023-03-28 09:17:02 -07:00
Sahil Batra 0c8f74d6e2 streams: Fix dropdown-list-widget menu in stream creation form.
The dropdown-menu for "Who can unsubscribe others" was not wide
enough to fit the options in stream creation form. This commit
fixes it to be wide enough to fit the options like we do in
stream edit form.
2023-03-28 09:14:54 -07:00
Sahil Batra 00abffda98 settings: Fix dropdown-list-widget menu for short options.
The dropdown menu for notification stream, default code block
language, etc. was not looking good for short options due to
width being set to fit-content. This commit adds min-width
property to make them look good for short options as well.
2023-03-28 09:14:54 -07:00
Sahil Batra c5ff78a933 bootstrap: Remove width property for inputs.
This commit removes the width property for inputs from
bootstrap.css. We have already set the width for the
specific text inputs in previous commits. For other
type of inputs (like checkbox, radio, file, etc.),
there is no need to set the width as they are hidden
or we already set width for them.

This is a part of bootstrap removal project.
2023-03-27 22:34:30 -07:00
Sahil Batra 40f2865328 integrations_dev_panel: Add width CSS property for text inputs.
This commit adds width property CSS rule for text inputs in
integrations_dev_panel.css to 206px, as we are going to remove
the bootstrap CSS rule which sets width in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 30f8c77151 billing: Add width property CSS for text inputs.
This commit adds width property CSS rule for text inputs
in billing.css to 206px, as we are going to remove the
bootstrap CSS rule which sets width to 206px in further
commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 00ec5a3752 activity: Add width property CSS for inputs.
This commit adds width property CSS rule for text
inputs in activity.css to 206px, as we are going to
remove the bootstrap CSS rule which sets width to
206px in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 9615d4ba05 widgets: Add CSS to set width of inputs.
This commit adds CSS to set width of text inputs in
poll and todo widgets to 206px as we will be removing
the bootstrap CSS rule which sets width of inputs to
206px in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 52619657ca css: Add width property to CSS for #inline_topic_edit element.
This commit adds width property to CSS for "#inline_topic_edit"
element in zulip.css to set it to 206px, as we will be removing
the bootstrap CSS for it in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra e1877ce57e settings: Add settings_text_input class to text inputs.
This commit adds settings_text_input class to text inputs in
settings, stream settings and user group settings pages. This
class is used to set the width of inputs to 206px, as we will
be removing the boostrap rule which sets width of the input
in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra 1c6bed55e4 modals: Add modal_text_input class to text inputs.
This commit adds modal_text_input class to text inputs
in modals to set width of them as set by bootstrap.
This class is used to set the width of inputs to 206px,
as we will be removing the boostrap rule which sets width
of the input in further commits.
2023-03-27 22:34:30 -07:00
Sahil Batra dcce524376 settings: Increase width of url field in edit custom field form.
This commit increases the width of url field, displayed for
custom external account type fields, in edit profile field
form. The width of the input is increased as urls are generally
long enough and did not fit in the width set previously in most
cases. We increase the width to match the width in add custom
profile field form.
2023-03-27 22:34:30 -07:00
sbansal1999 a8b5167f89 ts: Convert portico/team.js to TypeScript.
This commit converts "portico/team.js" to TypeScript as well
as adds the required type definitions.

Some values were extracted into variables for type-checking.
2023-03-27 22:33:54 -07:00
sbansal1999 cc6661f777 team: Pop contributors from page_params.
Avoiding access to the "page_params" results in a cleaner interface
for conversion to TypeScript.
2023-03-27 22:33:54 -07:00
sbansal1999 23ff970cf5 portico: Add missing tab_name parameter in teams page.
The `tab_name` parameter is supposed to ensure that if you're looking
at a tab for repository that's not zulip/zulip, that the GitHub links
for authors without an associated GitHub username goes to the commits
for that repository.
2023-03-27 22:33:54 -07:00
Anders Kaseorg eb572e525a stream_color: Fix duplicate ids for colored privacy icons.
This also fixes the color on these icons in the stream-specific rows
of the notification settings table.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-27 22:24:45 -07:00
Karl Stolley 674cf8eacc css: Hyphenate .status-emoji selector. 2023-03-27 17:31:31 -07:00
Karl Stolley f695b08989 css: Hyphenate .smiley-icon selector. 2023-03-27 17:31:31 -07:00
Karl Stolley 89f45bf50e css: Hyphenate .selected-emoji selector. 2023-03-27 17:31:31 -07:00
Karl Stolley 36241e5758 css: Hyphenate .status-emoji-wrapper selector. 2023-03-27 17:31:31 -07:00
Karl Stolley 6e2b8a3b1d css: Hyphenate .user-status selector. 2023-03-27 17:31:31 -07:00
Karl Stolley fcef6a2228 css: Hyphenate .user-status-content-wrapper selector. 2023-03-27 17:31:31 -07:00
Karl Stolley c78c1ef54b css: Hyphenate #set-user-status-modal selector. 2023-03-27 17:31:31 -07:00
Aman Agrawal 83423bb45b copy_message_button: Use `div` HTML tag instead of `button`.
For some reason, browser is treating clicking on the button as
submitting the form, which results in the page getting redirected
to the same page with an additional empty query `?` in the URL.
2023-03-27 16:11:19 -07:00
Sahil Batra cf8d8db132 register: Update the user-registration form for realm creation.
In previous commits, we updated the realm creation flow to show
the realm name, type and subdomain fields in the first form
when asking for the email of the user. This commit updates the
user registration form to show the already filled realm details
as non-editable text and there is also a button to edit the
realm details before registration.

We also update the sub-heading for user registration form as
mentioned in the issue.

Fixes part of #24307.
2023-03-27 15:44:42 -07:00
Sahil Batra 80b00933b1 templates: Add realm information fields in create_realm.html.
We now show inputs for realm details like name, type and URL
in the create_realm.html template opened for "/new" url and
these information will be stored in PreregistrationRealm
objects in further commits.

We add a new class RealmDetailsForm in forms.py for this
such that it is used as a base class for RealmCreationForm
and we define RealmDetailsForm such that we can use it as
a subclass for RegistrationForm as well to avoid duplication.
2023-03-27 15:44:42 -07:00
Sahil Batra 5eeef1483d templates: Rename ID for form element in create_realm.html.
This commit updates the ID for form element in create_realm.html
to "create_realm" as we would need to update the error handling
for this page in further commits and we do not want to break it
for other forms using "send_confirm" as ID.
2023-03-27 15:44:42 -07:00
N-Shar-ma 25d2e1caed compose: Have at least 2 new lines before and after a quoted message.
Uptil now, 1 new line was added before and 1 after a quoted message. Now
for more breathing room around a quoted message, new lines are inserted
to space it from any content before and after by at least 2 new lines.

Fixes: #23608.
2023-03-27 15:31:45 -07:00
Sahil Singh 89733670fd image_upload_widget: Refactor style of upload_widget's preview_image.
Forms using upload widget were using the
same css for image preview.

We fix this by assigning a class to the
widget and applying specific styles to it.
2023-03-27 10:19:29 -07:00
Joelute edfb2a3948 compose_typeahead: Ensure header is counted in position calculation.
Previously, there is a bug where the position of the typeahead is off
whenever the user switches from stream typeahead to topic typeahead
in the compose box. The typeahead header was not hidden before
calculation of the position based on container height. These changes
will include the header before calculating for the position.
2023-03-27 10:18:12 -07:00
Joelute fa37befe3c typeahead: Fix bug where typeahead showed momentarily on shift + tab.
Break on `keyup` for case of `shift` key, instead of letting it trigger
the typeahead.

Fixes: #24152.
2023-03-27 10:18:12 -07:00
Mateusz Mandera 684430faa2 billing: Add sponsorship request form to the billing page.
Previously this was only available on the upgrade page - meaning an
organization that already bought a plan wouldn't be able to request a
sponsorship to get a discount or such, even if qualified.
2023-03-27 10:15:21 -07:00
Mateusz Mandera cf55e66c74 css: Move "style" from upgrade.html sponsorship form to billing.css.
Our linters demand "style" to not be used in .html and will complain
when trying to move this chunk of html to another .html file.
2023-03-27 10:15:21 -07:00
palashb01 454400605b settings: Replace 'Forgotten it?' to 'Forgot it?'.
This is nicer English.
2023-03-27 10:11:22 -07:00
Palash Baderia cefc191dd6 settings: Fix responsiveness in change email,password dialogs.
Added a width for the Change Email and Password dialogs at
sm_min (576px) and ml_min (425px) to make them more responsive
on narrow screens.

Fixes: #24339.
2023-03-27 10:11:22 -07:00
Mateusz Mandera ca0869eb01 support: Fix scrubbing realms if string_id is a number.
This bug made it impossible to scrub realms where the string_id was a
number, e.g. 123.zulipchat.com because
confirmed_string_id === actual_string_id comparison failed due to one
being a string and the other a number.

Per http://api.jquery.com/data/#data-html5:
Every attempt is made to convert the attribute's string value to a
JavaScript value (this includes booleans, numbers, objects, arrays, and
null).
To retrieve a data-* attribute value as an unconverted string, use the
attr() method.
2023-03-27 10:07:41 -07:00
Ganesh Pawar a2d68e90cc bots: Disable `Save changes` button until user makes some changes.
Fixes #20831
2023-03-27 09:06:48 -07:00
Ujjawal Modi d2db71fdf4 bots: Disable edit button for system bots.
Disabled "Edit bot" and "Deactivate" action buttons
for system bots as they cannot be edited or deactivated.

Fixes #24425.
2023-03-27 09:03:53 -07:00
Sahil Batra 6582374178 server_events_dispatch: Fix live-update of email_address_visibility. 2023-03-27 09:02:00 -07:00
Sahil Singh 0bcf03ea64 stream_settings: Fix stream description overflow in stream settings.
With longer stream descriptions, the text overflows in stream settings.

Fix this with 'word-break: break-all;'.
2023-03-24 17:39:04 -07:00
Anders Kaseorg d274583d8f styles: Use modern color notation.
postcss-preset-env transpiles this back as necessary.  (It does a
better job than we did, in fact: we had several four-argument hsl()
calls that should have been hsla().)

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-24 17:26:55 -07:00
YashRE42 4853a9a736 navbar: Use feathericon close icon.
This uses the new close icon which we prefer over the one made available
from bootstrap. It also adds a reference to the icon in THIRDPARTY.
2023-03-24 16:30:15 -07:00
YashRE42 e3ad9c10bb navbar: Add Ionic search icon and use for navbar search.
This adds a new search icon which we prefer over the one made
available from bootstrap, and replaces search icons in navbar
search with the Ionic icon.
2023-03-24 16:30:15 -07:00
Anders Kaseorg e029fe6249 message_list_view: Initialize status_message even for hidden messages.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-24 16:19:49 -07:00
SameepAher 6211939020 css: Change the selector name of the <i></i> tag.
Changed the id name of the <i></i> tag to user_profile_edit_button_icon
in the user profile modal, as earlier it was edit-button, which is too
vague of a selector name.
2023-03-24 15:47:54 -07:00
SameepAher 724af12cd6 css: Fix edit icon bug in user profile modal.
Close user profile modal on clicking the space around edit button, by
calling hide_user_profile() on clicking the hover box around the edit
button.

Also, modified the hover box to center around the edit button.
2023-03-24 15:47:54 -07:00
Alex Vandiver 93bfd3fb5f sentry: Provide a server-side tunnel.
Some well-intentioned adblockers also block Sentry client-side error
reporting.  Provide an endpoint on the Zulip server which forwards to
the Sentry server, so that these requests are not blocked.
2023-03-24 15:16:38 -07:00
Alex Vandiver 164d58bec9 web: Save a 301 redirect from /help to /help/. 2023-03-24 14:51:01 -07:00
Alex Vandiver ab7ff6b582 web: Save a 301 redirect from /billing to /billing/. 2023-03-24 14:51:01 -07:00
Alex Vandiver d9daeb13e0 web: Save a needless 301 redirect from /apps to /apps/. 2023-03-24 14:51:01 -07:00
Alex Vandiver 61adc9cfcc web: Save a needless 301 redirect from /team to /team/. 2023-03-24 14:51:01 -07:00
Alex Vandiver c686c5ed0f web: Save a needless 301 redirect from /plans to /plans/. 2023-03-24 14:51:01 -07:00
Alex Vandiver a1570ff3dd web: Save a needless 301 redirect from /integrations to /integrations/. 2023-03-24 14:51:01 -07:00
Alex Vandiver 5967dda35d web: Save a needless 301 redirect from /upgrade to /upgrade/. 2023-03-24 14:51:01 -07:00
David Rosa 707fa87c74 help: Document `=` keyboard shortcut.
Documents the new shortcut in the `?` menu, Keyboard Shortcuts page,
and Emoji Reactions page.
2023-03-24 12:58:35 -07:00
Daniil Fadeev e8f5e8da4f message_controls: Fix "undefined" tooltip content. 2023-03-24 12:26:57 -07:00
N-Shar-ma b8cb72630f click_handlers: Ensure typeahead clicks do not collapse compose box.
Added condition for when a user clicks anywhere in a typeahead menu, be
it the header or empty space at the top and bottom, to not collapse the
compose box.

This fixes the bug where clicking anywhere on the typeahead except the
options would result in the compose box collapsing, but the typeahead
menu staying open and still working (on selecting a option in this state,
it would be inserted at the start, as visible on reopening the compose box).
2023-03-24 12:00:57 -07:00
Alex Vandiver f812d9bb42 localstorage: Accesses can fail randomly; make best-effort.
The localstorage machinery can fail for totally arbitrary reasons,
including filesystem breakages on the part of the client, or
capricious access control.

Wrap accesses to localstorage with try/catch blocks to do our best,
but continue execution in the event that the localstorage API errors
out; it is better to continue with the rest of our intended actions
than get hung up on those failures.
2023-03-23 16:16:04 -07:00
Alex Vandiver b2c048f172 emojiset: Promise reject calls want an error, not an event.
This improves the error message captured, from the mildly inscrutable
"Non-Error promise rejection captured with keys: currentTarget,
isTrusted, target, type".
2023-03-23 15:58:11 -07:00
Alex Vandiver 75008d5f50 sentry: Drop HttpClientIntegration.
We have the information about all of these failures from the server
side, and Sentry groups all 5xx failures together with no stacktrace,
which makes them very difficult to get signal out of.
2023-03-23 15:57:41 -07:00
Anders Kaseorg 39b48e85a4 recent_topics_row: Remove unused dataset attributes from template.
Commit 084cbd4ff7 (#15064) removed the
.data() calls that inspected these.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-23 13:34:59 -07:00
Anders Kaseorg 508b9f7bd0 reactions: Pass missing vote_text to Handlebars template.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-23 13:26:37 -07:00
Daniil Fadeev b65b94894f stream_popover: Migrate Bootstrap to Tippy in starred messages' popover. 2023-03-23 11:59:46 -07:00
Tim Abbott 2b6ec56238 popovers: Use default our font size for Tippy popovers.
We'd accidentally shrunk the actions popover to 12px when migrating it
to Tippy.
2023-03-23 11:59:46 -07:00
Tim Abbott d3152800a6 css: Refactor Tippy popover CSS.
The CSS for our first Tippy popover, actions_popover, incorrectly did
not split the CSS that is meant to be applied to all popovers from
that CSS that is only for that specific popover.

Reorganize this with some clarifying comments.
2023-03-23 11:59:46 -07:00
Daniil Fadeev 3bfdac3e03 tippy: Fix tippy-arrow thickness. 2023-03-23 09:24:38 -07:00
Anders Kaseorg 36475daba7 templates: Remove references to undefined fields.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-22 17:10:28 -07:00
Anders Kaseorg a1f530fcc0 tests: Pass missing data to Handlebars templates.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-22 17:10:28 -07:00
Anders Kaseorg 73d400e4a3 web: Pass missing data to Handlebars templates.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-22 17:10:28 -07:00
Anders Kaseorg 5d7da7e537 settings_bots: Avoid Handlebars iteration with block parameters.
The fix at https://github.com/handlebars-lang/handlebars.js/pull/1855
is not released yet.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-22 17:10:28 -07:00
Aman Agrawal f5f79048fe notifications: Handle exception when trying to play audio.
Safari denies user from playing audio without an interactive
trigger like a button by default. So, when user received a
notification in Zulip via Safari, it triggers an error when
trying to play the notification sound.

Our goal for this commit is to simply handle the error.
2023-03-22 12:27:20 -07:00
Aman Agrawal dbc2b2a839 recent_conversations: Fix unread topics navigation behaviour.
When marking an unread topic as read with `unread` filter selected,
we don't need to move user a row down since removing the selected row
will automatically move the user down.

Without this, the user goes down twice which is not intended.
2023-03-22 11:53:41 -07:00
N-Shar-ma 83e182a6fa typeahead: Fix stream typeahead flashing before topic typeahead.
Removed a redundant call to bootstrap typeahead's `lookup` function when
the `automated` function returns true, which was causing the streams
typeahead to show up briefly before the topic typeahead on pressing `>`
immediately after a stream name.
2023-03-22 11:43:21 -07:00
Lauryn Menard 90205a490d account-settings: Pass delivery email to change email modal.
When we converted the change email form to a dialog widget modal,
in commit f43d3b9986, the page_params value for delivery email
that was being referenced in the handlebars template
`change_email_modal.hbs` was not set, so instead an empty string
was the initial input value. Because the email change dialog
widget post_render callback sets the input value to the same
delivery email, the fact that the email was not being set when
the template was initially rendered was not noticable.

Passes the page_params.delivery_email to the html parameter in
dialog_widget.launch so that the template has the initial value
set when the form is initially rendered. Removes the now redundant
post_render callback, which resets the initial input value to the
same delivery email.
2023-03-22 11:18:49 -07:00
Lauryn Menard 25fb810d81 account-settings: Pass password page params to dialog widget.
When the password change form was converted to a dialog widget
modal, in commit f5fbf5f0e0, the page_params values for
password_min_length and password_min_guesses that were referenced
in the handlebars template `dialog_change_password.hbs` had no
value to set, which meant the password quality bar was no longer
checking the input value against those organization settings.

Passes the page_params values for password_min_length and
password_min_guesses to the html parameter in dialog_widet.launch
for the password change modal so that those values are available
and set when the template is rendered.
2023-03-22 11:18:49 -07:00
Tim Abbott 35440672a7 message_list: Rename confusing hide-date CSS class.
The previous hide-date CSS class had a semantic meaning of "this
recipient row has the same date as the previous one"; since we're now
having logic read that value, it's worth giving it a semantic name
that makes that code easier to understand.
2023-03-21 12:55:13 -07:00
Aman Agrawal 404f6a404a message_list: Fix duplicate date headers at the top of message feed.
Hide the date on date separator when it is above a sticky header; see
the comments for the full algorithm.
2023-03-21 12:55:13 -07:00
Joseph Ho c8d043e12c
popovers: Fix tooltip partially hidden by recipient bar when selected.
Previously, when a user view the message source of a message at the
very top with the blue box around, the tooltip for the button will
be partially hidden by the recipient bar. Ths cause is some legacy 
CSS from, for example, 3cd33c0fea,
which increased the z-index for the bodies of selected messages.

The intent of that code appeared to be something around handling overlaps
between unread indicators and the blue selected message box. It's logically
incorrect, and testing demonstrates that the blue box works fine next to unread
messages without this change, so we can safely remove these z-index values.
2023-03-21 12:47:47 -07:00
Anders Kaseorg 730eda60bc webpack: Disable webpack-dev-server overlay for runtime errors.
webpack-dev-server 4.12.0 introduced a global handler that shows a
full-screen overlay for all runtime errors, but it’s redundant with
our blueslip_stacktrace handler and less functional at this time.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-21 12:36:37 -07:00
palashb01 ac45a3f20d narrow_banner: Add a period at the end of the default banner.
This commit adds a period ('.') at the end of the default banner
in the narrow empty search for multiple filters. This is required
to maintain consistency among all banners, as for most banners, we
use punctuation at the end of the banner to create complete and
meaningful sentences.
2023-03-21 11:23:43 -07:00
palashb01 ce11657204 narrow_banner: Display title only for empty search with multiple filters.
This commit improves the display of the narrow banner when there are
multiple filters used in a narrow search and no results are found.
The banner will now only display the title 'No search results'
The node tests have been updated to reflect this change.
2023-03-21 11:23:43 -07:00
Hardik Dharmani e07bb82704 js: Fix dependency cycle in overlays.js.
Removing browser_history.js import in overlays.js
helps to completely solve the dependency cycle issue for
importing dialog_widget.js in upload_widget.ts in PR #24426.

Removed the only use of browser_history in overlays.js
which was 'browser_history.exit_overlay()'cin open_settings
function by defining open_settings_overlay function in settings.js
and calling 'browser_history.exit_overlay()' in settings.js.

also removed overlays.js import in admin.js as the only use of
overlays was to call open_settings function which is now shifted
to settings.js and is called as settings.open_settings_overlay.
2023-03-21 11:22:11 -07:00
Hardik Dharmani b722cf31cb js: Move popover.initialize to end of file.
Moved the initialize function in popover.js at end of file to
follow 'no-use-before-define' for function 'hide_all' being called
in initialize function and to follow convention to put
initialize at the end of the file.
2023-03-21 11:22:11 -07:00
Hardik Dharmani 2c30bbbf74 js: Fix dependency cycle in unread.js.
The import of recent_topics_ui.js from unread.js generates an import
loop. To remove this, we need to move the logic for rerendering recent
topics after update_message_for_mention out of the low-level unread.js
data module.

Since the logic was conditional on `content_edited` being true, and
that parameter is only passed in the message_events.js code path, we
can do this by just making the function return a boolean for whether
this rerender may be required, and moving the rerender logic to that
calling module.
2023-03-21 11:22:11 -07:00
Aman Agrawal 00505e9903 pm_list: Fix tooltips mutation handler.
The mutation handler was correct for user list in the right
sidebar but was incorrect for pms list in the left sidebar.

Since the left sidebar is updated differently, we need to
check for mutations on the element actually being updated.

This also required using a target node that is always present
for the pms list which otherwise throws an exception.
2023-03-21 10:53:25 -07:00
Aman Agrawal 05674f3ab5 pm_list_item: Convert pm_user_status to a class.
Since there are multiple elements that use pm_user_status, it
makes sense to have it as a class.
2023-03-21 10:53:25 -07:00
Alex Vandiver 66de81425e portico: Use jQuery better to select the first integration.
The `.integration-lozenges` children may contain
non-`.integration-lozenge` elements; if there were no matching
integrations, attempting to fetch the css `display` property of those
failed.

Switch to using jQuery to find the full set of visible lozenges
directly; this does the right thing if there are no such elements.
2023-03-21 08:50:06 -07:00
Joelute 4d55192e21 compose_typeahead: Add hint text to topic typeahead dropdown.
With the autocomplete dropdown, some users face trouble or uncertainty
while selecting topics. The autocomplete dropdown may encourage users
to find and select an existing topic rather than starting a new topic.
The changes adds a hint text to the topic typeahead dropdown to
encourage users to either start a new topic or select an existing
topic.

Fixes #23295.
2023-03-20 16:28:28 -07:00
Anders Kaseorg 3a27b12a7d dependencies: Switch to pnpm.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg b3f9fdf99a dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg 61f91f8503 tests: Mock autosize.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg d5b2a667c5 message_view_header: Remove unused value for absent i18n placeholder.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg 13066e6406 styles: Fix dark-theme mixin in zulip.css.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg ecde9066d7 stylelint: Fix declaration-block-no-redundant-longhand-properties.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg 790c8a1582 stylelint: Fix at-rule-empty-line-before.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 15:48:29 -07:00
Anders Kaseorg cd3c4cd991 styles: Extend help sidebar heading links like list links.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:35:53 -07:00
Anders Kaseorg ad357b18c0 bootstrap: Remove CSS hacks for IE.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:27:39 -07:00
Anders Kaseorg 70e9fc8b12 postcss: Enable postcss-preset-env.
This gives more comprehensive support of new and future CSS features
that can be transpiled for older browsers.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:26:30 -07:00
Anders Kaseorg 5cdf38b1f7 styles: Use standard CSS nesting syntax.
CSS nesting is being standardized with the syntactic restriction that
the nested selector cannot start with an identifier.  This was
necessary to allow the syntax to be parsed without lookahead.

https://webkit.org/blog/13813/try-css-nesting-today-in-safari-technology-preview/
https://www.w3.org/TR/css-nesting-1/#syntax

The postcss-nesting plugin used by postcss-preset-env enforces this
restriction.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:26:30 -07:00
Anders Kaseorg f03b609bfd Revert "minor: Add `z-index` to `message_time` class."
This reverts commit e16e7630e6 (#19542).

This was compiling to

    a.messagebox-content .message_time {
        z-index: 1;
    }

which did nothing, because .messagebox-content is a <div>, not an <a>.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 11:26:30 -07:00
Anders Kaseorg 182969fba1 integrations_dev_panel: Fix unsafe use of innerHTML.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-20 10:31:15 -07:00
Anders Kaseorg d4cc50c468 web: Remove inappropriate $ prefix from HTML variables.
Only jQuery object variables should be prefixed with $.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-17 11:35:43 -07:00
Aman Agrawal c4903fe85a message_row: Fix rewrapping message lines after receiving ack.
Since the message time of locally echoed messages were not displayed
and their width was restricted by `notvisible` CSS class, it
resulted in width available to message text changing after the message
was successfully sent and the time was displayed.

To fix this, we just try to set opacity of the message time to 0
for locally echoed messages.
2023-03-17 08:10:13 -07:00
Anders Kaseorg 3109ee8015 eslint: Enable @typescript-eslint/recommended plugin.
This is not automatically enabled by
@typescript-eslint/recommended-requiring-type-checking for some
reason.

https://typescript-eslint.io/linting/configs/#recommended

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 13:24:27 -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
Lauryn Menard c446f86173 rendered-markdown: Move `pre` element CSS reset rules.
Moves CSS reset rules for `pre` elements to the `rendered_markdown`
class block.

Adds the `rendered_markdown` class to the scrollbar rules.
2023-03-16 11:30:04 -07:00
Lauryn Menard 2d8283e579 rendered-markdown: Move inline code CSS reset rules.
Moves the CSS reset rules for inline code elements to be in the
`rendered_markdown` class block.
2023-03-16 11:30:04 -07:00
Lauryn Menard d98ba32588 rendered-markdown: Copy anchor tag CSS rules from bootstrap.
Prep commit for moving CSS reset rules for inline code elements
in `rendered_markdown.css` to the `rendered_markdown` class rules.
2023-03-16 11:30:04 -07:00
Anders Kaseorg 83b6866018 templates: Replace unnecessary {{#tr}} blocks with {{t}} helper.
`{{#tr}}` supports HTML and allows translators to accidentally
introduce HTML, so it’s safer to use the `{{t}}` helper unless HTML is
needed.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 11:26:45 -07:00
Anders Kaseorg 8cd78d356f templates: Allow the same line-wrapping in {{t}} as in {{#tr}}.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 11:26:45 -07:00
Anders Kaseorg ba5a2c8866 templates: Support context variables in Handlebars {{t}} helper.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-16 11:26:45 -07:00
Zixuan James Li ee26590528 util: Implement a safer type narrowing helper for arrays.
This implements a helper that parses an array that possibly contains
falsy elements into undefined when it does have at least one falsy
element, or returns a type narrowed array of non-undefined elements.

We use this in people.js, which achieves the same check we have using
"arr.every(Boolean)", but with type safety since it is not based on
validation.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-16 10:47:12 -07:00
Zixuan James Li cd97c497bc people: Do not return undefined for is_cross_realm_email.
It would be semantically more straightfoward to return false when the
check does not succeed.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-16 10:47:12 -07:00
Zixuan James Li 111f2f5e9d people: Do not return false for group_pm_with_user_ids.
Returning undefined as opposed to false makes more sense in the context
of this function. This also will simplify the type annotation.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-16 10:47:12 -07:00
Zixuan James Li 04782a48e2 settings_data: Extract TimePreferences.
This type will get used in people.ts in "get_user_time_preferences".

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-03-16 10:47:12 -07:00
Anders Kaseorg d693b53aa6 templates: Fix &nbsp; syntax.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-15 16:34:32 -07:00
Aman Agrawal 64584557b2 streams_list: Don't zoom out user when stream list rearranges.
Fixes #23588

When a new message arrives in an inactive stream, it will lead
to stream being marked as active from inactive which leads to
stream list being rearranged which zooms out the user since the
active stream is reset momentarily. To avoid this, we delay the
stream list redraw until user zooms out and only update the topics
list.
2023-03-15 16:17:24 -07:00
Aman Agrawal f8e093c730 left_sidebar: Highlight inactive streams when narrowed to.
Having active streams greyed out can be confusing to the user. This
is especially useful when the app is still fetching messages on
a reload and the active stream has no messages and is thus marked
as `inactive`.
2023-03-15 16:17:24 -07:00
Palash Baderia bf51277226 popovers: Add confirmation modal for marking all messages as read.
This commit adds a confirmation modal with loading spinner for
marking all messages as read.

New file: confirm_mark_all_as_read.hbs
Fixes: #24624
2023-03-15 08:17:41 -07:00
Abhijeet Prasad Bodas 4d5e12961a user_topics.js: Rename `visibility_policy_inherit` -> `inherit`.
This makes our frontend code less verbose, and makes this name
consistent with the names of other visibility policies (which
do not have the `VISIBILITY_POLICY` prefix).
2023-03-14 17:50:45 -07:00
Prakhar Pratyush ae72777c77 user_settings: Automate 'Include realm name in message email subject'.
Currently, there is a checkbox setting for whether to
"Include realm name in subject of message notification emails".

This commit replaces the checkbox setting with a dropdown
having values: Automatic [default], Always, Never.

The Automatic option includes the realm name if, and only if,
there are multiple Zulip realms associated with the user's email.

Tests are added and(or) modified.

Fixes: #19905.
2023-03-14 17:48:57 -07:00
SameepAher 079eb6a4da keyboard_ui: Add a new keyboard shortcut '='.
Added new keyboard shortcut '=' to toggle the first emoji on the
selected message if it exists, else do nothing.

Fixes: #24256.
2023-03-14 14:17:54 -07:00
Daniil Fadeev a80f96dde6 reactions: Prevent multiple simultaneous requests for reaction update.
Prevents multiple simultaneous requests to the API when adding or
removing reactions. This commit blocks emoji state changes until
the request is executed.

Fixes part of #21213
2023-03-14 13:53:42 -07:00
Sahil Singh 19ae2f9180 i18n: Add translation tags to loading message.
Previously, no translation tag was present for 'Loading…' message.

Fix this and also switch to using the … character instead of 3
. characters.
2023-03-14 13:23:48 -07:00
Sahil Singh 37a0c9c1b9 settings: Fix alignment of loading message.
The loading message that appears at the
top of the page when loading the Bots/
Uploaded Files/Users/Deactivated Users
page under Settings appears to be misaligned.

We fix this by changing the height of the
loading-spinner to match the line-height
of loading text.
2023-03-14 13:23:48 -07:00
Alya Abbott 005ca2b033 portico: Add landing page about trying Zulip by visiting chat.zulip.org. 2023-03-14 13:21:09 -07:00
Sahil Batra bd9d1b9158 dropdown_list_widget: Set dropdown menu wide enough to fit options.
We now set the width of dropdown menu opened for dropdown-list-widget
elements such that it is enough for all the options. For smaller
screens the dropdown menus are wide since the settings panel and
modal content can be scrolled horizontally.
This change is done only for dropdown-list-widget elements in
"Organization settings" panel and in bot-owner widget in bot edit
modal.

We don't do this change for move topic modal now as it cannot be
scrolled horizontally and appears beneath the button due to position
property.
2023-03-14 12:53:41 -07:00
Sahil Batra 7d9fe8fd23 settings: Set width of dropdown toggle same as select elements.
This commit sets width of toggle buttons for dropdown list
widget elements same as select elements in both organization
settings. We set the min-width to be 325px and max-width to
100%.
2023-03-14 12:53:41 -07:00
Sahil Batra d8750d69ae subscriptions: Fix scrolling of stream edit panel in narrow screens.
The height of stream edit panel in stream settings panel was set
incorrectly for width less than "$md_min" so one could not scroll
to the bottom. This commit fixes the height to set it same as it
is for normal width screens since the height of elements above
the scrollable container does not change with screen width.
2023-03-14 12:53:41 -07:00
Sahil Batra 0beac2f221 settings: Make settings page horizontally scrollable.
We make settings page horizontally scrollable such that
the user can see the complete dropdown by scrolling in
case the dropdown is wider than the screen.
2023-03-14 12:53:41 -07:00
Sahil Batra 882f39443a stream_settings: Set width of dropdown list widget for long options.
This commit fixes width of dropdown-list-widget used for
can_remove_subscribers_group stream setting. The button width
is set as per the selected option with min-width being 325px.
The dropdown-menu width is set as per the longest option and
the menu becomes scrollable if the whole menu doesn't fit on
screen.

We also change the position of dropdown-menu slightly such that
its top border matches with the top border of button.
2023-03-14 12:53:41 -07:00
Sahil Batra 610bd5951d streams: Set width of select elements in stream settings page.
This commit sets width of select elements in stream settings
page to "auto" such that the width adjusts to fit the options
as required in different languages and we also keep minimum
width of 325px to maintain consistency of width across elements
in the page to not look ugly.
2023-03-14 12:53:41 -07:00
Sahil Batra 80bd425133 settings: Set width of select elements in settings page.
This commit sets width of select elements in settings page
to "auto" such that the width adjusts as required in different
languages and we also keep minimum width of 325px to maintain
consistency of width across elements in the page to not look
ugly.

We also remove the CSS for overriding width of various role
based select elements and a couple of others which was added
to adjust the widths for different languages. Since we have
now set the width to auto, the browser will automatically
adjust width to fit the options.
2023-03-14 12:53:41 -07:00
Steve Gattuso 36bf49bc8d hotspots: Keep track of open state in js.
Picking up the work from where 65aa1070 left off, this commit adds a
meta state to the hotspots module. This allows us to keep track of
whether or not a hotspot's overlay is currently open from within
javascript. With this in place, is_open is then modified to look at this
new state rather than query the DOM, providing a significant performance
boost.

Fixes #24261
2023-03-13 17:14:02 -07:00
Steve Gattuso 53e947e501 hotspots: Move overlay click handler into module.
In preparation of fixing the performance issues associated with
hotspots.is_open, this commit moves the various handlers for hotspots'
overlay from click_handlers.js into the hotspots module. This will set
us up to cleanly keep track of the open state from within the module
(instead of needing to look at the DOM).
2023-03-13 17:14:02 -07:00
sbansal1999 5047f1a81d ts: Convert portico/tabbed-instructions.js to TypeScript. 2023-03-13 12:37:31 -07:00
sbansal1999 9e4529c48b docs: Change extensions from .js to .ts for some filenames.
Since we are migrating from JavaScript to TypeScript
some files in the documentation are still with their
old extension. This commit changes those file extensions.
2023-03-12 15:17:53 -07:00
Aman Agrawal dbe930394f footer: Integrate newly designed footer.
This footer was designed and mostly written by @terpimost.

This adds a new design of the footer for both corporate and not
corporate enabled pages.
2023-03-10 17:34:15 -08:00
Aman Agrawal e8cefe181a team: Don't throw error for team page in dev environment.
In dev setup, contributors list is empty so loading the page
throws an error, this is intended to fix that.
2023-03-10 17:34:15 -08:00
Anders Kaseorg c41fa0dfd0 styles: Fix layout shifting for highlighted help sidebar link.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-10 14:43:30 -08:00
Akarsh Jain b0928f55e7 streams: Add stream symbol to unsubscribe confirmation modal.
This commit adds the appropriate stream symbol to the
heading of the "Unsubscribe from stream" confirmation modal.

Fixes: #23953
2023-03-10 14:37:55 -08:00
sbansal1999 5f4bdfe6bc ts: Convert css_variables.js to TypeScript. 2023-03-10 14:35:23 -08:00
Ujjawal Modi 0eca9cb319 bots: Improve bots permission banner.
Added a separate template file for banner
messages in bots panel under personal and organisation
settings.

Banners for bots panel under personal
settings are shown only when user cannot add bots.
Banners for bots panel under organisation settings are shown
only when user cannot add bots or user is administrator.

Fixes #24155
2023-03-09 17:52:31 -08:00
palashb01 f081c4abfd display_settings: Add fade to emoji-theme & user-list-style banners.
Added a 1000ms fadeout timer to the success banners for the 'Emoji'
theme and 'user-list-style' checkbox, to match the other banners in
display settings.

Fixes: #23288.
2023-03-09 16:12:45 -08:00
palashb01 189ceee8f0 display_settings: Move the 'user-list-style' out of Emoji section.
Move the 'user-list-style' checkbox from the 'Emoji' section to the
'Advanced' section, and update the 'settings_display.js' file by
replacing the 'theme-settings' classname with 'advanced-settings'
classname to display the success banner of 'user-list-style' checkbox
with the 'Advanced' title.
2023-03-09 16:12:45 -08:00
palashb01 3dd84910f4 display_settings: Rename and reorder the theme dropdown menu.
Rename 'Sync with computer' to 'Automatic (follows system settings)',
'Light Theme' to 'Light' and 'Dark Theme' to 'Dark', and rename the
color scheme label to 'Theme'.

Reorder the dropdown menu to have light theme before dark theme.
2023-03-09 16:12:45 -08:00
palashb01 af07db7971 display_settings: Rename 'Theme' section to 'Emoji'.
Rename the 'Theme' section to 'Emoji'. Since there is no 'Theme' section
anymore, replace the 'theme-settings' classname with
'emoji-display-settings' in the 'settings_display.js' file.

The existing "Theme" selector dropdown is moved from the now the
'Emoji' section to the 'General' section.
2023-03-09 16:12:45 -08:00
palashb01 2067c71a93 display_settings: Rename and update the 'language-time' section.
Rename the 'language-time' title to 'General'. As the 'language-time'
section no longer exists, replace the 'lang-time-settings' classname
with the 'general-settings' classname in the 'settings_display.js' file.

Updated the 'change-the-time-format.md' and 'change-your-language.md'
documentation files to reflect these changes.

To pass the puppeteer_test Replaced the 'lang-time-settings-status'
classname to 'general-settings-status' inside 'settings.test.ts' file.
2023-03-09 16:12:45 -08:00
Hardik Dharmani 570c9e260b overlays: Fix dependency cycle between popover.js and overlays.js.
This is a Prep PR for #24426.

Removes direct dependency cycle between 'popover.js'
and overlays.js by creating popover.initialize method
called from 'ui_init.js' that calls
overlays.register_pre_open_hook(hide_all) and
overlays.register_pre_close_hook(hide_all).

Created a function call_hook that loop call all
registered hooks at the start of 'open_overlay' and
'close_overlay'.
2023-03-09 10:42:27 -08:00
Manas Jayaswal 3e24a05e66
settings: Improve wording of "Show API key" modal.
This commit changes the "Show API key" modal to use a more intuitive
description of the user's password field, and also to put the reset password
option, which should be the less common case, at the end.

Fixes: #24506.
2023-03-08 18:48:37 -08:00
N-Shar-ma 6a4c12b41e drafts: Space draft message content from restore draft button by 5px.
When the 1st line of a draft message took up the maximum horizontal space
possible, the last character was way too close to the pencil icon. More
noticeably, when a message began with a code block, it's right edge would
touch the icon.

To space the message contents and the restore draft button, now a margin
of 5px has been added to the draft message content. This makes the message
content narrower by 5px.
2023-03-08 11:33:53 -08:00
SameepAher 7f9fccedff css: Fix search bar width in right sidebar.
Remove old broken css which incorrectly set the width of the user list
filter bar in the right sidebar, for devices whose width is lesser than
md.
2023-03-07 16:50:30 -08:00
Aman Agrawal b0a468907b people: Add function get participants from user_ids_string.
This implements the TODO in recent_senders.
2023-03-07 15:43:03 -08:00
Aman Agrawal e6f3ffb946 recent_senders: Fix twice sent user ids in PM to self case.
This caused double user avatar to appear in recent conversations
for when showing user PM to self.
2023-03-07 15:43:03 -08:00
N-Shar-ma ce68911ab2 hashchange: Ensure no duplicate entries in browser history.
Until now, whenever the hash was updated using the `set_hash` function,
the new url was always pushed into the browser history, even if the current
hash was same as the new hash. This lead to multiple duplicate entries in
the browser history, when using the `z` hotkey to zoom to a message
repeatedly, which is very inconvenient when navigating through history.

This is now fixed by simply returning prematurely from `set_hash` if the
new hash is same as the current one. This fix will also prevent any future
features like `z` from causing duplicate browser history entries.

Fixes: #24468.
2023-03-07 15:39:36 -08:00
evykassirer 6581276a87 search css refactor: Nest media queries. 2023-03-07 15:38:11 -08:00
evykassirer 0a7fbc7085 search css refactor: Move search-related selectors out of media queries. 2023-03-07 15:38:11 -08:00
evykassirer 1df3b4f86f search: Rename .search_button to more correct .search_close_button. 2023-03-07 15:38:11 -08:00
evykassirer 3d3d00ab8e search css refactor: Split pill searchbox code into its own section. 2023-03-07 15:38:11 -08:00
evykassirer a030fe40ac search css refactor: Split up general media query. 2023-03-07 15:38:11 -08:00
evykassirer f1e6f4b5dd search css refactor: Move relevant css from zulip.css. 2023-03-07 15:38:11 -08:00
evykassirer caba06e93d global css: Convert SASS variables to CSS custom properties. 2023-03-07 15:38:11 -08:00
Hardik Dharmani e61a092f1e
stream_settings: Fix save/discard widget on narrow screens.
In narrow screens, the save/discard widget was incorrectly shown
even with no changes, due to the CSS intended to switch it from `inline-block` 
to `block display.

Fixed by adding `display: none` to `.hide` class for @media(width < 575px)
to hide buttons on screen width less than 575px.

Fixes #24589.
2023-03-07 15:37:24 -08:00
Alex Vandiver 739d527b16 sentry: Enable reporting on portico and other unauth pages. 2023-03-07 15:01:27 -08:00
Alex Vandiver b04843e2f9 sentry: Consistently use "(root)" for empty realm in user info. 2023-03-07 15:01:27 -08:00
Alex Vandiver cd288af4d5 sentry: Better URL filtering.
Always add `webpack_public_path` to all of the URL filters, and make
it a regex.  Also adjust to respect undef realm_uri, such as when a
spectator.
2023-03-07 15:01:27 -08:00
Hardik Dharmani 74ff9a4beb
popovers: Add disabled button CSS for light theme.
Previously, we only had disabled button CSS for the dark theme in dialog widgets.

Fixes #24567.
2023-03-07 11:01:01 -08:00
Alex Vandiver 8f8a9f6f04 sentry: Add frontend event monitoring.
Zulip already has integrations for server-side Sentry integration;
however, it has historically used the Zulip-specific `blueslip`
library for monitoring browser-side errors.  However, the latter sends
errors to email, as well optionally to an internal `#errors` stream.
While this is sufficient for low volumes of users, and useful in that
it does not rely on outside services, at higher volumes it is very
difficult to do any analysis or filtering of the errors.  Client-side
errors are exceptionally noisy, with many false positives due to
browser extensions or similar, so determining real real errors from a
stream of un-grouped emails or messages in a stream is quite
difficult.

Add a client-side Javascript sentry integration.  To provide useful
backtraces, this requires extending the pre-deploy hooks to upload the
source-maps to Sentry.  Additional keys are added to the non-public
API of `page_params` to control the DSN, realm identifier, and sample
rates.
2023-03-07 10:51:45 -08:00
Alex Vandiver 19691b170b blueslip: Report the built client version, as well as server version. 2023-03-07 10:51:45 -08:00
Alex Vandiver a8181152b7 webpack: Build a ZULIP_VERSION global constant into the built product. 2023-03-07 10:51:45 -08:00
Joelute b2b86b5e6f message_feed: Hide compose banner when unsubbing from stream.
Currently, when a user marks messages as unread in a stream/topic
and unsubscribes from the stream, both subscribe button and compose
banner will remain visible. This change will hide the compose banner
when the user unsubscribes from the stream and hopes to create a
better flow and reduce confusion.
2023-03-06 18:08:41 -08:00
Tim Abbott c58e893cb6 linkifiers: Add missing coverage ignore.
This was incorrectly missing in the last linkifiers commit.
2023-03-06 10:57:50 -08:00
Haridarshan Choudhary d335cb34af
message_events: Avoid full rerender when marking unread.
Previously, when you did a "mark as unread from here" operation, we triggered 
a full rerender of both the recent topics view and the message feed. This was 
needlessly expensive, on and a large server with a somewhat busy CPU from 
other applications, can cause a visible lag, even when the message feed that 
you're looking at only has like 3 messages in it.

Improve this by passing the set of modified messages to the rerender.

There's likely further improvements to be made here -- we shouldn't need to
do more than toggle the unread markers -- but this should be good enough to
eliminate the visible lag.

Fixes #24263.
2023-03-06 10:39:47 -08:00
sbansal1999 d1253043a5 ts: Convert linkifiers.js to TypeScript. 2023-03-06 10:30:00 -08:00
Lauryn Menard b5f5ab948a puppeteer: Fix small logging copy and paste error in `admin.test.ts`. 2023-03-06 09:42:11 -08:00
Pranav Joglekar 2c316ce1ac
gear_menu: Update 'Support Zulip' link.
Previously the 'Support Zulip' option linked to Github Sponsors.
We now link to our own https://zulip.com/help/support-zulip-project,
which describes more options for how to support the project.

Fixes #24230.
2023-03-06 08:01:56 -08:00
Lauryn Menard f1e60014fa css: Move `pre code` reset rules to `rendered_markdown` class block.
Moves and simplifies the `pre code` rules in `rendered_markdown.css`
so that they are all part of the `rendered_markdown` class block.
2023-03-03 14:10:06 -08:00
Lauryn Menard 69e224cd87 templates: Add `rendered_markdown` class to confirm emoji warning.
Adds a `div` wrapper with the `rendered_markdown` class to the
content in `confirm_emoji_settings_warning.hbs`, so that the
inline code element has the intended CSS rules applied.

Because the `p` element also has the `rendered_markdown` class,
the margins for this element in the modal are slightly changed
(3px on top/bottom). Previously, the margins for this element were
being set from a bootstrap rule (10px on bottom).
2023-03-03 14:08:08 -08:00
Lalit 1b7f3eeb76 ts: Convert typing_data.js to TypeScript. 2023-03-03 12:04:42 -08:00
Lalit 88c23933bb util: Change parameter type of `sorted_ids` to `number[]`.
This function was mistyped; it was used in practice both accepting
string[] and number[], with the implementation taking advantage of the
fact that number.parseInt(<int>, 10) = <int>.

The only string[] callers were some overly defensive typing_data tests
that don't match the actual typing_data interface, so we remove the
string[] support and adjust the function's type, as well as those
tests.
2023-03-03 12:04:42 -08:00
Joelute 5762799d18 popovers: Remove background when hovering Github username.
When someone hovers over the Github username in the popover
with dark theme, a background will appear. These changes
ensures that the `background-color` isn't overwritten by
other CSS.
2023-03-03 11:46:30 -08:00
Joelute e44a87b271 documentation: Reduce `max-width` on content.
In the documentation, text-lines felt a bit too long
in text-heavy pages. This change aims to reduce
`max-width` on the content to 700px.

[CZO discussion](https://chat.zulip.org/#narrow/stream/19-documentation/topic/line.20wrapping.20code.20blocks/near/1516561)
2023-03-03 11:36:06 -08:00
Joelute e2346ab3ae documentation: Increase block width in help center.
After merging #24352, we want to increase the block
width in the help center to reduce the amount of
scrollbars that are shown. Thus, we decided to
remove `max-width` on all blocks.

[CZO discussion](https://chat.zulip.org/#narrow/stream/19-documentation/topic/line.20wrapping.20code.20blocks/near/1516561)
2023-03-03 11:36:06 -08:00
Sahil Batra 8a0b99cb39 streams: Align stream type icons in "Archive stream" modal.
This commit adds inline_decorated_stream_name component
which is used to show stream name along with its privacy
type icon. This component is added such that we can align
the icon and stream name properly as there are many
instances where the icon and name are not aligned in the
current UI.

This component is only used in "Archive stream" modal for
now and will be used for other UIs as well in future.
2023-03-03 11:10:45 -08:00
Ujjawal Modi 18059e132d user groups: Enabled sorting of subscribers.
The new `#groups` overlay does not allow sorting of subscribers.
This commit adds support for sorting of subscribers.
2023-03-03 11:03:12 -08:00
Lauryn Menard bfa8a2438b templates: Revise explanatory text in code playground org settings.
Revises descriptive text and examples at the top of the code
playgrounds tab in the organization settings overlay to be shorter,
have only one example that includes the name field.

Also, adds the `rendered_markdown` class to the HTML code elements,
via an HTML span element so that the specific CSS rules for code
elements with that class will be applied to these examples.
2023-03-02 18:14:35 -08:00
Lauryn Menard 23bac34f08 templates: Revise explanatory text/example in linkifiers org settings.
Revises descriptive text and examples at the top of the linkifiers
tab in the organization settings overlay to be shorter, have only
one example and updates help center link text for capitalization.

Adds a link to the help center in the form/input area for adding
a new linkifier, which is consitent with the code playgrounds tab,
and means the link would be there if the form was converted to a
modal.

Also, adds the `rendered_markdown` class to the HTML code elements,
via an HTML span element so that the specific CSS rules for code
elements with that class will be applied to these examples.
2023-03-02 18:14:35 -08:00
Aman Agrawal 4f8169aab5 tippy: Add comment justifying `parent` as `appendTo` default. 2023-03-02 13:51:00 -08:00
Lauryn Menard bb819b4928 css: Remove rules in `integrations.css` for code elements.
Removes the specific rules for code elements in the integrations
documentation pages.
2023-03-02 13:32:50 -08:00
Lauryn Menard 262debb72b css: Update code element styling for documentation pages.
Updates `markdown.css` to remove border styling from code
elements, and instead use background-color (as well as
font-family) to visually highlight inline code elements
as distinct from regular text.

Updates code element font-family to be the same as in
`zulip.css`.

Makes padding on the left and right the symmetrical for
inline code elements. Previously there was 4px padding on
the right, but not on the left.

Maintains anchor font-color styling for code elements that
are also links.
2023-03-02 13:32:50 -08:00
Lauryn Menard 3c63025d88 css: Remove code elements from bootstrap.css.
Updates `markdown.css` and `rendered_markdown.css` for the rules
in `bootstrap.css` that were being used to style code elements and
removes the now redundant/ignored rules from `bootstrap.css`.
2023-03-02 13:32:50 -08:00
Sahil Batra 734d1848c0 server_events_dispatch: Update bots list only if needed.
After b21f533af, we now update the organization bots
list on receiving realm_user events since non-admins
can also see bots not owned by them in the list.

But the functions to update bot list should be called
only for bot users and not for others, otherwise it
results in an error.

This can be reproduced by first opening the organization
bots list and then just updating the name of the user.
Calling `redraw_bots_list` on receiving "realm_user/add"
event for non bot users will not raise any error but
still we avoid redrawing the whole list when not required.

This commit fixes the code to call functions to update
bot list only when the event is received for a bot.
2023-03-02 13:26:20 -08:00
Anders Kaseorg 6eeeb70570 muted_topics_ui: Rename mute_topic parameter to fix shadowing bug.
This was broken by 6e6fb47e20 (#24386).

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:22:05 -08:00
Anders Kaseorg 2a70c11c5f eslint: Fix unicorn/prefer-spread.
This was initially disabled for IE/Babel-related reasons that no
longer apply.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:16:56 -08:00
Anders Kaseorg 941a9bab38 message_flags.test: Call send_read with an array.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:16:56 -08:00
Anders Kaseorg 9d514a29d1 zjquery: Make FakeElement iterable.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:16:56 -08:00
Anders Kaseorg 6b3edb8b0d search_suggestion: Rename Attacher#concat to push_many.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-03-02 12:16:56 -08:00
Ujjawal Modi 5cf98d8653 streams: Allow sorting of stream members.
Stream members table in Create stream and stream subscribers UI
can now be sorted.
Fixes #21341
2023-03-01 17:29:01 -08:00
Trident Pancake 2c042ad100 typeahead: Suggest existing custom language in Code Playground settings.
The Code Playground feature can have multiple entries per language. So
the autocomplete for settings should return existing custom languages
too.
2023-03-01 17:02:44 -08:00
Trident Pancake 51bd3c8c8b typeahead: Show Code Playground entries in composebox typeahead.
This addresses #23935.
2023-03-01 17:02:44 -08:00
Trident Pancake f96daca32c typeahead: Handle non-pygments data in compare_language_by_popularity.
This added functionality will be used to compare pygment_language from
Code Playgrounds.

There is a choice of how to sort languages with popularity versus
without popularity. I chose to sort the Code Playground custom language
after other pygment languages based on the reasoning in the comments.
2023-03-01 17:02:44 -08:00
Trident Pancake 6f904dbec2 typeahead: Extract language popularity comparison to its own function.
In preparation for adding logic for Code Playground languages, which has
no popularity score, extracting the popularity comparison part of the
logic out to evolve it in future diffs.
2023-03-01 17:02:44 -08:00
Trident Pancake bab2eda283 typeahead: Add unit test for typeahead_helper.compare_language().
Bringing it under test before expanding its functionality and doing
refactoring.
2023-03-01 17:02:44 -08:00
Trident Pancake cb6c1c4f05 typeahead: Rename compare_by_popularity() for clarity.
compare_by_popularity() actually does two things:
1. compare A and B by their popularity
2. then if needed, compare alphabetically to break ties

Someone reading the function name might not be clear about that detail.

I'm renaming this function to remove the "by_popularity" wording, which
can mislead readers. I also added comments to clarify the detail.

The goal in future diffs is to break this up and make it more self
explanatory.
2023-03-01 17:02:44 -08:00
Trident Pancake da868d7e64 typeahead: Rename get_pygments_typeahead_list() for clarity.
The `get_pygments_typeahead_list()` function is only used by
`settings_playgrounds.js`. It isn't used by the autocomplete of the
composebox.

Renaming this function to make it clear where it's meant for.
2023-03-01 17:02:44 -08:00
Sahil Batra 558e97eec1 bootstrap: Remove bootstrap CSS for ".checkbox" selector.
We use "checkbox" class for label elements. We have already
added the CSS for these elements in components.css and thus
we can remove this CSS from bootstrap.css.
2023-03-01 16:34:12 -08:00
Sahil Batra be5ddfa629 bootstrap: Remove bootstrap CSS for checkbox type input elements.
We hide most of the native checkbox type input elements using
"clip: rect(0, 0, 0, 0)", as we instead make our custom checkbox
using span element. Native checkbox is used in emails page in
development environment for which we have already added CSS
in previous commit.

This commit removes the CSS rules set for checkbox type inputs
as part of our bootstrap removal project.
2023-03-01 16:34:12 -08:00
Sahil Batra 07f7089cf3 settings: Add bootstrap CSS to label.checkbox elements.
This commit adds min-height property added by bootstrap
to the label.checkbox elements in components.css.
We do not need to add padding-left property added by
bootstrap since we already set padding to 0.

After adding this CSS, we can safely remove the CSS from
bootstrap.css.
2023-03-01 16:34:12 -08:00
Sahil Batra 35ecf5f1e2 email_log: Add bootstrap CSS rules for checkbox element in emails_log.
This commit adds bootstrap CSS rules for checkbox element in
emails_log.html as we would remove the bootstrap CSS for checkbox
inputs in furhter commits. We add only required CSS rules.
2023-03-01 16:34:12 -08:00
Sahil Batra f9c739ab9d modals: Update checkbox in deactivate user modal to be same as others.
This commit changes the design of checkbox in deactivate user modal
to be same as others in the app. We have added parent element with
".new-style" class for now, since we have this for all other checkbox
in the app and this seems to be the simplest solution.

In future, we plan to remove the "new-style" class and instead add
CSS based on a component for checkbox elements.
2023-03-01 16:34:12 -08:00
Sahil Batra 5d00662135 bootstrap: Remove CSS for ".checkbox.inline" selector.
There is no element which has both classes - "checkbox"
and "inline", so we can remove the CSS for this in
bootstrap.css.
2023-03-01 16:34:12 -08:00
Sahil Batra 057f6e28f6 bootstrap: Remove CSS for ".form-inline .checkbox" selector.
We do not have any checkbox inputs inside any element with
form-inline class, so we can remove the CSS in bootstrap
which is used to set rules for checkbox inputs inside
form-inline element.
2023-03-01 16:34:12 -08:00
Sahil Batra 2a366f359b dialog_widget: Remove code related to email field visibility.
The code for hiding and showing email field in the user
deactiavtion modal was added in dialog_widget.js.

This commit removes it and instead add the code to its
relevant module (settings_user.js), since the email field
is present only in one modal and not all modals.
2023-03-01 16:34:12 -08:00
Tim Abbott c3f0a4493d tippy: Tweak comments for defaults definitions. 2023-03-01 15:57:51 -08:00
Aman Agrawal ae0f832d67 tippy: Add more delay to compose and message control button tooltips.
750ms is long enough that it's unlikely to occur without a user
intending to hover the element, reducing distraction for relatively
commonly used elements.

Also define a couple delay constants to provide a more semantically
meaningful configuration.
2023-03-01 15:57:51 -08:00
Palash Baderia c1009bc051 settings: Drop column from tables on narrow screen.
Drop the "last_active" column in the users section of the
organization settings, and the "Bot_type" column in the bots
section on sm_min (576px or less). Also, drop the "Date_muted"
column in the muted topics section of the personal settings
on ml_min (425px or less).

Added new className "topic_date_muted" for the date_muted
column, and "bot_type" for the bot_type column, to hide them
using display none when the viewport is small.

Fixes: #24320
2023-03-01 15:42:15 -08:00
Ganesh Pawar 5a5203144d modal: Make the modal content scrollable instead of the whole modal.
Earlier, if the content of the modal (apart from the header and footer)
overflowed, the whole modal would become scrollable which would hide
the modal header and footer on scrolling. This commit makes only
the modal content scrollable and keeps the modal header and
footer static.
2023-03-01 15:36:29 -08:00
Ganesh Pawar 6e19fe0ad1 Remove `overflow: visible` for `move_topic_modal`.
It was added in 85fc8d5472 to prevent
the dropdown list widget from being clipped off due to overflow.
This is not needed now since the `dropdown-menu` has a
`position: fixed` property which avoids it from being clipped off.
2023-03-01 15:36:29 -08:00
SameepAher 4b7a55d2c9 popovers: Close user popovers on button click.
Close the user or bot popovers in Users, Deactivated users, bots tab of
Organization settings, on clicking Edit user button, Deactivate button
or Reactivate button.
2023-03-01 15:14:16 -08:00
Hardik Dharmani ac01e3ee51 stream-settings: Fix long stream names abbreviated too early.
Make .stream-header div a flex container and adjust max-width
of .sub-stream-name to take up 100% of available space.
Add 1rem margin-left to .button-group for spacing.

Fixes: #24507
2023-03-01 11:54:31 -08:00
David Rosa 15fd5299af help: Update filenames "private message" -> "direct message".
Renames files, updates references, and adds URL redirects.
2023-02-28 16:55:13 -08:00
Daniil Fadeev ae089da9cb poll_widget: Make the poll-vote button the top layer.
Fixes #24409.
2023-02-28 16:53:49 -08:00
Aman Agrawal 30719c9057 portico: Fix portico footer broken on mobile widths.
I am not sure why I added this change in flex-direction
but right now, it doesn't seem to be correct since it force
the footer to overflow mobile width.
2023-02-28 16:52:47 -08:00
Ilikepizza2 caab470656 left sidebar: Scroll to current PM conversation on narrow.
Zulip has long had the behavior that opening a stream or topic via
narrowing automatically scrolled the left sidebar to the conversation,
so that you can see it and adjacent ones readily.

When we moved private messages into the left sidebar, we didn't
implement this similar behavior; this resulted in users having to
manually scroll the sidebar in order to browser private message
conversations.

Fix this by using the standard scroll_util helpers, with some extra
care to expand the heading when going to "all private messages".

Fixes #23609.

Co-authored-by: Tim Abbott <tabbott@zulip.com>
2023-02-27 11:58:53 -08:00
Joelute 4c6f85727c documentation: Add horizontal scrollbar to code blocks in help center.
Some code blocks in the help center have lines that are too long
to fit, and wrap onto the next line. This can look awkward, and
may cause confusion. An horizontal scroll bar is added to the code
blocks to help fit everything into their own lines and clear up
confusions.

Fixes #24004.
2023-02-27 11:52:01 -08:00
Ganesh Pawar 537617b46d invite_user: Convert overlay to `dialog_widget`.
Fixes #22957.
2023-02-26 18:37:05 -08: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
Aman Agrawal b0d9b319e3 message_row: Allow time row to expand if it needs more width.
While setting a min-width according to the current width, we allow
the time column to expand if the translated `AM/PM` time needs
more width.
2023-02-26 17:05:01 -08:00
m-e-l-u-h-a-n a200932dcc user groups: Send only updated attribute for user group updates.
Earlier PATCH user_groups/<int:user_group_id> required
both name and description parameters. So we had to send
them in patch requests even if just one of the attribute
was updated.

As the endpoint is now updated we send only those parameters
that are changed.
2023-02-26 16:22:24 -08:00
Lalit 508ac58dc0 stream_muting: Add `mark_read: false` option when re-selecting message.
Added `mark_read: false` as it doesn't make sense to
read/undread a message when just muting or unmuting a stream.
It is to make sure that we never consume a unread message
when just muting/unmuting streams.
2023-02-26 16:19:28 -08:00
Lalit 1cb4886a23 stream_muting: Fix message reselect bug.
Extended else if statement responsible for reselecting messages
to include check `!recent_topic_util.is_visible()`.

Before without this check, this code was consuming 1 unread
message on muting/unmuting a stream even when we were in
"Recent Conversations" view.
2023-02-26 16:19:28 -08:00
Anders Kaseorg 3a9fb767ea ts: Convert bundles to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-25 15:40:31 -08:00
Anders Kaseorg 96fadb3d66 ts: Convert trivial portico modules to TypeScript.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-25 15:40:31 -08:00
sbansal1999 2fa61bcec3 ts: Convert analytics/support.js to TypeScript. 2023-02-25 11:35:01 -08:00
sbansal1999 87d6180763 ts: Convert analytics/activity.js to TypeScript. 2023-02-25 11:34:56 -08:00
Anders Kaseorg a2ea5e8598 test-js-with-node: Fix source maps for coverage.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-24 13:54:29 -08:00
Lauryn Menard 42775219b3 private-messages: Update frontend strings to use "direct message" or "DM".
Updates frontend user-facing strings with "private message" or "PM" to
use "direct message" or "DM" respectively instead.

Note that this updates translated strings as well as a few that
are not translated like search suggestions.

Updates `tools/lib/capitalization.py` for some specific strings
that are impacted by these changes, and removes "PM" and "PMs"
from checked strings.
2023-02-24 11:47:26 -08:00
Sahil Batra 1ac6a9ac06 register: Allow user to change email_address_visibility during signup.
We now allow user to change email_address_visibility during user
signup and it overrides the realm-level default and also overrides
the setting if user import settings from existing account.
We do not show UI to set email_address_visibility during realm
creation.

Fixes #24310.
2023-02-24 09:23:34 -08:00
Sahil Batra 0620d2ac1b settings: Add "modal_select" to select element for custom user field.
Same template fike is used to show user custom profile fields in
both profile page in settings and in manage user modal. For select
elements in modals, the CSS is handled using modal_select class.
This commit adds modal_select class to the select element used for
custom user field, which already has settings_select class, so that
the CSS are also applied to the select element in manage user modal.
2023-02-24 09:13:09 -08:00
Sahil Batra a862e686db modal: Do not use flex for all modal titles.
The "display: flex" property was added to ".modal__title"
element in 9e4aa19ac in #24194 to fix overlay of long
name in user profile modal (#23781).

Due to this change, the space between words in heading of
"Archive stream" modal is being removed.

This commit fixes it by adding "display: flex" only to the
title of user profile modal and not all the modals. The
heading in "Archive stream" modal is not perfect but there
is ongoing work to fix it and till then this commit changes
it to be the same as it was before adding flex property.

There is no major change in other modals, except that the
space between heading and help-link widget has increased
which was anyways the case before adding the flex property
and that can be modified later if we want to.
2023-02-24 09:13:09 -08:00
Anders Kaseorg 0ef8e88b17 webpack: Move webpack configuration to web.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-24 06:35:58 -08:00
Anders Kaseorg 23fd4f95f4 web/tests: Don’t rely on current directory.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-24 06:35:58 -08:00
Palash Baderia d8adc6de1c personal_settings: Add deactivate organization button for organization.
Added a 'Deactivate Organization' button inside the
'Personal Settings > Account & Privacy'. This button only appears
when the organization owner is the only user present. To verify this,
I used the 'get_active_human_count' function from the 'people.js'.

To remove duplication, a function has been created inside settings_org
file to handle the click event for the two buttons present inside
personal_settings and organization_settings that perform the same
action of deactivating organization. The click handler is defined in
the click_handlers.js file, which calls the dialog for deactivating
the organization. Previously, the error used to appear at the top of
the organization_settings, but now it appears inside the dialog box
itself.

To remove the duplication of two buttons having the same IDs,changed
the Id `deactivate_realm_button` to a className.

Fixes: #24105
2023-02-23 18:17:28 -08:00
Aman Agrawal c9f4e474a7 integrations: Increase font size of trademark disclaimer.
This is to address Google complaining that the font size is too
small to read on the integration pages.
2023-02-23 17:50:09 -08:00
N-Shar-ma 599a32bee9 hotkey: Add `z` shortcut to zoom to message `near` view.
A new hotkey, lowercase `z` (for `zoom`) has been implemented to allow
the user to go to the near view of the selected message with 1 keypress.
Documentation has been added for this both in the help center, and the
in-app `Keyboard shortcuts` menu.

The effect is identical to clicking on a message's timestamp, which
links to that message's near view.

Fixes: #24227.
2023-02-23 17:47:45 -08:00
Anders Kaseorg 377b8b22c0 puppeteer_tests: Move to web/e2e-tests.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-02-23 16:04:17 -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
Anders Kaseorg c1675913a2 web: Move web app to ‘web’ directory.
Ever since we started bundling the app with webpack, there’s been less
and less overlap between our ‘static’ directory (files belonging to
the frontend app) and Django’s interpretation of the ‘static’
directory (files served directly to the web).

Split the app out to its own ‘web’ directory outside of ‘static’, and
remove all the custom collectstatic --ignore rules.  This makes it
much clearer what’s actually being served to the web, and what’s being
bundled by webpack.  It also shrinks the release tarball by 3%.

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