Commit Graph

45138 Commits

Author SHA1 Message Date
Tim Abbott 959c2547bb css: Delete now unused subscription-control-label class.
We're now styling these widgets identically to settings, and don't see
a special class.
2021-11-23 14:50:00 -08:00
Tim Abbott 5ac2241cf9 stream settings: Remove further differences from settings.css.
This fixes various visual glitches that resulted from reusing
components and overriding key elements of them.  The specific logical
changes are as follows:

* Delete custom checkbox positioning for stream settings; we now just
  use the common app_components.css code.
* Remove custom subscription-control-label styling; just use settings
  defaults.
* Copy the h3/h4 styling from settings.css. Ideally we'll deduplicate
  this in further cleanup.
* Add the inline property to stream_settings_checkbox elements, to
  reduce variable with settings_checkbox.hbs.
* Place every individual input inside an input-group, so that we can
  use the standard settings.css styling.
2021-11-23 14:48:17 -08:00
YashRE42 53a5942ab3 stream_types: Remove new-style class in stream_types.hbs.
Previously, the stream_edit modal relied on the new-style class to set
the margin-bottom value for stream-message-retention-days-input to 0,
in order to override the value set by bootstrap. The class new-style
is unhelpful because of its generic name, and in addition, time has /
will eroded away the significance of its name.

Hence, this commit adds the necessary rules to subscriptions.css and
removes the new-style class.

In order to make this change, this commit adds a block to
`subscriptions.css` with the selector `#stream_privacy_modal
.stream-message-retention-days-input input[type="text"]` one important
rule that this adds is `height: inherit;`. Adding this rule solves a
minor UI glitch where selecting "retain N days after posting" would
cause the save and cancel buttons to jump down by a pixel or so.

Fixes: #20222.
2021-11-23 14:11:35 -08:00
YashRE42 d1aefd4207 stream_create: Set handler on retention dropdown to show days input.
The stream creation form currently does not setup its own handler for
displaying the "N:" input when ".stream_message_retention_setting" is
changed.

Prior to e793ef7f62d280300afeeab2f4a086e99858a5a9, this form would
sometimes work as intended because stream_edit would set the handler
on this dropdown, when it was opened. However, after that commit, this
would simply never work.

Hence, in this commit, we make changes so that stream_create correctly
sets the handler on its dropdown. This causes us to repeat ourselves a
little and as such is not the cleanest solution, but this might be the
best we can do due to the complications of stream_edit opening a
modal.
2021-11-23 14:10:49 -08:00
YashRE42 6b370fee8a stream_edit: Be more specific w/ ".stream_message_retention_setting".
The stream creation form also uses the same stream_types template as
the stream privacy modal, however, it currently does not setup its own
handler for displaying the "N:" input when
".stream_message_retention_setting" is changed.

Previously, if one opened the stream creation form, then opened the
stream edit modal, and then went back to the stream creation form, the
drop down would correctly also .show() the input, because the handler
here would also target that selector. This is incorrect since we can't
always expect the stream_edit modal to be opened first, stream_create
should set up its own handlers.

Hence, as a prep commit to fixing stream_creation, and to ensure we
don't add duplicate handlers, in this commit we change all selectors
that targeted ".stream_message_retention_setting" to
"#stream_privacy_modal .stream_message_retention_setting" in this
file.
2021-11-23 14:10:49 -08:00
YashRE42 9851ed82a7 stream_settings: Remove unused rule referencing .modal-body .grey-box.
In d62e44fcba we migrate to using
micromodal for this pop up (via dialog_widget), as a result the
.modal-body style no longer applied as that class is not used.

In 55adf88e667da02284f0a6ffb6bcfdf73b5427cb we remove the grey-box
class from the stream_types template, hence even if the above wasn't
true, this rule would still not apply.

This commit thus removes this rule.
2021-11-23 14:10:49 -08:00
YashRE42 7151147907 stream_settings: Replace ul, li tags with div tags for checkboxes.
Due to reasons similar to 5de115a964, we
switch from using `ul`/`li`s to using `div`s here.
2021-11-23 14:10:49 -08:00
YashRE42 aaef190a36 stream_settings: Remove grey-box from personal tab & stream create.
Previously, the presence of the styles applied by grey-box caused a
visual disparity between the stream settings overlay and the
personal/organization settings overlay, hence, this commit removes
this class.
2021-11-23 14:10:49 -08:00
YashRE42 afa62609bc stream_types: Remove grey-box class.
Previously, the presence of the styles applied by grey-box caused a
visual disparity between this modal and similar settings in our
organisation settings view, hence, this commit removes this class.
2021-11-23 14:10:48 -08:00
Tim Abbott d860b8e568 api docs: Update API docs and changelog for new setting.
The commit 2c1a87166c did not properly
document the new feature in the changelog; while I was at it, I wrote
more detail in the field's description.
2021-11-23 14:05:37 -08:00
Sahil Batra 5607712794 stream_settings: Disable stream-privacy choices according to org settings.
The public and private stream choices in stream creation form are disabled
according to create_public_stream_policy and create_private_stream_policy
settings. It is not needed to disable them in stream privacy modal since
only admins can change the privacy of stream and they are allowed to
create public and private streams always irrespective of the setting.
2021-11-23 13:48:58 -08:00
Sahil Batra 25ba96488d settings: Add frontend part for create_web_public_stream_policy.
This commit has the following changes -

- Adds dropdown for changing create_web_public_stream_policy and this
dropdown is visible only if settings.WEB_PUBLIC_STREAMS_ENABLED and
enable_spectator_access is set to True. This dropdown is live-udpated
on changing enable_spectator_access setting.

- The web-public stream option in stream creation form and stream privacy
modal is hidden if one of settings.WEB_PUBLIC_STREAMS_ENABLED or
enable_spectator_access is set to False except in stream privacy modal
when the stream is already web-public so that the user is not confused by
none of the options being selected.

- We disable the web-public stream option in stream creation form and
in stream-privacy modals of stream which are not already web-public
when the user is not allowed to create web-public streams as per
create_web_public_stream_policy setting.

- We use on_show parameter to hide or disable the options in stream-privacy
modal because we use the visible property of element to remove the bottom
border from last element in the stream-privacy choices and thus we have
to wait for the modal to be visible.

Fixes #20287.  Fixes #20296.
2021-11-23 13:48:43 -08:00
Sahil Batra 443d8b6a65 settings: Add user_can_create_web_public_streams function.
This commit adds user_can_create_web_public_streams function
in settings_data.js which will be used in further commits
to disable or hide the UI elements for creating web-public
streams.
2021-11-23 10:48:20 -08:00
Sahil Batra 56a8443f05 models: Check enable_spectator_access value in web_public_streams_enabled.
This commit changes web_public_streams_enabled to return False if
realm.enable_spectator_access is False. This is added so that
creating web-public streams is not allowed if enable_spectator_access
is False.
2021-11-23 10:48:20 -08:00
Sahil Batra ad99b4fac9 streams: Allow changing stream to be web-public based on creation setting.
We allow a user to make an existing stream web-public only if user is
allowed to create web-public streams.
2021-11-23 10:48:20 -08:00
Sahil Batra 260851cd0e settings: Show enable_spectator_access option if server-setting is enabled.
We show the "Allow creating web-public streams" setting in UI only if
settings.WEB_PUBLIC_STREAMS_ENABLED is true on the server.
2021-11-23 10:48:20 -08:00
Sahil Batra 2c1a87166c register: Pass settings.WEB_PUBLIC_STREAMS_ENABLED to clients.
This commit adds 'server_web_public_streams_enabled' field to
the register response to pass settings.WEB_PUBLIC_STREAMS_ENABLED
to clients.
2021-11-23 10:48:20 -08:00
Sahil Batra 828927b724 server_events_dispatch: Remove unnecessary 'realm_' prefix.
We do not have 'realm_' prefix to the settings used as keys
in realm_settings object, we directly use the setting name.

This commit removes the 'realm_' prefix from enable_spectator_access
setting.
2021-11-23 10:48:20 -08:00
Alex Vandiver 3efed5f1e6 queue_processors: Shut down background missedmessage_emails thread.
Python's behaviour on `sys.exit` is to wait for all non-daemon threads
to exit.  In the context of the missedmessage_emails worker, if any
work is pending, a non-daemon Timer thread exists, which is waiting
for 5 seconds.  As soon as that thread is serviced, it sets up another
5-second Timer, a process which repeats until all
ScheduledMessageNotificationEmail records have been handled.  This
likely takes two minutes, but may theoretically take up to a week
until the thread exits, and thus sys.exit can complete.

Supervisor only gives the process 30 seconds to shut down, so
something else must prevent this endless Timer.

When `stop` is called, take the lock so we can mutate the timer.
However, since `stop` may have been called from a signal handler, our
thread may _already_ have the lock.  As Python provides no way to know
if our thread is the one which has the lock, make the lock a
re-entrant one, allowing us to always try to take it.

With the lock in hand, cancel any outstanding timers.  A race exists
where the timer may not be able to be canceled because it has
finished, maybe_send_batched_emails has been called, and is itself
blocked on the lock.  Handle this case by timing out the thread join
in `stop()`, and signal the running thread to exit by unsetting the
timer event, which will be detected once it claims the lock.
2021-11-23 10:45:49 -08:00
Rahul Gurung acbeeac037
docs: Remove deprecated stash from example integrations. 2021-11-23 10:38:28 -08:00
Lauryn Menard 136234a7f8 documentation: Fix ordered list text wrapping in some /help articles.
Minor change to some of the `/help` md files to correct the text
wrapping of ordered lists in the content of the article.
2021-11-23 10:15:14 -08:00
Shlok Patel b3c58f454f api: Prevent special characters in topics.
Special characters, including `\r`, `\n`, and more esoteric codepoints
like non-characters, can negatively affect rendering and UI behaviour.

Check for, and prevent making new messages with, characters in the
Unicode categories of `Cc` (control characters), `Cs`, (surrogates),
and `Cn` (unassigned, non-characters).

Fixes #20128.
2021-11-22 22:09:06 -08:00
Aman Agrawal bf93ae1644 ui: Align bottom components in the same horizontal line. 2021-11-22 18:44:32 -08:00
Aman Agrawal 061e274716 compose: Add dividers.
These improves the visual organization of the compose controls.

This is consistent with the divider we have for the navbar.
2021-11-22 18:44:32 -08:00
Aman Agrawal 2b8aa5ce2d compose: Add formatting buttons to bottom of compose box.
This is a very frequently requested feature for organizations that are
new to Markdown, that brings Zulip's UI more in line with that of
competing projects and other markdown editors like the GitHub UI.
2021-11-22 18:44:31 -08:00
Aman Agrawal 2af933678c compose: Refactor bottom part of compose box.
* We use flexbox instead of `position: relative` to align elements.
* Increase clickable area of icons using more padding.
* Increase space between elements.
* Fix mobile compose box icon alignment.
2021-11-22 18:29:45 -08:00
Aman Agrawal 29cdd99220 giphy: Use single element for tooltip and popover.
This works surprisingly unlike my previous attempts to do so.

WARN: This is a pseudo commit and should only be merged with upcoming
compose box bottom refactoring commit since the css changes required
for this change are missing here and are not required after that
commit.
2021-11-22 18:29:45 -08:00
Aman Agrawal 3423797efa compose: Remove drafts link.
Since we have the drafts button in top left corner and we need space
to insert formatting buttons in the bottom of compose box; removing
drafts link makes sense.
2021-11-22 18:29:45 -08:00
Aman Agrawal 9d0dded959 composebox_typeahead: Don't propagate after handling tab.
After we set focus manually to the send button, `tab` propagation
should be stopped.
2021-11-22 18:29:45 -08:00
Julia Bichler 32f206e1e5 popovers: Add sidebar menu to delete all drafts.
This provides a convenient interface to hide all drafts.

Fixes #19360.

However, we may want to continue to implement a button in the drafts
overlay as well for doing this operation.
2021-11-22 17:01:47 -08:00
Johan Ehinger 4207f0a299 settings: Add UI setting option for controlling invite expiration time.
Add a UI for controlling invititation expiration time, supported
options are 1 day, 3 days, 10 days and 30 days.

Fixes #19680.
2021-11-22 16:40:14 -08:00
Tim Abbott a7898ed305 stream_data: Rename id_is_subscribed to is_subscribed. 2021-11-22 15:44:30 -08:00
Tim Abbott 53d9797044 stream_data: Rename is_subscribed to is_subscribed_by_name.
Generally the stream_data module aims to do lookup by ID, not name,
wherever possible, so we should represent that in the function names.
2021-11-22 15:44:30 -08:00
Tim Abbott 043d83b434 unread: Lookup subscription status by ID.
We prefer to use IDs, not stream names, to do lookups wherever both
are available.
2021-11-22 15:39:58 -08:00
Tim Abbott 3f4d66109b stream_data: Rename get_invite_only helper method.
Since this library is intended to primarily work by user ID, we want
to name all methods that do lookups by stream name explicitly.
2021-11-22 15:32:14 -08:00
Aman Agrawal d9338a68d1 compose: Show globe icon for web public streams.
Fixes #20285.
2021-11-22 15:31:22 -08:00
Aman Agrawal a7b2c7f7ea recipient_row: Show globe icon for web public streams. 2021-11-22 15:26:21 -08:00
Aman Agrawal e8ec42bf8a stream_bar: Rename update_lock_icon_for_stream. 2021-11-22 15:26:21 -08:00
Aman Agrawal 4e5e1a2542 recipient_row: Generalize class name for icon in recipient_row. 2021-11-22 15:26:21 -08:00
Aman Agrawal 883732a1d1 portico: Remove unused `moving-label` class.
This class is no longer used in these input fields.
2021-11-22 15:02:00 -08:00
Aman Agrawal a39d9ee4fd portico: Center align moving label text in input. 2021-11-22 15:02:00 -08:00
Ganesh Pawar 291aaf373f modal: Add support for modal event handlers. 2021-11-22 15:00:38 -08:00
Ganesh Pawar 8908ea99ec modal: Add support for linking the submit button to a form element. 2021-11-22 15:00:38 -08:00
Sahil Batra eef9dd963b zcommand: Replace "mode" with "theme" in the returned message.
This commit replaces "dark mode" and "light mode" with "dark theme"
and "light theme" in the message returned and shown in a little
popup in the UI, when color scheme settings are changed through
slash commands.
2021-11-22 14:59:16 -08:00
Sahil Batra 1cdc7306c6 slash: Change description of /light command in typeahead. 2021-11-22 14:59:16 -08:00
Lauryn Menard fee7b10db4 api_documentation: Fix `/update-subscription-settings` api doc.
Adds `wildcard_mentions_notify` as a property that can be updated
by the endpoint and removes mention of potential `null` value in
the return object because it is not possible.

Also cleans up the documentation of `in_home_view` legacy property
and updates the return object description to better reflect what
is actually returned.
2021-11-22 11:50:27 -08:00
Mateusz Mandera 8af7ffd9da rate_limit: Fix logging string when rate limiting email gateway.
realm.name is not the right "name" to log, we should use realm.subdomain
like everywhere else.
2021-11-22 10:28:56 -08:00
Aman Agrawal 2c4af0e111 integration: Fix overflowing display name on open collective page.
Removed extra text to stop display name from flowing out of logo
container.
2021-11-21 21:05:06 -08:00
Aman Agrawal 334f046842 events: Don't send data related to custom profile field to spectator.
Since spectators can't access personal profile settings and
can't view profile for other users. Hence, we don't send realm
custom profile field data and user's profile data to spectators.

Fixes #20301.
2021-11-20 21:01:38 -08:00
YashRE42 717c4ae603 refactor: Remove duplication from reactions.add_clean_reaction.
In commit 3d86267041 we add logic to
`/shared/emoji.js` which duplicated some of the logic in this
function. Since this isn't desirable, we remove the duplicate logic
here and instead just call `emoji.get_emoji_details_for_rendering`.
2021-11-20 20:57:54 -08:00