Commit Graph

1432 Commits

Author SHA1 Message Date
Satyam Bansal b4be3f6266 drafts: Remove unused CSS styles. 2023-08-11 15:54:17 -07:00
Satyam Bansal 0f0c52e096 drafts: Remove classes that had the same effect.
In commit 5edc8fc, abstract classes were added to the
drafts overlay, but the classes that were already there
were not removed. This resulted in the same styles being
applied twice.
2023-08-11 15:54:17 -07:00
Daniil Fadeev 28ba839857 condense: Focus on the message after condensing/expanding it. 2023-08-11 12:39:43 -07:00
Lauryn Menard 225be0bb97 dropdown-list-widget: Remove dropdown-list-body class and reference.
Removes the "dropdown-list-body" class and references as it is no
longer used in the new DropdownWidget. The previous uses of the
class were removed in commit 875d564f2d.
2023-08-11 12:26:47 -07:00
Karl Stolley da4e0c4073 compose: Allow URLs to be pasted onto selected text.
Fixes: #18692
2023-08-09 15:35:14 -07:00
Karl Stolley cd0fd49a83 copy_paste: Strip back tests to only test handler.
This gets us out of the brittle business of trying to mock a
complex event like "paste"--which mocking basically means we
are testing against the mock more than a real event.

The test name is also changed to clarify the handler being
tested.

See CZO discussion behind this change:
https://chat.zulip.org/#narrow/stream/43-automated-testing/topic/mocking.20browser.20events.3F/near/1615110
2023-08-09 15:35:14 -07:00
Karl Stolley 96654c49c7 print: Hide closing X on search bar. 2023-08-09 15:26:10 -07:00
Karl Stolley a73faf6579 tests: Disable flaky test_edit_bot_form test. 2023-08-09 15:25:48 -07:00
Hemant Umre 63173ce1bc stream_settings: Add 'Default stream' option in create stream UI.
In this commit, we introduce a new option in the stream creation
UI - a 'Default stream for new users' checkbox. By default, the
checkbox is set to 'off' and is only visible to admins. This
allow admins to easily designate a stream as the default stream
for new users during stream creation.

Fixes #24048.
2023-08-09 15:20:09 -07:00
Hemant Umre a81715786c stream_settings: Add 'Default stream' option in edit stream UI.
This commit adds a 'Default stream for new users' checkbox in
the stream editing UI to allow admins to easily add or remove
a stream as the default stream for new users. Previously, this
functionality required navigating to separate menu.

Fixes a part of #24048.
2023-08-09 14:38:52 -07:00
nimish d3c99682c3 message_feed: Fix collapsed messages for highlighted texts.
Fixes #26346.
2023-08-08 12:19:54 -07:00
Lalit 119f581470 ts: Migrate `pm_conversations` module to typescript. 2023-08-08 12:19:12 -07:00
evykassirer c3fe96af52 compose: Use stream id instead of stream name for composebox opts. 2023-08-07 17:08:59 -07:00
evykassirer 41b900c2c0 compose: Get stream name from id in create_message_object.
Since this is based off of the id now and doesn't try
to get a stream from a name (because stream is now
selected by a dropdown and not a free-form input field),
we can also remove the error handling for when the
stream name doesn't correspond to any streams.
2023-08-07 17:08:59 -07:00
evykassirer f190419bc9 composebox_typeahead: Get topics_seen_for stream id instead of name. 2023-08-07 17:08:59 -07:00
evykassirer 8cee3dfbf2 snapshot_message: Get stream id from name instead of name from id. 2023-08-07 17:08:59 -07:00
evykassirer d9edcba724 narrow_state: Rename stream() to stream_name() which is more accurate. 2023-08-07 17:08:59 -07:00
evykassirer ba9cfc2cd8 update_messages: Compare to compose stream by id instead of name. 2023-08-07 17:08:59 -07:00
evykassirer 4b23bc1915 narrow: Get stream name from id instead of id from name. 2023-08-07 17:08:59 -07:00
evykassirer ab630b166c compose state: Check if stream is selected with id instead of name. 2023-08-07 17:08:59 -07:00
evykassirer 368c613738 focused recipient: Remove unused stream attribute.
Now that stream_id is used instead of stream, we
can stop setting `focused_recipient.stream`.
2023-08-07 17:08:59 -07:00
evykassirer d7d7828a12 hashchange: Remove hiding of recent topics.
Recent Topics is hidden when we switch to a narrow view
or the All Messages view, so this call is not needed.
It will also become actively unhelpful when we build
a stream-specific recent topics page, because then it
will be possible to have a hash change that shouldn't
close the recent topics view.
2023-08-07 10:06:48 -07:00
evykassirer 40e40e09ba puppeteer: Use `stream_name` instead of `stream` for clarity. 2023-08-07 09:57:40 -07:00
Sahil Batra db3b9e4742 settings: Make custom profile fields table consistent with others.
We change the custom profile fields table to have same header as
of other table and as a result this also makes the page look
better if an organization has zero custom profile fields.
2023-08-06 18:13:33 -07:00
Sahil Batra 7bd7ccc439 bootstrap: Remove bootstrap CSS defined using "table" class.
We have already added the required bootstrap CSS defined using
"table" class in specific files and thus we can remove them
from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 817e39650e css: Re-add bootstrap CSS defined using "table" class.
This commit re-adds bootstrap CSS rules defined using "table"
class to the specific CSS files where CSS for different tables
is present.

This is a prep commit for removing table related bootstrap CSS
from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra fcaaa6566e bootstrap: Remove bootstrap CSS for <table> element.
This commit adds the required bootstrap CSS for "<table>"
element in the specific files and removes them from
bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 9240d780a4 bootstrap: Remove CSS for table-stripped from bootstrap.css.
This commit re-adds the CSS to have different background for
alternate rows in striped tables to specific files and remove
them from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 806abf7d1c bootstrap: Remove bootstrap CSS for table-condensed class.
This commit re-adds bootstrap CSS rules defined using
"table-condensed" class to the required files and removes
them from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 1111cbb190 bootstrap: Remove bootstrap CSS for table-bordered.
We have already re-added the bootstrap CSS rules defined using
"table-bordered" class in the specific files where required and
thus this commit removes them from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 91cba1a05e informational_overlays: Fix top and bottom borders in thead.
Previously, two borders were applied on the heading of tables
in informational_overlay. Top of the heading element had one
border from "table" and one from "th" element. Bottom of the
heading had one border from "th" element and one from "td"
element.

This commit fixes it by changing the CSS for borders on
"th" element to be applied only on striped tables without
borders (i.e. tables having "table-striped" class but not
"table-bordered" class) as bordered tables already have
top borders defined on td and table element while on
striped tables without borders, only bottom border is
applied on "td" elements along with the top and bottom
borders on "th".
2023-08-06 18:13:33 -07:00
Sahil Batra 3ce6fbe10a css: Re-add bootstrap CSS for tables with "table-bordered" class.
This commit re-adds bootstrap CSS rules with "table-bordered" class
to app_components.css so that tables used in the app can use this
css and we can remove the CSS from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 29ce34020d portico: Re-add bootstrap CSS for tables with "table-bordered" class.
This commit re-adds required bootstrap CSS rules defined with
"table-bordered" class to the specific files.

This is a prep commit to remove bootstrap CSS for tables.
2023-08-06 18:13:33 -07:00
Sahil Batra 2976f3f9e7 bootstrap: Remove unnecessary CSS defined using ".table".
We do not use classes like "success", "warning", "info"
and "error" for "tr" elements used in tables and thus
we can remove the related CSS from bootstrap.css.

We also do not have selectors of the form ".table .table"
and so we can remove that CSS from bootstrap.css as well.

ALso, the CSS defined using ".table tbody + tbody" to
set the border is not required as we already set borders
on th and td elements.

The browser defaults for font-weight for `th` elements
is "bold" so we can remove the CSS to set font-weight
from bootstrap.css.
2023-08-06 18:13:33 -07:00
Sahil Batra 3da647c246 bootstrap: Remove unnecessary CSS for th and td elements.
The html for tables used by us has a following structure-

<table>
    <thead>
        <tr>
            <th></th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td></td>
        </tr>
    </tbody>
</table>

So, as per the above structure, we do not have th elements
inside tbody and td elements inside thead and thus we can
remove the bootstrap CSS rules for these cases. Also, we
always have a thead before tbody, so tbody:first-child CSS
can also be removed.
2023-08-06 18:13:33 -07:00
Sahil Batra ba4ccb00a9 bootstrap: Remove CSS for "tfoot" elements.
We use "tfoot" element only in realm_domains_modal.hbs
template and this table does not have table-bordered class.
The bootstrap CSS rules for "tfoot" elements are only for
the "tfoot" elements inside a table with "table-bordereds"
class so we can safely remove the bootstrap CSS.
2023-08-06 18:13:33 -07:00
Sahil Batra ae72151ec1 streams: Pass stream_weekly_traffic field in stream objects.
This commit adds code to pass stream traffic data using
the "stream_weekly_traffic" field in stream objects.

We already include the traffic data in Subscription objects,
but the traffic data does not depend on the user to stream
relationship and is stream-only information, so it's better
to include it in Stream objects. We may remove the traffic
data and other stream information fields for Subscription
objects in future.

This will help clients to correctly display the stream
traffic data in case where client receives a stream
creation event and no subscription event, for an already
existing stream which the user did not have access to before.
2023-08-06 18:06:42 -07:00
Sahil Batra 7258a2caaf settings: Fix save-discard widget handling for code block language.
The save-discard was not being hidden properly in the below case-
- The "Default language for code blocks" setting was disabled
initially (i.e. the "Disable" option was selected in the dropdown),
meaning there was not default language set.
- The setting is then udpated to "javascript" and the save-discard
widget is shown as expected.
- The setting is then again change to "Disable" option.

The save-discard widget should have been hidden after the last
step, but it does not.

This was because while comparing the old and new value, the new
value (obtained using get_dropdown_list_widget_setting_value) was
computed as "null" while the old value (obtained from page_params)
was an empty string "". This commit fixes the bug by changing
get_dropdown_list_widget_setting_value to return empty string "",
instead of null, when the "Disable" option is selected in the
dropdown.

The "get_dropdown_list_widget_setting_value" function was returning
null previously, as we supported both null and empty string "" to
represent the state of no language selected, with null being the
initial value and empty string being used if user changed the
setting to some language and then disabled it again.
This was changed in #26275 and the state of not setting any default
language for code blocks is now represented using empty string in
all cases.
2023-08-06 17:53:57 -07:00
Sahil Batra fc5b63e5cd settings: Fix save-discard widget fo.
The save-discard widget was not showing and hiding correctly
for the "Automated messages and emails" section in organization
settings panel. This was because the "proposed_val" was always
being returned as "undefined" for language setting as
"data-language-code", which is used to check the proposed value
of setting, was not set after changes in 36475daba7.
This commit fixes it by passing language_code value to
language_selection_widget and thus setting "data-language-code"
attribute correctly.

The changes in 36475daba7 removed language_code parameter from
language_selection_widget as it was not passed in the template
from "Display settings" section. So, this commit also passes
the language_code parameter to language_selection_widget from
"Display settings" section.
This change sets the "data-language-code" attribute even when
it is not being used there, to make sure there is no reference
to undefined fields in language_selection_widget.

Note that the above bug was reproducible only if you have not
changed the language even once and are trying to change the
other settings, as the data-language-code attribute was set
after selecting a language from the modal, but it was not
set initially after rendering the page.
2023-08-06 17:53:57 -07:00
evykassirer 5b5ab1dbc1 scheduled messages: Allow user to reschedule quickly from edit window.
Currently we unschedule messages as soon as they're opened for editing.
Users have requested a way to easily reschedule, especially for
situations where they didn't end up wanting to edit the messages in
the first place.

This commit adds an action button to reschedule the message for the
time it was originally scheduled for.

CZO:
https://chat.zulip.org/#narrow/stream/9-issues/topic/Scheduled.20message.20sent.20to.20draft.20if.20no.20changes
2023-08-06 14:34:33 -07:00
Aman Agrawal 3303b5ab72 dropdown_widget: Show disabled if value not in options.
It is possible that the current value of a dropdown widget is
valid but not present in options since the current user doesn't
have access it. So, we show [disabled] as value in that case.

This can be reproduced by setting a private stream for
notifications in org settings and then opening org settings
as a user which doesn't have access to the private stream.
2023-08-06 14:18:51 -07:00
Prakhar Pratyush 3d5d434e71 settings: Add a saving-saved indicator to the 'SETTINGS/TOPICS' UI.
This commit adds a 'saving...' - 'saved' indicator to the
'SETTINGS/TOPICS' UI.

This improves the UX by reflecting that the changes are saved.
2023-08-06 13:55:21 -07:00
Karl Stolley 399092543c print: Try to keep message headers with messages.
This avoids making "orphans" out of message headers when printing
interleaved views on supporting browsers.
2023-08-06 13:27:40 -07:00
Karl Stolley 7012fd5b78 print: Add Safari-inspired fixes. 2023-08-06 13:27:40 -07:00
Karl Stolley 6193b5577d print: Set auto height on html, body. 2023-08-06 13:27:40 -07:00
Karl Stolley d3dcc8895d print: Ensure crisp edit/timestamp text. 2023-08-06 13:27:40 -07:00
Karl Stolley d020a100c3 css: Isolate dark theme to screen only.
The primary motivation for this change is to default to the light
theme when printing.
2023-08-06 13:27:40 -07:00
Anders Kaseorg 63c9296d53 tests: Fix direct mutation of ES modules.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 18:00:38 -07:00
Anders Kaseorg 64c973d8ec namespace: Tighten override_rewire old_value check.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 18:00:38 -07:00
Anders Kaseorg 529d35c530 namespace: Clean up template_path manipulation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-04 14:38:37 -07:00
Karl Stolley 73fbca7ae9
tests: Correct the spelling of 'caret'. 2023-08-03 12:54:43 -05:00
Anders Kaseorg 6632eca2dc stream_data: Use yield*.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-08-02 19:01:20 -07:00
Junyao Chen 8df9828ed1 ts: Migrate `alert_words.js` to TypeScript.
Added type annotations for function params, return values and
local variables.
2023-08-02 18:38:58 -07:00
Lalit Singh 2893685890 people: Revert to using `ignore_missing` parameter.
We revert to use `ignore_missing` parameter for `maybe_get_user_by_id`
function to avoid sending unnecessary `blueslip.error()` calls to
sentry.
2023-08-02 17:25:14 -07:00
Aman Agrawal 875d564f2d stream_settings: Migrate to new DropdownWidget.
Also, remove old DropdownListWidget since it is no longer used.
2023-07-27 14:10:08 -07:00
Aman Agrawal aa8e94ca6d settings_org: Migrate dropdowns to new DropdownWidget.
This also moves [Disabled] button inside the dropdown.
2023-07-27 14:10:08 -07:00
Aman Agrawal 6efcb7a349 dropdown_widget: Refactor to use Class. 2023-07-27 14:10:08 -07:00
Anders Kaseorg d91d6d1fd1 settings_profile_fields: Simplify convoluted sort algorithm to max.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-27 14:06:25 -07:00
evykassirer ec25baa344 compose: Return focus to DM input after pill selection.
Before this change, the cursor left the DM recipient box after
selecting a pill from the typeahead. This was only the case with
mouse clicks and not with keyboard selection.

This change ensures we always return focus to the input field
after selection.
2023-07-26 21:05:38 -07:00
Karl Stolley 3b63faf33c bot_icon: Correct vertical alignment. 2023-07-26 12:15:11 -07:00
Ujjawal Modi fbcc3b5c84 user_groups: Rename `can_mention_group_id` parameter.
Earlier the API endpoints related to user_group accepts and returns a
field `can_mention_group_id` which represents the ID
of user_group whose members can mention the group.

This commit renames this field to `can_mention_group`.
2023-07-25 18:33:04 -07:00
Ujjawal Modi c8bcb422f5 streams: Rename `can_remove_subscribers_group_id` parameter.
Earlier the API endpoints related to streams accepts and returns a
field `can_remove_subscribers_group_id` which represents the ID
of user_group whose members can remove subscribers from stream.

This commit renames this field to `can_remove_subscribers_group`.
2023-07-25 18:33:04 -07:00
Karl Stolley 61f30fa347 print: Add print styles targeted at topics. 2023-07-25 17:30:40 -07:00
Sahil Batra befcb46ba3 dialog_widget: Rename "dialog_cancel_button" to "dialog_exit_button".
This commit renames "dialog_cancel_button" class in the exit button
of modals to "dialog_exit_button", which seems a much better name
for a button that is used to close a modal.
2023-07-25 10:25:12 -07:00
Sahil Batra 8db9093d0b stream: Change button text to "Close" in copy email address modal.
This commit changes the button text from "Cancel" to "Close" in
copy email address modal, since it is weird to click on "Cancel"
button after having copied the email address and might confuse
users. Using "Close" makes it clear that the button is to just
close the modal.
2023-07-25 10:25:12 -07:00
Tim Abbott 213387249e css: Fix prettier error and reorganize some colors. 2023-07-24 18:06:25 -07:00
evykassirer 92e24a9727 compose: Don't select compose input field after focus.
Fixes #25950.

Focus area is mostly determined by finding the first
relevant field that is *empty*, and selecting empty
fields has no effect.

The only situation where the field might not be empty
is when the textarea already has text in it, since
that's the default option. We don't want to select
the composebox textarea because this can lead to
people losing their messages if they start typing
right away.
2023-07-24 17:53:46 -07:00
Ishita Gupta aa86533f22 UI redesign: more-less message interaction.
This commit encompasses the following changes:
* Replace the [More...] link with a button titled "Show more".
* Replace the [Show Less...] link with a button titled "Show less".
* Add various on-hover interactions to the buttons.
* In the condensed view, add fading to the bottom of the message to
  visually communicate that the message is truncated.
* Update /help/ description.

Fixes #22801.

Co-authored-by: Evy Kassirer <evy.kassirer@gmail.com>
2023-07-24 17:42:08 -07:00
Zixuan James Li fe1a2f6f02 realm_playgrounds: Refactor error handling for validation on creation.
Previously, the view function was responsible for doing a first pass of
the validations done for RealmPlayground. It is no longer true now. This
refactors do_add_realm_playground to check_add_realm_playground and make
it responsible for validating the playground fields and doing error
handling for the ValidationError raised.
2023-07-24 17:40:59 -07:00
Zixuan James Li 000761ac0c realm_playgrounds: Replace url_prefix with url_template.
Dropping support for url_prefix for RealmPlayground, the server now uses
url_template instead only for playground creation, retrieval and audit
logging upon removal.

This does the necessary handling so that url_template is expanded with
the extracted code.

Fixes #25723.

Signed-off-by: Zixuan James Li <p359101898@gmail.com>
2023-07-24 17:40:59 -07:00
evykassirer c4bc0ad589 message feed: Change color of zulip logo at top of feed. 2023-07-24 17:27:59 -07:00
Junyao Chen 30c535fc63 ts: Migrate `vdom.js` to TypeScript.
Added type annotations for variables, function params, and return
values. Created custom types that help with clean type annotations.

Notes on `attrs` field in custom `Option` type:
 `attrs` is an `Iterable` where each element is a pair of string, i.e
a string array with two elements. `attrs` is tranformed into a `Map`
at some point. `Map` constructor takes in `Iterable` object so has
no problem unifying with `attrs`. However, at some point `attrs` is
transfomed using `.map(...)` which is an array method, and `Iterable`
does not support `.map(...)`. So at this point, I cast `attrs` into
array before using `.map(...)` by this syntax:
`[..attrs].map(...)`
2023-07-24 16:49:53 -07:00
Karl Stolley 5d819ea254 grid: Remove unnecessary mobile-scale padding.
This also removes padding on .message_content that wasn't actually
rendered due to its low specificity. It was likely also leftover
from an earlier, non-grid-based layout.
2023-07-24 16:47:14 -07:00
Junyao Chen c693816d66 ts: Migrate `huddle_data.js` to TypeScript.
Added type annotations.
2023-07-24 16:45:30 -07:00
Anders Kaseorg bc1e953f0f dark_theme: Remove Firefox override for dropdown appearance.
We get the right background-color from line 487 in the same way as
Chrome.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-24 13:43:17 -07:00
lapaz 5d5e1963b9 settings: Add "Copied" tooltip in bots/streams copy feedback.
This provides a bit nicer feedback to the user that the copy worked.

Fixes #26181
2023-07-24 13:21:43 -07:00
Anders Kaseorg 1b72d5c413 styles: Remove Firefox override for dropdown appearance.
The default appearance in modern Firefox is totally fine, and our
override was incorrectly changing the dropdown triangle to black for
the dark theme.

Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-24 13:10:03 -07:00
Hardik Dharmani cd24620c4a js: Rename top_left_corner.js to left_sidebar_navigation_area.js.
This provides a much clearer and more consistent codebase name for
this part of the app.

Fixes part of #25902.
2023-07-24 13:02:28 -07:00
Lalit bd6184305a realm_playground: Iterate over `playgrounds_data` directly.
Using `Object.values(playgrounds_data)` for iterating over an array is
unnecessary when we can just directly loop over the array here.
2023-07-24 12:49:53 -07:00
Lalit 829caae189 ts: Migrate `realm_playground` to typescript. 2023-07-24 12:49:53 -07:00
Lalit 4a4d23a548 realm_playground: Remove `generated_pygments_data` parameter for
initialization function.

We are already importing `generated_pygments_data.json` directly in
`realm_playground.js` so there is no need to pass it via initialization
method.
2023-07-24 12:49:53 -07:00
Lalit 8c12494c16 realm_playground: Cut dependency on `typeahead_helper.js`. 2023-07-24 12:49:53 -07:00
Sahil Batra 6cb080c447 bootstrap: Remove bootstrap CSS for blockquote elements.
We have added the bootstrap CSS rules for blockquote elements
to the specific elements in previous commits and thus we can
safely remove these from bootstrap.css.
2023-07-23 15:44:58 -07:00
Sahil Batra 2926337404 templates: Re-add bootstrap CSS for tweet blockquote elements.
This CSS will only be used if somehow the tweet is renderd as
a simple quote without iframe either due to network problem
or if the actual tweet is deleted.
2023-07-23 15:44:58 -07:00
Sahil Batra fdc0fc9d97 markdown: Re-add bootstrap CSS for blockquote used in markdown.
This commit re-adds bootstrap CSS rules for blockquote elements
used in various markdown pages including the ones which are
rendered during message formatting like when quoting a message.

This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
2023-07-23 15:44:58 -07:00
Sahil Batra 30dec9822b landing_page: Re-add bootstrap CSS for blockquote in testimonials.
This commit re-adds bootstrap CSS rules for blockquote elements
used for testimonials in the landing page.

This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
2023-07-23 15:44:58 -07:00
Sahil Batra 1c98252a85 portico: Re-add bootstrap CSS for blockquote in markdown pages.
This commit re-adds bootstrap CSS rules for blockquote written
using ">" in case study pages and some other pages like
"/why-zulip", "/history", etc.

We also remove the unnecessary CSS for "blockquote::after"
selector in this commit.

This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
2023-07-23 15:44:58 -07:00
Sahil Batra d15222db22 corporate: Re-add bootstrap CSS for blockquotes in "for/" pages.
This commit re-adds the required bootstrap CSS for blockquote
elements used in "for/businesd", "for/research", "for/events"
and "for/open-source" pages.

This commit only handles the blockquote elements inside ".quote"
and ".intro-quote" elements and not "blockquote.twitter-tweet"
elements which will be handled separately. The blockquote
elements rendered using markdown using ">" will also be handled
separately.

This commit also updates blockquotes in self-hosting page as
blockquote element on this page is also inside ".quote" element.

This is a prep commit to remove the blockquote CSS rules from
bootstrap.css.
2023-07-23 15:44:58 -07:00
Sahil Batra fab29eb779 landing_page: Remove unnecessary CSS.
We use "testimonials" class only to show the testimonials
in landing page, i.e. hello.html and that page does not
use "why-page" class. So, the CSS with selectors including
".portico-landing.why-page .testimonials" is not required
and this commit removes it.

The removed CSS was added in fc6833e46a when we used
"testimonials" class for quotes in why-zulip.html page
but this changed since we moved the quotes to markdown file.
2023-07-23 15:44:58 -07:00
Sahil Batra ae7db86b79 bootstrap: Remove CSS for ".label" elements.
The "label" class was only used for the labels shown in
activity support page. This commit adds the required CSS
rules to activity.css and removes them from bootstrap.css.
2023-07-23 15:44:58 -07:00
Sahil Batra 861312e120 bootstrap: Remove bootstrap CSS for "small" element.
We use "small" element only to show secondary details in
a typeahead option. This commit re-adds bootstrap CSS
rule to the specific element in compose.css and removes
the CSS from bootstrap.css.

Also, we do not use small elements inside any of h1, h2,
h3, h4 and blockquote elements, so the CSS for those can
be safely removed.
2023-07-23 15:44:58 -07:00
Sahil Batra b95d23bb07 bootstrap: Remove bootstrap CSS for input-append class.
We use input-append class only for some search elements
in the app and the CSS rules applied by bootstrap which
are really used are "white-space" and "margin-bottom"
for a couple of ".input-append" elements and "margin-left"
property on clear button which is re-added to the CSS for
specific elements in this commit.

Others are either redundant or overridden by the other CSS
for the specific elements.

The border-radius property for the clear button was applied
but since we use "x" for it, there is no border for that
button and hence it is redundant.
2023-07-23 15:44:58 -07:00
Sahil Batra 08dfebafcf bootstrap: Removed unused CSS from bootstrap-btn.css.
We can remove CSS for btn-large, btn-group-large, btn-small,
btn-group-small, btn-mini and btn-group-mini classes since
we do not use them anywhere.
2023-07-23 15:44:58 -07:00
evykassirer aa9d5935ae search: Rename search_arrows to searchbox_container.
The terminology "arrows" comes from historical functionality
that is no longer relevant, so searchbox_container is a more
clear and accurate name.

It would be nice in the future to see if we can remove
some of the nesting of HTML (#searchbox, #searchbox_form,
and #searchbox_container).
2023-07-23 15:27:53 -07:00
Anders Kaseorg 7746e11486 dependencies: Upgrade JavaScript dependencies.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-21 15:58:42 -07:00
Anders Kaseorg 1a13ede0d7 eslint: Fix @typescript-eslint/no-redundant-type-constituents.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
2023-07-21 15:58:42 -07:00
Lauryn Menard 02c279c6b6 narrow: Add hotkey trigger for navigation to new topic/direct message.
Adds including a trigger to the opts for narrow_to_next_topic and
narrow_to_next_pm_string when called from `web/src/hotkey.js`.
2023-07-21 14:21:29 -07:00
evykassirer 0652efc473 topic generator test: Use strings for stream name instead of numbers.
This function takes the stream name (a string) and using numbers
makes it seem like it's actually using a stream id, which is
confusing. This change adjusts `stream` to always be a string.
2023-07-21 14:19:55 -07:00
evykassirer 834f759e8b message view: Don't mark message as read in mentions view. 2023-07-21 13:10:07 -07:00
Lauryn Menard 1cccdd8103 realm-settings: Make default_code_block_language empty string as default.
Updates the realm field `default_code_block_language` to have a default
value of an empty string instead of None. Also updates the web-app to
check for the empty string and not `null` to indicate no default is set.

This means that both new realms and existing realms that have no default
set will have the same value for this setting: an empty string.

Previously, new realms would have None if no default was set, while realms
that had set and then unset a value for this field would have an empty
string when no default was set.
2023-07-21 18:54:02 +02:00
Lauryn Menard 3255281a83 narrow: Support string and integer encoding of "id" operator.
Expands support for the message ID operand for id" operator to be either
a string or an integer. Previously, this operand was always validated as
a string.
2023-07-20 13:14:20 -07:00
Lalit a871d7d90e poll_data: Revert to using "canned" instead of -1.
We revert to using "canned" instead of -1 when populating
`key_to_option` map so that it does not break for the old polls.
2023-07-20 09:55:09 -07:00
Alex Vandiver ba7492a314 web: Do not assume error responses are valid, or our, JSON.
Partially fixes #24815.
2023-07-19 16:18:31 -07:00
Alex Vandiver 7efe989a72 web: Switch from JSON.parse(xhr.responseText) to xhr.responseJSON. 2023-07-19 16:18:31 -07:00
Alex Vandiver d05a1e9efa web: Remove nonsense round-trip through JSON.parse() + JSON.stringify(). 2023-07-19 16:18:31 -07:00
Alex Vandiver d05a9d4000 reactions: Do not send server error reports for duplicate requests. 2023-07-19 16:18:31 -07:00
Aman Agrawal b7fcce305e recent_topics: Fix clear search button misaligned.
Looks like some changes actually improved aligned of this icon so
that we don't need this hacky margin.
2023-07-19 11:09:24 -07:00
Prakhar Pratyush 1a2831059d notifications: Enable audible notifications for the FOLLOWED topic.
This commit adds support for triggering audible desktop
notifications when:

* A message is sent to a followed topic with the global user setting
'enable_followed_topic_audible_notifications' enabled.

* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 67d4334bf1 notifications: Enable desktop notifications for the FOLLOWED topic.
This commit adds support for triggering visual desktop
notifications when:

* A message is sent to a followed topic with the global user setting
'enable_followed_topic_desktop_notifications' enabled.

* A message with wildcard mentions is sent to a followed topic with
the global user setting
'enable_followed_topic_wildcard_mentions_notify' enabled.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 237f9f4799 topic_popover: Add support to follow a topic from the topic_popover.
This commit adds support for following a topic from the topic
three-dot menu in the left sidebar.

Three options, i.e., 'Mute topic', 'Unmute topic', and 'Follow topic',
are shown at the top of the menu (in the mentioned order), regardless
of whether the stream is muted or unmuted.

We can no longer set the topic's visibility_policy to INHERIT
(the default value) from this menu.

The changes are visible in the development environment only.

Fixes #25917.

Co-authored-by: Prakhar Pratyush <prakhar841301@gmail.com>
Co-authored-by: Hardik Dharmani <Ddharmani99@gmail.com>
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 93a18b999a settings: Update SETTINGS/TOPICS panel to include followed topics.
This commit updates the existing 'Topics' settings UI
to add support for followed topics.

Changes:
- Add "Followed" as the first option in the topic status dropdowns.
- Modify the intro text.
- Replace the "Learn more." link with a question mark linking to
'/help/mute-a-topic' on the "Topic settings" heading.

The changes are visible in the development environment only.

Fixes #25918.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 352c48f7c6 user_topics: Fix live-update bug in the 'SETTINGS / TOPICS' panel.
The change in the visibility_policy or status of a topic from
the topic popover, message header bar, or recent conversations
is not live-reflected in the 'SETTINGS / TOPICS' panel.

This commit fixes the above-mentioned bug by updating
the 'handle_topic_updates' function to update the settings panel.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 08c952a2a3 user_topics: Add the missing node tests.
This commit adds the missing node tests for the case
when the visibility policy is UNMUTED.

This should have been included in c526543.
2023-07-17 17:39:17 -07:00
Prakhar Pratyush 32b201d5e0 user_topics: Rename 'muted_topics_ui' to 'user_topics_ui'.
This commit renames the file 'muted_topics_ui.js' to
'user_topics_ui.js', as we also support visibility policies
other than MUTED.
2023-07-17 17:39:17 -07:00
AcKindle3 1aeab40779 ts: Convert `stream_settings_containers.js` to TypeScript.
Added assertion to enforce `sub` is not `undefined` and thus type
safe for the rest.
Added type annotation to function parameter and return value.
2023-07-17 17:24:15 -07:00
evykassirer d293e869bd search: Bold search operands in the first search result.
Specifically when it's the last operand of the search
filter. This makes the first line of search results
more consistent with the lines that come after.
2023-07-17 17:19:08 -07:00
evykassirer 8f5305a4ce search: Create a template for search descriptions. 2023-07-17 17:19:08 -07:00
evykassirer 6346110b56 search: Remove unused base_query variable. 2023-07-17 17:19:08 -07:00
evykassirer 7116526492 compose: Use compose_state.stream_id when name isn't needed.
This partially fixes #25742.
2023-07-17 16:30:39 -07:00
evykassirer afd703fe77 compose: Fix buggy recipient id code.
`selected_recipient_id` is supposed to be an id,
not a stream name. This function is currently
only ever called for direct messages, so there's
no present user-facing bug.
2023-07-17 16:30:39 -07:00
evykassirer 91d32d9f16 stream data: Store stream subscriptions by id instead of name.
This commit has no functional changes. An extra dict has been
added to preserve previous lookup times.
2023-07-17 16:30:39 -07:00
Lalit a240280c12 message_overlay_ui: Fix eslint errors for rule no-unnecessary-condition
This mainly fixes error related to if checks like - `if ($jquery[0] !==
undefined)` which is not a good way to check for existence of jquery
objects instead we should check the length of jquery collections for
these if checks.
2023-07-17 16:24:16 -07:00
Lalit c0c4c2e1e7 ts: Migrate `message_overlay_ui` to TypeScript. 2023-07-17 16:24:16 -07:00
Lalit b97926ba0c messages_overlay_ui: Remove support for `_e` parameter for
`modals_handle_events`.

We are not using the `_e` parameter here since this commit `4a3211d`, so
I removed this parameter from the `modals_handle_events` function.
2023-07-17 16:24:16 -07:00
Lalit ad10c77919 settings_user: Pass data of correct type to `list_widget.render_item`.
Since `list_widget.render_item` accepts the parameter of type `Item` and
not `Key`, therefore we should pass the actual item instead of just
plain id to the `render_item` function here.
2023-07-17 11:31:51 -07:00
Lalit d58085dde2 list_widget: Check length of JQuery collection instead of collection
itself.

We were checking for the undefined value of `$html_item` but this
variable is always true since `$.find` never returns an undefined value
and it returns a JQuery collection instead.

So we need to check the length of that JQuery collection here to make
sure that the condition works as expected.
2023-07-17 11:31:51 -07:00
Lalit ed7588152e list_widget: Remove over defensive validation code.
After migrating to TypeScript, we don't need to manually validate the
configuration passed to the `ListWidget`, that's what typescript complier
will do for us, hence I removed `validate_opts` and `valid_filter_opts`
functions.
2023-07-17 11:31:51 -07:00
Lalit b51bdd33bb ts: Migrate `list_widget` to TypeScript. 2023-07-17 11:31:51 -07:00
Lalit 08f84f0a45 list_widget: Set $scroll_container directly in `meta` object.
We should directly set the value of `$scroll_container` when making the
`meta` object in `list_widget` instead of setting it up later in
`set_up_event_handlers` function which gets called anyways on
widget initialization. This allows us to not make an incomplete type
object which typescript will complain about when we migrates this module to
TypeScript.
2023-07-17 11:31:51 -07:00
Lalit b04dfd8c29 list_widget: Explicitly pass generic sort functions to the list widget.
This is a prep commit for typescript migration of this module. In this commit
I made all the users of ListWidget pass generic sort functions like 'alphabetic'
and 'numeric' explicitly to avoid type conversions which we may need when moving
to typescript, also it simplifies our `set_sorting_function` a bit more.
2023-07-17 11:31:51 -07:00
Lalit 3720fd5c76 list_widget: Make `get_item` option required and pass a default where needed.
This is a prep commit for moving towards typescript migration of this module.
We should make `get_item` required on `list_widget` because its intended to be
used with a set of keys and then hydrate the keys lazily. Also this will help
us to avoid writing messy if-conditions while filtering and sorting and make
our life much easier when we migrate to TypeScript.

I added a `default_get_item` function which is just n identity function and
also refactored some code to make use of default get item.
2023-07-17 11:31:51 -07:00
Lalit 7176590eea list_widget: Add new parameter for getting insert index in `insert_rendered_row`.
We should keep methods of `list_widget` generic and independent of outer modules
data types and hence I added this parameter to get insert index to make
`insert_rendered_row` work with any list we create and not only `topic_list`.
2023-07-17 11:31:51 -07:00
Lalit e8390a529a list_widget: Refactor `widget` object.
This is a prep commit for migrating `list_widget` to TypeScript, In this
commit we declare all our methods for the widget directly inside `widget`
object to avoid making an incomplete object when we add a type for our widget.
2023-07-17 11:31:51 -07:00
Karl Stolley de23949a36 message_edit: Use CSS to manage preview scroll.
Fixes #26135.
2023-07-17 11:28:55 -07:00
evykassirer 24a2ff5016 loading: Show error when spectator fails to register.
Fixes #25683.
2023-07-17 10:49:45 -07:00
evykassirer cb5441a6b0 search: Link messages in search results to near view.
Previously clicking on a message in search results opened
the compose box. This was not great, because search views
show messages outside of their context, and replying to a
message without the context of possible more recent
messages sent to that narrow can result in a bad experience.

This commit prevents the composebox from opening on click and instead
moves the user to a near view for the message, and similarly with the
enter keyboard shortcut.

Fixes #21217.
2023-07-17 10:39:43 -07:00
Lalit 61d4670f9a user_group_pill: Add test coverage for `append_user_group`. 2023-07-17 10:38:24 -07:00
Lalit 8aa6ddfe68 ts: Migrate `user_group_pill` module to TypeScript. 2023-07-17 10:38:24 -07:00
Lalit e06726a5cf peer_data: Remove over defensive `assert_number` function.
Removes the `assert_number` over defensive function which was being used
for validating the type of `stream_id` but now that this module is
converted to TypeScript we do not need this function anymore since
typescript compiler will do the type checking for us.
2023-07-17 10:37:29 -07:00
Lalit de6f21545b ts: Migrate `peer_data.js` to TypeScript. 2023-07-17 10:37:29 -07:00
Hemant Umre 7036b0d466 left_sidebar: Avoid zooming out when toggling stream subscription.
In this commit, we have replaced `build_stream_list()` with
`update_streams_sidebar()`. This change avoids zooming out from the
"more topics" view when toggling your subscription to a different stream.
It also triggers a forced rerender of the left sidebar only when
unsubscribing from the currently active stream. The stream list will be
updated once the user zooms out.
2023-07-17 10:13:53 -07:00
Hemant Umre 30ab2781b1 left_sidebar: Fix exception exiting "more topics".
The `stream_list.build_stream_list()` function is responsible for
rendering the stream list in the left sidebar. Previously, it uses
`topic_list.clear()` to clear the `active_widgets` that tracks active
stream(s) in the left sidebar. This led to a bug where rendering stream
list after adding or removing a stream through `build_stream_list()`
while a stream was zoomed in ("more topics" clicked) didn't fully exit
the "more topics" view. So clicking "BACK TO STREAMS" throws an exception
with the message "Error: Unexpected number of topic lists to zoom out"
because `active_widgets`, cleared by `topic_list.clear()`, became
inaccessible.

To address this issue, instead of clearing the topics list with
`topic_list.clear()`, the code now ensures the closure of the zoomed
stream by using `topic_zoom.clear_topics()`. This change ensures a
proper exit from the "more topics" view and avoids the exception.

Fixes #25670.
2023-07-17 10:13:53 -07:00
Prakhar Pratyush 4c9d26ce17 mention: Send notifications for @topic wildcard mentions.
This commit completes the notifications part of the @topic
wildcard mention feature.

Notifications are sent to the topic participants for the
@topic wildcard mention.
2023-07-17 09:39:24 -07:00
Karl Stolley 1cd587d24b me_message: Center first line with center of avatar.
This commit also demonstrates how precise line-heights contribute
to a design: by matching the line-height on the avatar's grid area
to the dimensions of the square avatar image, it's possible to
center the first line of text (me-messages, in this case) with a
non-text element.
2023-07-15 09:55:42 -07:00
Karl Stolley b13f6a6127 message_grid: Refactor row grid for readability.
This satisfies the linter's desire for the `grid-template`
shorthand while keeping the illustrative template areas in
their own little diagram-like property.
2023-07-13 14:02:21 -07:00
Karl Stolley 8b528de452 info_overlay: Align me-message example with rendered classes. 2023-07-13 14:01:32 -07:00
Karl Stolley ce04c98b47 me_messages: Clean up unused .sender_name-in-status class. 2023-07-13 14:01:32 -07:00
Prakhar Pratyush 0891f9f65a mention: Determine @topic mention during message rendering.
This commit adds a boolean field `mentions_topic_wildcard`
to the `MessageRenderingResult` dataclass.

The field is set to true only if message rendering determines
the message has an actual topic wildcard mention in it (and not,
e.g., topic wildcard mention syntax inside a code block).

The rendered content for topic wildcard mention is
'<span class="topic-mention">{wildcard}</span>'.

The 'topic-mention' class is the identifier for the wildcard
mention being a topic wildcard mention.

We don't use 'data-user-id="*"' and "user-mention" class for
topic wildcard mentions and eventually plan to remove them for
stream wildcard mentions too in a separate mini-project.
2023-07-13 11:34:48 -07:00
Prakhar Pratyush 2b42df4ef1 mention: Replace 'wildcard' with 'stream_wildcard'.
This is a prep commit to replace 'wildcard' with 'stream_wildcard'.

This wasn't included in 179d5cb because we didn't decide to
use a different rendered_content for topic wildcard mention,
i.e., ''<span class="user-mention topic-mention">{wildcard}</span>'.

Our intention was not to create separate tests for both stream
and topic wildcard mentions, as they were expected to have the
same rendered content format.
2023-07-13 11:34:48 -07:00
Karl Stolley ddaebb3255 message_grid: Use a 'dead' column to space controls and time.
This commit adds a 3px column between the `controls` and `time`
areas, which keeps the controls from crowding the time for
languages with longer time markers.

To make the layout easier to reason about, this includes the
minimum width for the time column as part of the message-box
grid definition.
2023-07-13 09:02:00 -07:00