We can use this format to display text in plural form or not based
on a number. This helps translators easily translate text and
users get a better formatted text.
We are renaming stream to stream_name in formatted draft object
just to be more explicit and be clear that we are storing that
stream name in this variable.
This commit changes snapshot_message to store stream_id for
drafts along with stream names. The stream_id field is
undefined if draft is for empty or invalid stream name.
After this change:
- If draft has a valid stream_id stored and it maps to
a stream, then we display the stream name from the
obtained stream object.
- If draft.stream_id is undefined or doesn't map to a stream,
then we display the name stored in draft.stream, which can
be invalid (no stream of this name existed ever), can be
empty and can also be name of a deactivated stream.
This change helps us to show correct stream-name for drafts
in case of renaming a stream.
Fixes#15155.
Along with the extraction, we do some simplifications of inserting
text in compose too. This same function can now be used in
compose formatting popover too.
We use "text-field-edit", which has good cross-browser `undo` /
`redo` support, to do the text replace for us instead of writing
that logic ourselves.
There is a bug when multiple message edit forms are opened at the
same time where undefined value of stream_id is sent to the server.
This happens because a global variable stream_widget is used to get
the id of stream selected in dropdown and value of stream_widget
variable keeps on changing when we open multiple message edit forms.
Thus, stream_widget can have the dropdown widget of already closed
edit form resulting in undefined value of stream id.
This commit changes the save_message_row_edit function to access
the dropdown element directly using message id instead of using
stream_widget.value() and thus we always use the correct dropdown
element to get the stream id.
We also move the stream_widget variable to be inside edit_message
function instead of being global variable for the module.
Fixes#19663.
Before this commit, the message or any draft is deleted as soon
as the compose box is closed. So, it removes that by removing
delete_active_drafts and instead this commit will add the deletion
process of drafts in reify_message_id that is called when a
message is successfully sent and received.
Now, see there are two types of messages, one that are locally
echoed and the second ones are that aren't locally echoed but
sent directly to server. This commit only saves the message in
draft if it is locally echoed as they are the only messages
that show message failed in message list. The non locally echoed
ones aren't remove from the compose box until they are
successfully sent. Now as the draft-id is stored in the message
data for locally echoed messages, as they are echoed from the
server, they are deleted using that draft-id.
This also adds node tests for echo reify_message_id for testing
this feature that this commit is adding.
Fixes#17697
Since, the filter button is replaced with a different button
after click, the `current_focus_elem` points at incorrect
element. `revive_current_focus` follows a good
method to locate the filter button, hence
we use it to correct the element `current_focus_elem` points at.
This commit fixes the live update of notification sound
setting dropdown. We already update the notification sound
source to play the correct sound after changing the setting.
We set the class name to be same as the one used in move topic
to stream popover so that a single class can be used to control
the look of both dropdowns.
Extracted by tabbott from the original pull request, with additional
changes to document the surprising margin-top in our current
implementation and avoid a bit of unnecessary CSS.
On our Markdown help docs, ordered lists that aren't encapsulated
in tabs don't have custom CSS that tells them how to display
themselves with proper indentation. An example of a doc that has
this issue is /help/saml-authentication. This commit adds some CSS
that targets such ordered lists.
This will be used to check if the narrow being requested by
spectator requires authentication without requesting the server.
Having this check locally, makes this process look snappy to
the user and doesn't result in 404s in the browser log.
For spectators, without sending any request to the server,
check locally if the hash requires authentication or which
shows a feature that requires authentication;
if it does, we show login_to_access modal to the user.
We will use this modal for any narrow / hash or other UI element that
requires an actual account to use, to provide something reasonable to
occur when a user clicks on those things.
We ideally will also add a /help/ page explaining these with an
example, but it seems appropriate to make the labels frame it around
what sort of emails we actually intend to send (newsletters with
updates about Zulip, not a "drip campaign").
It’s not helpful for the browser to substitute another font for the
icon font while it’s loading.
This suppresses a warning from the Lighthouse performance analyzer.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
We rename class of notification settings except checkboxes
by prefixing them with 'setting_' for clarity.
We do not change class of checkboxes because settings_checkbox
is used by other templates also and if we only change class
of those using notification_settings_checkboxes then live
update code will break and will need to add separate condition
for differentiating between which partial template is used.
This is a prep commit for adding UI for realm-level defaults
of user settings.
This commit renames notification-sound-audio element to
user-notification-sound-audio because we will be adding similar
element for realm-level default of user settings also.
We also change the child elements to have current id as their
class for the same reason.
This commit adds prefix paramter with value "user_" to the
settings_checkbox and notification_settings_checkboxes references
in notification_settings.hbs such that ids are unique when we use
notification_settings.hbs for realm-level settings UI.
This commit creates a new template user_notification_settings.hbs
for user notification settings and notification_settings.hbs will
be used as a common template for user-level and realm-level
settings.
This is a prep commit for adding UI for realm-level default
of user settings. We refactor the code to use classes
instead of ids such that we can use the common code for the
new settings.
This commit refactors change_display_setting function to accept
url as a paramter instead of directly using '/json/settings'
such that we can use the same function for realm-level settings.
This commit refactors change_display_setting function to
accept container element as a paramter and then determine
the correct status element from it. This is the prep commit
for adding realm-level default settings UI.
We add a prefix to id of default_language_modal.hbs
such that we can use the same code for user settings
and realm-level settings.
We also add a class "default_language_modal" to the
modal div to avoid duplicate css.
This commit adds prefix paramter with value "user_" to the
settings_checkbox references in display_settings.hbs such
that ids are unique when we use display_settings.hbs for
realm-level settings UI.
This commit creates a new template user_display_settings.hbs
for user display settings and display_settings.hbs will be
used as a common template for user-level and realm-level
settings.
This is a prep commit for adding UI for realm-level
default of user settings. We refactor the code to use
classes instead of ids such that we can use the common
code for the new settings.