To better make use of server load when fetching message history for
users, we limit how much history we fetch in the initial loading
experience based on how much time in the organization's message
history it corresponds to.
Co-authored-by: Tim Abbott <tabbott@zulip.com>
For more discoverability, the keyboard shortcuts for preview, and bold,
italic and link formatting are now displayed in the tooltips of those
compose buttons.
Earlier we did not activate widgets if their rendered HTML was cached,
and also when narrowing to the combined feed view. This caused bugs with
widgets not being activated, and so not responding to any interactions.
Now we unconditionally render and activate widgets in the current view,
irrespective of the cached HTML or the view being narrowed to.
`source` is expecting a list so `false` doesn't make sense here.
It was working before because the code that calls `source` in
`bootstrap_typeahead` just does falsey checks.
This commit replaces the fontawesome "edit" and "copy-link" icon found
in the user profile modal with the corresponding zulip icons.
It also moves the functional classes like
user-profile-manage-own-copy-link-button from the icon element to its
container, including adding a new div wrapping the icon in
user-profile-manage-others-edit-button.
Attempting to convert .data("draft-id") to .attr mysteriously breaks
draft saving, so I’ll leave that for future work.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
e.target is the wrong element, and even if this were to successfully
add the _full-height-no-scroll class to <body>, that’s not a child of
.portico-hello-page.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Its selector looks like it’s missing a ‘.’, but “fixing” it breaks the
page even more, and trying to decipher this mess of event handlers
that poorly replicate what should be native behavior is making my
brain hurt.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
Combined feed always narrowed to the first unread id regardless
of if it was muted or not since we were not actually using the msg_id
that we found after all the hard work of doing all the checks for it.
Originally, we only wanted to do local echo in the current
view. However, now that we're looking at navigating the user to the
conversation that they send a new message to, it's going to be quite
common that we immediately visit a destination different from the
current view, where local echo in that different view would be
valuable.
The most interesting block was added in
af188205cb / #8989. But in
6637f2dbb7, the key logic for checking
`msg_list.data.fetch_status.has_found_newest` was duplicated in the
`add_new_messages` code path, which critically also updates
`update_expected_max_message_id` and thus may close a race with
fetching message history for a view we're being navigated to, where
the locally echoed message might fail to appear at all.
This change does come with a slight regression: If we are looking at a
search view where the filter is one that we cannot apply locally, a
newly sent message will now be locally echoed (returning the compose
box for drafting another) even though it cannot be displayed in the
current view, which means that the message will not appear in either
the compose box or the current view for the brief period before we get
a reply from the server in this scenario. This is a minor detail,
likely not worth troubling ourselves over.
Given our intent to experiment with navigating the user out of the
search view in this scenario, this is likely not important.
Co-authored-by: Tim Abbott <tabbott@zulip.com>
The `at_rendered_bottom` check was incorrect since it includes
bottom whitespace in the calculation to check if we are at the rendered
bottom. This is can cause us to not fetch new messages if user stops
scrolling when bottom whitespace is partially visible leading to
a bad UX.
If user goes to combined feed view on escape keypress, then
we restore their narrow pointer and offset by restoring it from
browser history if the their last narrow was the combined feed view.
This is no longer required since narrow state is restored by
`reload` library and narrow history restores the narrow pointer
and offset when going back to a view.
Only regression here is we will no longer restore the pointer when
user navigates to the combined feed view without using browser back
button and combined feed view is the default view. This is fixed
in the next commit.
We now use "settings-field-label" and "modal-field-label"
class on label elements in settings and modals respectively
to add the bottom margin which was previously done by
"dropdown-title" class as it is better to have more
generic names to use on label for all type of inputs.
This commit adds bottom margin to label elements of
different inputs by adding "modal-field-label" class
to the label elements. Some of them already have the
margin due to having dropdown-title class.
This commit adds bottom margin to label elements of
settings inputs in personal, organization, stream
and group settings using the recently added
"settings-field-label" class.
Most of the settings are dropdown settings, so the
label for them already had a margin as they use
"dropdown-title" class.
There is no need to have hr element below the "Field choices"
heading in custom profile edit form and this also makes it
consistent with the new custom profile field form.
This commit removes classes like "title", "input-label"
and "emoji-theme" from label elements in settings and
modals as these are classes are neither used in JS
nor to apply any CSS.
This only every did a single extra fetch, and now that this fetch is
in the same direction as our main fetching sequence, no longer is
meaningfully different from just specifying a different value of
consts.maximum_initial_backfill_size.
Previously, when a message is edited, it is locally echoed with its
pre-edit content.
This is because previously, when we tried to render the edited
message of the edit box during local echo, in order to update
the content, flags, and is_me_message properties of the message
object with that of those returned is markdown.render(), we used
the spread operator and created a new message object, and updated
the existing message object with this new one.
This was misconverted, since edit_locally() method already has a
fully-rendered message object to start with, and is just doing a
rerendering, it should be mutating what message it received, rather
than constructing a new local variable.
This removes the common min-width being used across all popovers and
instead sets the min-width according to a popover's requirements.
This allows for greater control over the popovers since we have a
variety of use cases for them — which a single common min-width cannot
accommodate.
For onboarding banners, we replace the close button with
"Got it" button.
Also, the banner is marked as read for the user only after
the "Got it" button is clicked. Earlier it was marked as read
as soon as it was displayed.
Register our `onTextInputHook` to be called on "input" events so that
the hook receives the updated text content of the input unlike the "keydown"
event which does not update the text content before running the hook.
Updates the base hash for the streams setting overlay to be
"channels" instead of "streams".
Because there are Welcome Bot and Notification Bot messages that
would have been sent with the "/#streams" hash, we will need to
support parsing those overlay hashes as an alias for "/#channels"
permanently.
Part of the stream to channels rename project.
Updates the streams settings URL in the message view header to be
generated with hash_util.stream_edit_url, which correctly encodes
the stream name in the URL.
Additionally, the text colors have been updated for both light and dark
themes, it starts showing when 900 or less characters are left, as 999
was too soon, and has a tooltip to show the maximum characters limit.
Fixes: #28706.
Add a rule to the switch_rows(event) function to avoid
switching stream row when pressing up/down key by checking
the current URL hash and the add_subscribers_pill focus state.
Add a utility function to hash_parser to help implement new
switch_rows behavior mentioned above.
Fixes#29690.
Adds a new trigger string to use for narrow.activate opts when
it is called due detecting a message move for the targeted message
ID: "retarget message location".
Updates narrow.save_narrow and narrow.hashchange to accept the
trigger as a parameter so that, even if the narrow was started via
a hash change in the web app, the URL and browser history is
updated for the current location of the targeted message.
Earlier, the primary modal button always turned grey on being disabled,
while other modal buttons remained as is in light mode, and grey in dark
mode. Now the styling is made consistent across all modal buttons, by
giving them all 50% opacity when disabled.
So far, the Send buttons area would turn grey when the message could not
be sent. The Save button when editing a message would also turn grey
when the message could not be edited anymore. Now we simply make the
buttons half opaque instead of turning them grey in a disabled state.
We change the background colors for the close / cancel / exit buttons
in modals and messages (when editing them or viewing their source). The
border is also removed for those buttons in messages.
When viewing the source of a message when not editable, the opacity of
the read-only textarea would be reduced to 0.5, like for any other read-
only textarea in dark mode. This was unnecessary for viewing message
source, so the opacity for this case is now set to 1.
Fixes: #28701.
In spectator mode, the separators encapsulating the topic visibility
switcher wasn't being hidden since the `hidden-for-spectators` class
was being applied only to the `popover-menu-inner-list-item` element.
As a follow-up commit to c3e4358, this removes the additional
separator by shifting the `hidden-for-spectators` class to the
`popover-menu-outer-list-item` element instead, which is responsible
for showing the separators.
We could have added a new function that would return early on the
first property that changed instead of using
`populate_data_for_request`. But we would still need to fetch
`field_data` in most cases. Using `populate_data_for_request` will
keep things simple and readable while the performance difference
should be negligible.
Fixes#29750.
- We introduced an argument called `custom_profile_field` similar to
`sub` and `group` in `check_property_changed` and
`populate_data_for_request`.
- We could've introduced `field` param in `get_input_element_value`,
but I've kept it clean since it didn't have any similar kind of data input.
The performance difference due to this should be negligible.
- Introduced a span that would be parent to all `field_data` params
since it is needed by the diff infrastructure.
- If there is no data to be changed, we display our success status
without sending the PATCH request since save changed button is
always enabled.
This is a preparatory refactor since we need to use this function in
settings_components.ts which is a typescript file. Although the
original file seemed like the best destination for this function,
settings_components.ts seems like the second best destination.
Do not send unnecessary extra params when changing the value of
`required` field. Instead of searching realm.custom_profile_fields
for the field we are editing, we will just use the checkbox value to update
the field value, since we don't need to send other params like `name`,
`hint`, etc. to the API after API feature level 252 update.
Do not send unnecessary extra params when changing the value of
display_in_profile_summary. Instead of searching realm.custom_profile_fields
for the field we are editing, we will just use the checkbox value to update
the field value, since we don't need to send other params like `name`,
`hint`, etc. to the API after API feature level 252 update.
Following the topic sidebar action popover menu redesign using the new
"popover-menu" tippy theme, we update the icons of the menu options to
match the new UI.
Fixes part of #28699.
Following the stream sidebar action popover menu redesign using the new
"popover-menu" tippy theme, we update the icons of the menu options to
match the new UI.
`callback_after_render` was not being called when `render` did
an early return which caused "load more" to not be updated.
This is noticeable now since we are doing fewer calls to
`process_messages` which also updates the `load more` banner.
In narrow.activate, the adjusted_terms_if_moved helper uses the
raw terms from the URL for checking if a message was moved. If a
non-canoncial operator was in the URL for a narrow (e.g. "subject"
instead of "topic" and now "stream" instead of "channel"), then
the view wasn't updated correctly.
Update adjusted_terms_if_moved to use the canonical version of the
operator in the URL when adjusting the message history.
On creating a stream, instead of being redirected to the topic
`stream events` of the newly created stream, the user is only
redirected to the newly created stream, to avoid translation
issues with this topic name. The topic `stream events`
will not be present if the realm language is not English.
Important changes in this commit:
* We only cache message list for "Combined feed" if it is the
default view.
* We modify existing handling of home message list code so that
it can be used to for any message list that we want to cache
using a new `preserve_rendered_state` variable.
* narrow_state.filter() returns the filter of combined feed view list
instead of `undefined`.
* We start fetching messages from the latest message on app load.
* Messages in all messages data and Recent view are always synced.
* If combined feed view list is not cached, we don't track it's
last pointer, effectively sending user to the latest unread
message always .
Now we retry 3 times with 10s delays before giving up if on loading
the emoji. Hopefully user will just refresh the page by that time
if the emojis still can't be displayed.
Previously, the stream permissions warning banner failed to hide
after changes to the stream's privacy settings were saved or discarded.
This fix addresses the issue, ensuring the banner behaves as expected
by disappearing when changes to make the stream private are either
saved or discarded.
Fixes: #29625.
Change compose_reply_button tooltip logic to show the correct tooltip.
Earlier in organizations where DMs were disabled, a stale tooltip was
being displayed.
Earlier if the user hovered over the compose_reply_button when it was
disabled and switched to a stream in which it was enabled before waiting
for the tooltip delay, the next time the user hovers over the
compose_reply_button the stale disabled tooltip is displayed instead of
the enabled one.
This is fixed by checking if the compose_reply_button is enabled on the
fly while rendering the tooltip via instance.setContent().
Fixes#29238.
Updates the logic for adding a wildcard mention syntax in a message
to use the "channel" wildcard instead of the "stream" wildcard.
Adds some TODO notes for eventually removing the "stream" wildcard
from the typeahead suggestions in the web app.
Part of stream to channel rename project.
Updates operators used for narrow.activate and sent as narrow
parameters to the server to use channel and channels.
Part of stream to channel rename project.
Updates the search suggestions in the web app to use the modern
convention of "channel" and "channels".
Also, updates the "from" search suggestions to use the modern
canonical convention of "sender".
Part of stream to channel rename project.
Updates translated strings in web/ that do not need updates to any
tests. The majority of these strings are also unique to the file/
template that they are in. A few have overlap with one other file.
Some changes here update placeholders/variables in these strings to
no longer use stream so that all the translation updates for this
rename happen at the same time.
The exception to this are cases of "<z-stream>" placeholders in
these translated strings.
Part of the stream to channel rename project.
Updates warning string when linking to a private stream/channel when
composing a message in the web app to use channel instead of stream.
Updates error banner when using a stream/channel wildcard mention
when composing a message in the web app to use channel instead of
stream.
Part of stream to channel rename project.
Updates the translated strings in filter.ts to use channel instead
of stream.
The updates to the untranslated search streams will be done in a
separate commit.
Part of the stream to channel rename project.
Updates a chunk of translated strings that overlap between files,
with the streams settings overlay being the starting point for
finding these strings, to use channel instead of stream.
Part of stream to channel rename project.
Updates translated error and warning strings when creating a new
stream in the web app to use channel instead of stream.
Part of stream to channel rename project.
Updates the translated empty narrow messages in the web app to use
channel instead of stream.
Updates the message view header that has the same text as the empty
narrow when a stream/channel does not exist or the user does not
have access to the stream/channel because it is private.
Part of stream to channel rename project.
Updates hash_util.decode_operand to handle a URL with channel and
the stream name and ID encoded in the URL.
For example "/#narrow/channel/12-test" where 12 is the ID of the
stream named "test".
Part of stream to channel rename project.
"Stream events" field in "Stream details" section uses hardcoded
link for "stream events" topic. This link breaks if the organization
language is set to something other than English and the "stream events"
topic has a translated name. The field also does not handle scenarios
where the organization switched languages and thus "stream events"
topic is in different languages depending on when the stream was created.
Additionaly, we are currently undergoing a major change to rename
"Streams" to "Channels" and as part of this change "stream events" will
be renamed to "channel events". We currently don't have a plan for
linking these together or moving messages to the new topic.
Keeping these points in mind, it is best to remove this field for now.
This expresses the height of the message row without need of
margical margins.
Extending the correct line-height to timestamps also means that
single-line messages will be the height of their combined content
and padding, and not erroneously held open by an oversize 28px
timestamp line-height.
Those corrections mean, too, that .message-time only needs to have
its line-height declared a single place, regardless of context.
A confirmation toast is shown when a message is moved
using the "Move only this message" option. The toast
contains the link to the new location of the message.
Fixes#29702
The variable `select_stream_id` was assumed to be of type number when
it actually was of type string. A strict equality check was performed later
down in the code between `select_stream_id` and `current_stream_id`
(which is of type number).
This commit converts the variable `select_stream_id` to type number.
This establishes the same 5px bottom margin on all Markdown
elements, which will aid in converting such values to variables
as part of the information-density project.
Because paragraphs have a 3px bottom margin, the 2px top margin
on ordered and unordered lists would collapse into it, for 3px
of space total. So setting 0 on these special selectors has no
effect.
A single call to this function doesn't have a material performance
impact when tested with 20k messages while scrolling in combined feed
view; likely because only 400 messages can be in the structure at any
give time given render windows.
But calling this in a loop somewhere would be a bad idea.
We want to make it easier to find stream details such as creator,
creation date and stream id. The commit replaces the "Email address"
section in General tab of stream overlay with a new section called
"Stream details", "Email address" is now a field in this section.
If the stream does not have a creator, we only show the stream creation
date in creation details.
Fixes: #25648.
This is a prep commit to add a .pill-label wrapper around .pill-value
and other flair text. This extra flexbox structure will help us
vertically align this pill with surrounding text when adopting it to be
used inline.
We also introduce a new class to target this pill. The intention is that
this will more descriptive than contextually styling .pill-container.
This is so that it better matches existing buttons in this overlay. For
example the "Reset to default notifications" button in Personal tab.
This is a prep commit.
Update the tooltips for the "Cancel" and "Spinner". Provide clear
information about the draft saving behavior when a message fails to
send successfully.
Fixes part of #29100.
Previously, links were displayed for the user's name,
but now they are presented as pills. These pills are rendered
using the user_display_only_pill.hbs template.
To obtain the avatar of a user,
the small_avatar_url_for_person function is utilized.
The term 'subscriber' might be misleading as it doesn't accurately
reflect the purpose of the list, which simply contains all users
within the organization. To enhance clarity and maintain consistency,
I've replaced the classname 'panel_subscriber_member_list'
with 'panel_user_list'.
This function now accepts an argument for message content in the
message object returned and use compose_state.message_content()
to preserve the behavior for existing callers.
Preparation for #28626
Renamed the function to position_inside_code_block and changed the
parameters to accept a string and number (index), and check if the
position in the string is inside a code block (as per previous logic).
Preparation for #28626.
This could happen e.g. when quote-replying a message,
because we open the composebox before adding the quote
reply content. We need to make sure that we don't restore
a draft when opening the composebox, because otherwise
that draft will be replaced with the quote reply.
This will let us initialize the data before the UI is ready
to be initialized. We'll need to do this in an upcoming commit
where we clear a flag on page load before the reload code
initializes.
If a user starts typing before they see that a draft was restored,
this makes that experience a little smoother by adding some
separation between the old draft and the new text.
Now when the user opens a narrow that has a draft saved for
that particular conversation, the draft will automatically
be restored in the compose box. This will make it easy to
return to a draft after clicking away, and also will make
it less confusing when people close the compose box by
accident. Note that this only restores the draft when
there is a full recipient specified (stream and topic,
or at least one PM recipient).
Fixes part of #18555.
Fixes#11218 and #17396.
We used to keep the draft, assuming that clearing the composebox
was an accident. Now we want to delete the draft, in preparation
for auto-restoring drafts when opening the composebox for narrows
with drafts associated with them. If a user opens the composebox
and sees a draft they don't want anymore, clearing the box is a
way we expect them to try to delete it.
Previously, the sorting was broken due to
incorrect referencing of the property.
The code has been updated to use the "referrer_name"
property instead of "ref".
It's possible that for a given narrow event if we didn't fetch any
messages in the `num_after` or `num_before` space, we could have
arrived at `newest` or `oldest` messaged based on the `anchor` used.
This fixes the bug where `fetch_status` for `found_newest` didn't
update to be `true` when using `newest` anchor and `num_after = 0`.
We forgot to restore the date on sticky header if the header
is no longer sticky.
Reproducer:
* Have two messages with same sender on different dates next to
each other in a stream narrow.
* Scroll so that sticky header is on the 2nd message.
* Scroll down fast so that to avoid us capturing the sticky header
over the first message.
* Scroll up slowly so to see the group header of the messages have
the date of the second message.
In commit 449febf036, the tooltip that provided information about
the announcement stream was replace with inline text on the form.
Removes the now unused template and code in stream_create for this
tooltip.
Earlier when a user narrowed to a new topic, there was no highlighted
topic row entry in the left sidebar under the respective stream.
This commit introduces the feature to show highlighted topic in the
left sidebar for a new topic thread. It checks if narrowed topic is
present in the list of topic names to add to it.
It disappears from the left sidebar when unnarrowed and the topic
contains no messages.
Fixes: zulip#22769.
Earlier when a user narrowed to a new pm conversation, there was no
highlighted DM row entry in the left sidebar.
This commit introduces the feature to show highlighted pm thread in
the left sidebar for a new conversation. It adds narrowed dm to the
recent messages list if not already present.
It disappears from the sidebar if no message was sent and unnarrowed
from the DM.
Fixes: zulip#22769.
- On creating a stream, the user is redirected to the
"stream events" topic of the newly created stream.
- If this is the first time the user has created a stream,
an explanatory modal is shown.
test_hotspots.py is modified to account for the new addition
of the first_stream_created_banner.
stream_create.test.ts is also modified accordingly.
Fixes#29375.
This commit adds a tooltip in organization settings,
when the save button is disabled due to invalid
Jitsi URL.
Fixes#27511.
Co-authored-by: Angelica Ferlin <angelica.ferlin@gmail.com>
Co-authored-by: Peterson Linn <linn@pajp.net>
Co-authored-by: Kislay Verma <kislayuv27@gmail.com>
This commit moves the function
initialize_disable_btn_hint_popover from
stream_ui_updates.js to settings_components.js
due to circular dependencies.
Added opts parameter to append to the options for
the tippy instance.
Fixes#27511.
Co-authored-by: Angelica Ferlin <angelica.ferlin@gmail.com>
Co-authored-by: Peterson Linn <linn@pajp.net>
Co-authored-by: Kislay Verma <kislayuv27@gmail.com>