Commit Graph

38 Commits

Author SHA1 Message Date
Puneeth Chaganti 4383c819cf digest: Fix visibility toggling of digest notifications checkbox. 2019-05-10 09:08:02 -07:00
Harshit Bansal b553507412 subscriptions: Migrate notification setting defaults model.
This commit migrates the Subscription's notification fields from a
BooleanField to a NullBooleanField where a value of None means to
inherit the value from user's profile.

Also includes a migrations to set the corresponding settings to None
if they match the user profile's values. This migration helps us in
getting rid of the weird "Apply to all" widget that we offered on
subscription settings page.

The mobile apps can't handle None appearing as the stream-level
notification settings, so for backwards-compatibility we arrange to
only send True/False to the mobile apps by applying those defaults
server-side.  We introduce a notification_settings_null value within a
client_capabilities structure that newer versions of the mobile apps
can use to request the new model.

This mobile compatibility code is pretty effectively tested by the
existing test_events tests for the subscriptions subsystem.
2019-05-08 17:45:10 -07:00
Shubham Padia 27ff71c96f settings: Don't check mobile notifications if they are disabled.
Fixes #12198.
2019-04-30 14:56:26 -07:00
Puneeth Chaganti aca63f0fbe notifications: Hide digest emails user setting if globally disabled. 2019-04-27 15:20:41 -07:00
Rishi Gupta a501abf3a1 settings: Move pm_content_in_desktop_notifications into Other notifications.
Not as nice as the previous coupling, but needed for upcoming refactors to
this page.
2019-04-23 15:24:39 -07:00
Rishi Gupta 29d30ceab7 settings: Decouple enable_push_notifications_offline from PM setting.
Note that this setting has always applied to both streams and PMs; the test
just clarifies that that is the case.
2019-04-23 15:24:39 -07:00
Tim Abbott bdb3da4504 eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate
number of generally very old violations in the codebase.  Fix this and
clear the ones that exist..
2018-12-18 10:41:06 -08:00
Marco Burstein ba46dc83c6 notifications: Add a setting for changing the notification sound.
Also, add a new notification sound, "ding". It comes from
https://freesound.org, where the original Zulip notification sound comes
from as well. In the future, new sounds can be added by adding audio
files to the `static/audio/notification_sounds` directory.

Tweaked significantly by tabbott:
* Avoided removing static/audio/zulip.ogg, because that file is
  checked for by old versions of the desktop app.
* Added a views check for the sound being valid + tests.
* Added additional tests.
* Restructured the test_events test to be cleaner.
* Removed check_bool_or_string.
* Increased max length of notification_sound.
* Provide available_notification_sounds in events data set if global
  notifications settings are requested.

Fixes #8051.
2018-12-09 21:25:30 -08:00
Pragati Agrawal ba4e4e38ae user settings: Add setting to make login notifications optional.
This adds a feature in the "Notification" section of "Settings" tab,
which lets user enable or disable login emails notification.

Tweaked by tabbott to simplify the test.

Fixes: #5795, progress towards #5854.
2018-08-28 14:02:31 -07:00
Roman Godov 5e70577f84 models: Rename Realm.show_digest_email field.
This renames Realm.show_digest_email field to
digest_emails_enabled, for greater clarity as to what it does
just from seeing the setting name, without having to look it up.

Fixes part of #10042.
2018-08-01 11:05:58 -07:00
Sarah de2ec8a05c notification settings: Add UI for stream email notifications.
Previous commits have fully implemented the logic for stream email
notifications; this final commit adds support for configuring it to
the UI.

Fixes #6511.
2018-07-14 12:19:33 +05:30
Armaan Ahluwalia 6d255efe4c app: Prepare JS files for consumption by webpack.
This commit prepares the frontend code to be consumed by webpack.

It is a hack: In theory, modules should be declaring and importing the
modules they depend on and the globals they expose directly.

However, that requires significant per-module work, which we don't
really want to block moving our toolchain to webpack on.

So we expose the modules by setting window.varName = varName; as
needed in the js files.
2018-07-05 10:53:36 +02:00
Tim Abbott b88ec552cf settings_notifications: Remove now-unnecessary ensure_i18n. 2018-05-30 09:06:59 -07:00
Shubham Dhama 419208cabe settings: Refactor to use pluck to extract `setting` attribute.
This is just a small refactor to use `pluck` over manually using `map`.
2018-03-27 18:01:03 -07:00
Shubham Dhama 0bd5a7cf29 settings_ui: Extend `do_settings_change` for other request methods also.
With this, we need to send channel request method callback as an
argument while calling.
2018-03-15 17:06:45 -07:00
YJDave c94b21e9ac settings: Add setting to disable message content in missed message emails.
Fixes #6938.
2018-03-09 21:16:02 -08:00
Shubham Dhama a0ab87bef2 notifications: Clean and automate global notifications update handler.
To prevent specifying notifications individually for global
updates, automate handle_global_notification_updates using
settings_notifications.notification_settings where we have
the keys of all the types of notifications.
2018-03-08 07:19:48 -08:00
Tim Abbott 0d29864c6a setting: De-duplicate logic for bulk-updating notifications settings.
In the new data model, this duplication was unnecessary.
2018-03-07 15:21:17 -08:00
Shubham Dhama 2782a5d8dc settings: Update notification settings to new feedback style.
This split notification settings to separate settings for streams,
PM/mention and other notifications settings.
Previously we have to treat them combined, but with this refactor,
we can treat them separately for future changes.

Fixes #8587.
2018-03-07 15:21:17 -08:00
Tim Abbott b55f881447 settings: Split notification_settings into a few sub-variables.
This refactor has no functional effect, but sets us up to be able to
do the next refactor.
2018-03-07 15:20:53 -08:00
YJDave 59cf67062f settings: Add generic func to disable settings elements in UI.
We have some settings which are inter-dependent. If one setting
is checked or unchecked, it's dependent-sub-setting get disabled
or enabled. i.e. If user unchecked setting allow-message-editing
then message-editing-time-limit setting should get disabled in UI.

Add generic function to change disable attribute of sub settings
on checked or unchecked event of main setting in `settings_ui.js`.
2018-03-03 08:38:54 -08:00
Roman Godov b875fe07eb settings: Added setting to turn on and off realm name in email subject.
Users having only account in one realm will not be distracted by realm
name in subject lines of every email.  Users who have multiple
accounts in realms can turn this setting on and receive a
corresponding realm name in email's subject.

Tweaked by tabbott to rebase and address a few small issues.

Fixes #5489.
2018-02-05 18:01:54 -08:00
Ali Rizwi 6c0ea18ea9 user settings: Make "Mobile push notifications always" a subsetting.
"Mobile push notifications always" is now indented and a
sub-setting of "Mobile push notifications when offline".
It can be selected only when the outer setting is
selected, otherwise it is greyed out.

Fixes #6570.
2017-09-29 17:58:41 -07:00
Sarah c3a8138f74 user_settings: Add push notifications for all stream messages.
Add setting to enable push notifications for all stream messages.
2017-09-14 05:41:37 -07:00
Umair Khan f265718854 i18n: Escape settings names in settings status messages.
By default, all text is escaped in i18next. We can use '__- ' to
unescape.

Fixes #6219
2017-08-23 00:22:59 -07:00
Cory Lynch d32e89aae4 jQuery: Remove broken use of "removeAttr".
This function no longer sets properties to false, so the supported
way of doing this is to instead use prop(foo, false). Some tests
had to be fixed to accommodate this.
2017-07-24 10:54:47 -07:00
Cynthia Lin e21c3e1cb7 settings: Nest PM content setting in Desktop notification setting.
Fixes #5879
2017-07-21 12:13:43 -07:00
Sarah 9ebb503340 settings_notifications.js: Save notification settings on change.
Refactor settings_notifications to save each setting on change.

Fixes #3264.
2017-06-07 13:39:27 -07:00
Sarah baf92b98f2 settings_notifications.js: Refactor using notification_settings variable.
Create an array of all user notification settings and loop through it
to update notification settings and display results.
2017-06-07 13:33:08 -07:00
Sarah 381ec1f5d4 settings_notifications.js: Refactor using notification_settings variable.
Create an array of all user notification settings and loop through it
to update notification settings and display results.

Formatting tweaked by tabbott.
2017-06-06 20:35:56 -07:00
Tim Abbott df8f4a837c home: Get page_params.enable_desktop_notifications from register_ret. 2017-04-28 23:15:35 -07:00
Tim Abbott 2a16cc1d24 home: Get enable_stream_desktop_notifications from register_ret. 2017-04-28 22:01:46 -07:00
Tim Abbott 2a8a101fe2 home: Get page_params.enable_stream_sounds from register_ret. 2017-04-28 21:56:58 -07:00
Tim Abbott 30db811167 home: Get page_params.enable_sounds from register_ret. 2017-04-28 21:54:05 -07:00
fionabunny 935ddf3b17 home.py: move show_digest_email as realm_show_digest_email.
Part of #3853.
2017-04-28 21:12:10 -07:00
Steve Howell 7326971380 Extract stream_edit.js.
This code makes the right pane work in "Manage Streams" when
you are editing a stream subscription.  It handles basic
functionality (submitting forms, etc.), live updates, and
showing the pane as needed.

Most of the code here was simply moved from subs.js, but some
functions were pulled out of larger functions:

    live update:
        add_me_to_member_list
        update_stream_name
        update_stream_description

    collapse/show:
        collapse
        show_sub

We also now export subs.show_subs_pane.

We eventually want stream_edit not to call into subs.js, and
this should be fairly easy--we just need to move some shared
methods to a new module.
2017-04-25 09:57:32 -07:00
Steve Howell 46af691e76 minor: Move line of code to hide digest settings.
This line was overlooked when extracting code to
settings_notifications.js.  It was not causing a user facing
error, but it was in the wrong place.
2017-04-07 15:20:12 -07:00
Steve Howell 1f38884b27 Extract settings_notifications.js. 2017-04-06 11:28:36 -07:00