Since stream header is now sticky, we need to reduce it's height
when calculation position of the element we want to scroll into view
so that it doesn't hide under the sticky header.
This commit introduces the change of rendering private messages
section as collapsible, whose data-fetching logic came with zulip#21357.
We now have separated out `Private messages` from `top_left_corner`
section and shifted it below the `global_filters` in a different
separate section along with stream list with common scroll bar
in left-sidebar.
The new PM section will be opened by-default on loading the page
and will have a toggle-icon in its header, clicking on which makes the
section collapse/expand accordingly.
In default view, only recent 5 PM threads would be shown
and would append the active conversation as the 6th one at last
if not present in those 5, similar to how topics list work.
In PM section with unreads, a maximum of 8 conversations
would be shown and rest of them would be hidden behind
the 'more conversations' li-item, clicking on which takes
to the zoomedIn view of PM section where all the present
PM threads would be visible and rest of the sections of left-sidebar
will get collapsed.
Fixes#20870.
Co-authored-by: Aman Agrawal <amanagr@zulip.com>
Dropped text "(Message sent when you were not subscribed)" for
historical messages in the three-dot message menu.
This information was already available via the "You subscribed" type
divider lines, which were added about the same time back in 2013, and
this text feels somewhat ugly.
Also removed the historical field from the args object that is
passed to the template, as this is not used anymore.
Fixes#23198.
Updates the `filter.get_title` logic to return the stream name for
narrows that include the stream, topic and near operators. That
way the browser/tab title remains the same for these views, which
have a particular scroll offset.
Removes call to reset_compose_message_max_height when clicking on
the markdown preview button, which due to the `#compose` div element
momentarily shrinking to be empty, caused the calculation of the
max-height to grow larger on each click.
Also refactors reset_compose_message_max_height to use the height
from `getBoundingClientRect`, which defaults to zero when empty.
And fixes a small discrepancy in how max-height is applied to
a div element vs a textarea element, so that the visible height
doesn't change between the preview and write modes in the compose
box.
Fixes#23277.
This gives us some time to render and fetch data before allowing
user to start using hotkeys. It avoids error being thrown when
hotkeys are used when the app is still loading.
Updates the hash used for the recent conversations view to be
"#recent" instead of "#recent_topics".
We will need to keep the logic for handling "#recent_topics"
permanently because users potentially have messages from
Welcome Bot with links to that hash.
Including "recent_topics" as a web_public_allowed_hash in
hash_util.js can be changed once self-hosted servers cannot
upgrade directly to Zulip 5.x from the current version.
Fixes#23132.
The resize handler is a somewhat expensive operation, which we'd like
to avoid when processing the receipt of new messages. It's also
unclear why it would be necesssary; bottom_whitespace is fixed in
size, and the sidebars.
It should be very rare to discover new unread messages during a
message_fetch call. This can potentially happen due to races (fetching
just as a new message arrives), but it shouldn't be the common case.
Previously, we would trigger a full rerender of all UI displaying
unread messages every time a bulk message fetch operation returned
(including every time one narrowed), regardless of whether any actual
state had changed.
Fix this by actually checking if we discovered any new unread messages.
There's no reason that opening left sidebar popovers should require
the app to recalculate the size of any of its components; popovers are
drawn on top of the rest of the UI in any case.
This appears to have been added in
9ed05a1f85 as part of prototyping the
left side user list feature.
This was likely introduced in error in
fd66d9f70336b2bdbbffb1bf13402516b9920682; it is a duplicate of
show_userlist_sidebar, which, in contrast is actually called.
Because we can count on the unread.js data structures to be correct,
we no longer need this legacy code that tries to re-process all
messages the client has cached for whether any are present in the
target stream and marked as unread.
It's not clear we need this at all, since the current Zulip server
will mark all messages as read when unsubscribing from a stream, but
having this call protects us from future bugs should that behavior
change.
This cleanup also revealed a possible bug, where we would fail to
update global unread counts properly when unsubscribing from a stream
until the deferred_work queue processor sends us the
update_message_flags event associated with that change.
The previous invocation message_util.do_unread_count_updates dates
from a time when `unread.js` did have any data beyond what full
message objects were present in the client, and thus we needed to
recalculate everything from those message objects when muting state
was changed.
With the modern unread.js data structures, all that's required is a
full recalculation/rerender via this function.
We change the "pm-with" and "sender" narrow urls
to be of "{user-id}-{encoded_name}" form instead
of using email. This change improves performance
of changing between PM views since parseOneAddress
function was slow and we remove its usage now by
using name instead of email.
The name is encoded such that the characters that
would be encoded by the browsers are replaced by
"-".
Now that we show the \vdots icon while the actions popover is open,
there's a weird looking behavior where a focus outline appears around
the \vdots icon, only if you clicked on the icon itself, not its
square containing click arrow.
Disable this unintended behavior, which disrupts the otherwise
simulated state where focus is in the popover (but no row is focused).
The color for the message control buttons is set in the
`message_control_button` class. The `reaction_button_visible` class
also sets a color declaration with the same value.
This commit removes this declaration because it doesn't change the
color of the reaction icon(the class is currently only used in
conjunction with `message_control_button` to toggle the button
visibility) nor does it override any inherited style (hover color
remains the same regardless) as it lacks an `!important` rule.
This commit fixes the issue where the 3-dots menu icons on the left
sidebar disappear even though the associated popover is open by
toggling a special CSS class on the menu item. It follows the same
approach used by the emoji picker on the message feed UI.
Fixes #23157
This commit enables the 3-dot menu to be visible while the associated
actions popover is open using the fact that the 'has_actions_popover'
class is attached to the message with an open popover. This approach
solves the bug without any additional JavaScript code.
Fixes part of #23157
We should not show UI for moving locally echoed or failed messages.
For the edit/move icon in message controls -
- After 2451002, we showed "Move message" icon for locally echoed
messages when moving messages was allowed as per org permissions.
This was clearly a bug and this commit fixes it and we instead
show "View source" icon.
For "m" hotkey -
- After 2451002, pressing "m" opened "Move messages" modal for
locally echoed messages when moving messages was allowed as per
org permissions. This was clearly a bug and this commit fixes it
and pressing "m" does nothing.
For pencil icon in recipient header -
- Previously, the pencil icon was showed even if first message
below the recipient bar was locally echoed and the topic edit
failed silently with locally echoed or failed messages again
showing under old topic after reload. This commit fixes it
to hide the icon in such cases. The original behavior was
that server returned an error with not so appropriate
response.
- Note that we can only check the first message below the header
since it will be inefficient to check all the messages whether
each of them is successfully sent.
And in such cases when any of the later messages is locally
echoed, the topic edit succeeds but the locally echoed or failed
messages are shown under old topic after reload.
- The behavior is same for the "checkmark" icon for resolving
topics in the header.
For three-dot message menu -
- We don't need to do anything here since the three-dot icon
is not shown for locally echoed or failed messages.
For the "Move topic" option in topic popover in left sidebar -
- We cannot do anything here since it will be inefficient
to check all messages in the topic whether they are locally
echoed or not everytime we open the popover.
- If the first message in topic is locally echoed or a failed
message, then the id of first message of the topic returned
from server is undefined and we see an error in client while
trying to get message from that id. And if one or multiple of
the later messages is locally echoed, then only successful and
server-acked messages are moved.
Note that this cannot handle all cases like a user can use
a successfully sent message to access the topic edit UI
and then choose "change_all" and "change_later" propagate
modes. In such cases the locally echoed and failed messages
will remain in the old topic only.
The message_hover function in ui_init.js had an if condition
to return early when is_topic_editable was false. We instead
change it to return early when message.sent_by_me is false
since in that case the edit_content element is not present.
Note that we also show the "View source" icon when message
is locally echoed or not sent successfully.
Till now is_topic_editable is always true when message is sent
by the user itself, and when message is sent by someone else
the edit_content element does not exist in the DOM anyway. So,
basically, it just helps in returing early and not unnecessarily
move forward to set html for a non-existent div. So, we can
ideally replace it with just `sent_by_me` condition and otherwise
we already show the reaction icon.
The comment above that also mentioned that "locally echoed messages
have !is_topic_editable" which is not true since is_topic_editable
does not check whether the message is locally-echoed or not. This
comment was added in e1c4c7b80.
This also fixes the bug where "View source" icon is not shown when
"message.sent_by_me" is true and both editing and moving message
is not allowed which currently happens when allow_message_editing
setting is False.
Also, the "is_topic_editable" condition will be not valid in future
when "is_topic_editable" can be false when "sent_by_me" is true. In
such cases we would not show any icon then, so better to fix this
here.
Some history of this code-
- Intially we returned only when !sent_by_me was false, but added
a condition to return early when realm_allow_community_topic_editing
was false in 91197fa4f1. Though it was not needed since edit_content
element amyways did not existed when `sent_by_me` was false.
- Then the condition was then changed to return early if
is_topic_editable was false in 689c717284.
We do not allow sending messages where sending request had failed
or message is locally echoed. This commit extracts these checks
to a new function so that we can avoid duplicating code.
This fixes a couple significant issues with the drafts logic:
* Previously, we would move drafts even when !going_forward_change; this
is inconsistent with the compose box logic on the previous line.
* The drafts.rename_topic() function did not handle drafts with
incomplete stream/topic fields correctly, throwing an exception in
that case; this resulted in user-visible live update problems
because code after the drafts.rename_topic call would not be
executed.
Replaces instances of "recent topics" in the web-app and documentation
to be "recent conversations".
Renames both `recent-topics.md` files in the help center to be
`recent-conversations.md` and updates/redirects links to new URL.
Does not update instances of "recent topics" in frontend code comments
and does not update the main overview changelog, for now.
Does not change case study text where "recent topics" was referenced
in a quote, but does change generic text references to be "recent
conversations".
Previously, we had some special CSS for the user profile modals in the
case that there were no custom profile fields, to do things like hide
the <hr> divider between the normal profile fields and custom ones.
The design has for some time treated custom profile fields as just
additional profile fields; so there's no longer a need for custom CSS.
While going through the full profile of a user, we expect to find
that specific user's in-depth details. Thus, we should have a fixed
title displaying the name at the top of the modal to establish the
connection of the profile data with the user.
We also fix the tab switcher between "Profile/Streams/User groups" to
the top of the modal, for the added convinience of switching across
the three options at any point of time.
Fixes#22984
Add an `@` icon in unread topics where user is mentioned.
We track a new set of `stream_id:topic` pairs for the unread mentions
so that recent topics instantly knows if a topic is unread and mentioned
or not.
This change is to match the behaviour of page up/down on messages.
So, If you hit PageUp/Down while there's no additional pace to scroll,
we move the selected topic to the first/last topic as appropriate.
Previously, we allowed editing topic of "no topic" message, when other
conditions were not met, only from recipient bar but it is allowed
irrespective of other condtions. This commit fixes it to show the
"Move message" option and icon for "no topic" messages irrespective
of other conditions.
Previously, NO_LONGER type was just used to display
the text in the bottom-right of message edit form
which we have removed now, so we can remove `NO_LONGER`
type now.
We seem to override this setting for most of the dropdowns, so this
common CSS only applies to the smaller dropdown shown to logged-in
users, where it was weirdly wide.
Renames the help article on custom profile fields to reflect that
its content is not just about adding fields.
Adds a redirect from the old URL to the new URL and updates internal
links, linking to #add-a-custom-profile-field where appropriate.
Fixes#23170.
User's name with status emoji was overflowing its container,
resulting in overflown text to not be converted into ellipsis
and pushing status emoji out of visible area.
Fixes#23078.
Instead of relying on browser, we handle the page up/down keys
to ensure we take care of some rows being hidden due to compose
box and table header.
Previously, the on_topic_change handler for the compose system would
focus the compose box after a topic change, and also select all content in
the compose box. Selecting that content makes sense if we think the user's
intent is likely to be deleting that content; but there's no clear reason we
should expect that intent, and it's not particularly consistent with our drafts
model to risk accidentally losing partially composed message content this way.
After some discussion, we've concluded that in both cases reaching this code path
(either the previous topic being "" or the compose box content being entry), it'd
be better to skip the `.select()`.
Fixes#23146.
Sets a default value of "Search results" for complicated narrow search
views and updates logic to use `filter.get_title` as a helper to
generate better titles for some common search views.
Does not update the existing behavior for narrow searches that have
"pm-with" or "group-pm-with" operators.
Note as of this change, the default search title and titles generated
from `filter.get_title` will be translated into the user's preferred
language.
Fixes#22952.
Updates `filter.get_title` to return 'undefined' for any narrow
with a search operator. Previously it would return a title if
the search operator was paired with a common narrow, but those
results were not being used when building the message view
header and will not be used for setting the browser title.
Prep commit for rewriting `update_narrow_title` to use
`filter.get_title` as a helper for setting browser title text.
Fixes a subtle bug in the browswer title that occured if the user
input a keyword or another vaild search operator before `pm-with`
or `group-pm-with`.
Prep commit for rewriting `update_narrow_title` to use
`filter.get_title` as a helper for setting browser title text.
Translates browser titles for "All messages" and "Recent topics"
views.
Prep commit for rewriting `update_narrow_title` to use
`filter.get_title` as a helper for setting browser title text.
When the narrow/search for a stream is undefined because either the
stream does not exist or the user is not subscribed to the private
stream, format the title that's used in the message view header to
include the stream name that was searched for.
Prep commit for rewriting `update_narrow_title` to use
`filter.get_title` as a helper for setting browser title text.
Updates default title for `streams:public` narrow to be
"Messages in all public streams".
Prep commit for rewriting `update_narrow_title` to use
`filter.get_title` as a helper for setting browser title text.
In `filter.get_title`, add cases for the two missing "is" operators,
"alerted" and "unread".
Prep commit for rewriting `update_narrow_title` to use
`filter.get_title` as a helper for setting browser title text.
This avoids an error being triggered if `instance.reference` gets
remvoed from the DOM and `rows.get_message_id` is called on it in
`onShow` later.
This is an untested bug fix since I was not able to reproduce
this on live server or locally.
Previously, we retried all failed requests to
`/json/messages/matches_narrow` forever, with a fixed 5s retry. This
meant infinite retries even on 4xx responses, for instance on invalid
narrows -- and _each_ new message would add another infinite every-5s
retry.
Skip retries on 400 responses, and put an upper limit on the number of
retries. At the same time, change the retries to be
exponential-backoff with full jitter, to be more responsive in the
event of a one-off failure, and more forgiving in response to a longer
outage.
Failures that exhaust the 5 attempts are silent to the user -- since
this is likely an uncommon edge case (requiring Tornado to be serving
events to the client, Django to be unresponsive, and the client to be
narrowed to a filter it cannot apply locally), and the failure mode is
not bad (it will simply fail to live-update with new matching
messages).
Fixes: #20165.
This commit adds private messages to the Recent topics view, to make
it an all-encompassing overview of recent activity visible to the user.
We add a filter "Include PM" to toggle whether PMs should be shown in
recent topics.
Fixes#19449.
Adds the count of users with the role of guest to the stats view
`page_params` via a database query. This information is then added
to the summary statistics section of the analytics page after being
formatted by `stats.js`.
Creates Bassanio as a guest user in the database for the analytics
realm.
Fixes#20162.
This is not the right fix for this, but a temporary adjustment
to make it look good with minimal impact on other languages and
other pages.
Right fix would require changing the structure of the button, which
was not easy to do and make it look similar to how it looks now.
It was not possible to scroll to the bottom of the list on
narrow-width when only single column was displayed on the
settings overlay. This commit fixes the height of the sidebar
and set to "100% - height of header - height of tab-container"
which fixes the scroll behavior.
This is not a issue for two-column overlay where height is set
to "100% - height of header" (the tab-container is already
inside the header).
This duplicates some CSS to avoid using "!important". While doing
this duplication, we remove "margin: 0" and "display: block" since
these are already set as default values.
Fixes#22876.
There is some old CSS that was only being applied to some buttons
and not others. This deletes those lines so that only the opacity
changes on hover and not also the color.
Following up from #23059.
Send an empty list of `custom_profile_fields` in `page_params` for
spectators, rather than not sending the field at all.
Also, updates the user info popover to not show the manage user
three-dot menu when in a spectator view.
When trying to open settings overlay with invalid hash or
hash of a section which the user cannot view, for example
non-admins cannot view custom profile field section, then
we open the first section by default.
While if a user changes to a invalid hash by typing when
the overlay is already opened, then the previous section
remains open.
Fixes#23163.