-
-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[feat] Notification Preferences Page #290
Open
Dhanus3133
wants to merge
82
commits into
gsoc24-rebased
Choose a base branch
from
notification-preferences
base: gsoc24-rebased
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 80 commits
Commits
Show all changes
82 commits
Select commit
Hold shift + click to select a range
04be6f9
[chore] REST API changes
Dhanus3133 23ff78a
[chore] Add tests
Dhanus3133 b83059e
[chore] Use GenericAPIView
Dhanus3133 ff375af
[refactor] URL routes
Dhanus3133 beb8500
[chore] Update tests
Dhanus3133 7b7eda0
[chore] Add Global Notification
Dhanus3133 7bf80a5
[chore] Global Notification Preference changes
Dhanus3133 da95d6e
[feat] Notification Settings Page
Dhanus3133 ed4b568
[qa] Check fixes
Dhanus3133 512041e
[chore] Notification settings page with breadcrumbs
Dhanus3133 b773092
[chore] Notification settings update
Dhanus3133 c789d43
[chore] CSS updates
Dhanus3133 9de0b51
[chore] Bump changes
Dhanus3133 55a1146
[fix] Verbose errora admin user page
Dhanus3133 ef1ab62
[chore] Web notification on the left, email on the right
Dhanus3133 07ad539
[chore] Handling auto trigger of email without web checkboxes
Dhanus3133 77594d6
[chore] Automatically open first org dropdown, label for org level em…
Dhanus3133 c75a890
[chore] Fetch current user global setting preference and make it default
Dhanus3133 3fdd806
[chore] Update type_label for user-setting api
Dhanus3133 78ec0f0
[chore] Reduced CSS and replicate admin design
Dhanus3133 e828707
[chore] Update org name styles and add no setting available
Dhanus3133 f88e48e
[QA] Fixes
Dhanus3133 f7f69d1
[chore] Toast dialog update
Dhanus3133 d0091e6
[chore] Variable naming
Dhanus3133 667a4f2
[chore] Org level email/web center to the checkbox
Dhanus3133 3eec3c6
[fix] Tests
Dhanus3133 e6afe62
[chore] Reviewed change bump
Dhanus3133 0788512
[chore] Add tooltips
Dhanus3133 e06c38b
[chore] Remove unused
Dhanus3133 144065e
[chore] Add link in notification widget
Dhanus3133 fd9403e
[chore] Fix settings button in widget
Dhanus3133 907705f
[chore] Drop ow-show-unread button functionality
Dhanus3133 c6cca10
[chore] Handle UI on API errors
Dhanus3133 8cd948a
[chore] Remove unused
Dhanus3133 cbcce9d
[chore] Immediately apply setting changes and rollback on API error
Dhanus3133 f4c2661
[chore] Use switch
Dhanus3133 0ed9a80
[chore] Bump reviewed changes
Dhanus3133 7c2dd52
[chore] Fetch upto 100 user-settings per api request
Dhanus3133 7cb8ae8
[chore] Add 'Organization:' on the header
Dhanus3133 4b03146
[chore] Increase spacing around email/web global switches
Dhanus3133 246f53d
[chore] Add space around settings
Dhanus3133 b2542e1
[docs] Update Notification Preference page
Dhanus3133 8844a31
[chores] Small UI and view improvements
nemesifier 6e1d86c
[chore] Bump review changes
Dhanus3133 48d34d8
[qa] Fix checks
Dhanus3133 d0dec10
[fix] URL update
Dhanus3133 8a7b283
[chore] Add test for missing notification_preference get api
Dhanus3133 6e110a0
[chore] Add missing tests
Dhanus3133 c229c0c
[chore] Bump changes
Dhanus3133 0894ac5
[chore] View Notification preferences button in user admin model for …
Dhanus3133 01cf662
[chore] Show loader
Dhanus3133 bded33a
[chore] Add selenium test
Dhanus3133 93b3097
[fix] Tests
Dhanus3133 fb9d02d
[fix] Tests
Dhanus3133 7a29833
[fix] Tests
Dhanus3133 3a1e358
[fix] Tests
Dhanus3133 65ec77a
[fix] Should fix Tests
Dhanus3133 ca97dfe
[chore] Bump changes
Dhanus3133 09b8544
[chore] Reuse serializer
Dhanus3133 ca34105
[chore] Increase waiting time for selenium tests
Dhanus3133 046b6b4
[chore] Update preference page org dropdown icon position
Dhanus3133 2364ae0
[fix] Error displaying __str__ for global notification setting
Dhanus3133 b745ba3
[chore] Verify global setting creation in test_post_migration_handler…
Dhanus3133 6b55c07
[chore] Remove transition on accordion
Dhanus3133 0ba70c7
[chore] Update tests
Dhanus3133 6879e7e
[chore] Bump changes
Dhanus3133 a238929
[fix] Import error
Dhanus3133 e13d7c3
[chore] Bump changes
Dhanus3133 fcda9e5
[chore] Update org level changes
Dhanus3133 1e04ce7
[chore] Use full_clean instead of saving directly
Dhanus3133 af65aa0
[chore] Update global notification setting changes
Dhanus3133 92c6668
[chore] UI changes
Dhanus3133 a5ffe4b
[changes] Improved JS and CSS
pandafy f06560b
[fix] Fixed bug in changing organization notification
pandafy da20e19
[tests] Added test for regression
pandafy 0feb0d2
[chores] Increased padding for tooltip
pandafy 6e320f8
[qa] Fixed formatting
pandafy 40ec219
[chores] Misc improvements
nemesifier 1a1c9d7
[qa] Reformatted code with prettier
nemesifier 025dc7c
[chores] Improved readability of JS template fragments
nemesifier 1570a78
[QA] Fixed JS warnings with prettier
nemesifier a0e2855
[ci] Switched to prettier
nemesifier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
Notification Preferences | ||
======================== | ||
|
||
.. image:: https://raw.githubusercontent.com/openwisp/openwisp-notifications/docs/docs/images/notification-settings.png | ||
:target: https://raw.githubusercontent.com/openwisp/openwisp-notifications/docs/docs/images/notification-settings.png | ||
.. image:: https://i.imgur.com/lIGqry5.png | ||
:target: https://i.imgur.com/lIGqry5.png | ||
:align: center | ||
|
||
OpenWISP Notifications enables users to customize their notification | ||
|
@@ -12,6 +12,10 @@ organized by notification type and organization, allowing users to tailor | |
their notification experience by opting to receive updates only from | ||
specific organizations or notification types. | ||
|
||
Users can access and manage their notification preferences by visiting the | ||
``/notification/preferences/``. Alternatively, this page can also be | ||
accessed directly from the notification widget. | ||
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please add a screenshot here with a red circle on the button. Let's also invert the order of these sentences, mention the notification preferences button first, which is the most logical way for the user to open this page (nobody will type the URL in their browser, come on). |
||
Notification settings are automatically generated for all notification | ||
types and organizations for every user. Superusers have the ability to | ||
manage notification settings for all users, including adding or deleting | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,3 @@ | ||
from django.contrib import admin | ||
|
||
from openwisp_notifications.base.admin import NotificationSettingAdminMixin | ||
from openwisp_notifications.swapper import load_model | ||
from openwisp_notifications.widgets import _add_object_notification_widget | ||
from openwisp_users.admin import UserAdmin | ||
from openwisp_utils.admin import AlwaysHasChangedMixin | ||
|
||
Notification = load_model('Notification') | ||
NotificationSetting = load_model('NotificationSetting') | ||
|
||
|
||
class NotificationSettingInline( | ||
NotificationSettingAdminMixin, AlwaysHasChangedMixin, admin.TabularInline | ||
): | ||
model = NotificationSetting | ||
extra = 0 | ||
|
||
def has_change_permission(self, request, obj=None): | ||
return request.user.is_superuser or request.user == obj | ||
|
||
|
||
UserAdmin.inlines = [NotificationSettingInline] + UserAdmin.inlines | ||
|
||
_add_object_notification_widget() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from rest_framework.permissions import BasePermission | ||
|
||
|
||
class PreferencesPermission(BasePermission): | ||
""" | ||
Permission class for the notification preferences. | ||
|
||
Permission is granted only in these two cases: | ||
1. Superusers can change the notification preferences of any user. | ||
2. Regular users can only change their own preferences. | ||
""" | ||
|
||
def has_permission(self, request, view): | ||
return request.user.is_superuser or request.user.id == view.kwargs.get( | ||
'user_id' | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
openwisp_notifications/migrations/0008_alter_notificationsetting_organization_and_more.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# Generated by Django 4.2.16 on 2024-09-17 13:19 | ||
|
||
import django.db.models.deletion | ||
from django.db import migrations, models | ||
|
||
|
||
class Migration(migrations.Migration): | ||
dependencies = [ | ||
("openwisp_users", "0020_populate_password_updated_field"), | ||
("openwisp_notifications", "0007_notificationsetting_deleted"), | ||
] | ||
|
||
operations = [ | ||
migrations.AlterField( | ||
model_name="notificationsetting", | ||
name="organization", | ||
field=models.ForeignKey( | ||
blank=True, | ||
null=True, | ||
on_delete=django.db.models.deletion.CASCADE, | ||
to="openwisp_users.organization", | ||
), | ||
), | ||
migrations.AlterField( | ||
model_name="notificationsetting", | ||
name="type", | ||
field=models.CharField( | ||
blank=True, | ||
choices=[ | ||
("default", "Default Type"), | ||
("generic_message", "Generic Message Type"), | ||
], | ||
max_length=30, | ||
null=True, | ||
verbose_name="Notification Type", | ||
), | ||
), | ||
] |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you guys are fine with the final tweaks, it's time to update this!