-
-
Notifications
You must be signed in to change notification settings - Fork 59
[fix] Dynamically updating notification verb #334 #413
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
Open
pranshustuff
wants to merge
13
commits into
openwisp:master
Choose a base branch
from
pranshustuff:master
base: master
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 all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
2a38150
[fix] Dynamic updating of notification verb #334
84a46bf
[change] Remove verb field from Notifs #334
pranshustuff d2cd283
[fix] Dynamic update for notif verb #334
5b8f80b
[fix] Ran ./manage.py makemigrations #334
90202be
[fix] Deleting current migration #334
09f7333
[fix] Removed verb field from DB #334
24e7d43
Merge branch 'master' into master
pranshustuff 7faaa8b
[fix] Removed verb field from Sample App #334
cdbc29c
Merge branch 'master' into master
pranshustuff a7ff2f3
Merge branch 'master' into master
pranshustuff 722c664
[fix] Removing unused models import in migration #334
e2dccec
Merge branch 'master' into master
nemesifier 32f35b4
[fix] Dynamic Updates of Notif Verb #334
pranshustuff 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 hidden or 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 hidden or 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 hidden or 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
20 changes: 20 additions & 0 deletions
20
openwisp_notifications/migrations/0012_alter_notification_verb.py
This file contains hidden or 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,20 @@ | ||
| # Generated by Django 5.2.6 on 2025-10-14 18:40 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("openwisp_notifications", "0011_populate_organizationnotificationsettings"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="notification", | ||
| name="verb", | ||
| field=models.CharField( | ||
| blank=True, max_length=255, null=True, verbose_name="verb" | ||
| ), | ||
| ), | ||
| ] |
4 changes: 2 additions & 2 deletions
4
openwisp_notifications/templates/openwisp_notifications/default_message.md
This file contains hidden or 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,7 +1,7 @@ | ||
| {% block head %} {{ notification.level }} : {{notification.target}} {{ notification.verb }} {% endblock head %} | ||
| {% block head %} {{ notification.level }} : {{notification.target}} {{ notification.resolved_verb }} {% endblock head %} | ||
| {% block body %} | ||
| {% if notification.actor_link %}[{{notification.actor}}]({{notification.actor_link}}){% else %}{{notification.actor}}{% endif %} | ||
| reports | ||
| {% if notification.target_link %}[{{notification.target}}]({{notification.target_link}}){% else %}{{notification.target}}{% endif %} | ||
| {{ notification.verb }}. | ||
| {{ notification.resolved_verb }}. | ||
| {% endblock body %} |
This file contains hidden or 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 hidden or 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 hidden or 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
20 changes: 20 additions & 0 deletions
20
tests/openwisp2/sample_notifications/migrations/0004_alter_notification_verb.py
This file contains hidden or 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,20 @@ | ||
| # Generated by Django 5.2.6 on 2025-10-14 23:01 | ||
|
|
||
| from django.db import migrations, models | ||
|
|
||
|
|
||
| class Migration(migrations.Migration): | ||
|
|
||
| dependencies = [ | ||
| ("sample_notifications", "0003_default_groups_permissions"), | ||
| ] | ||
|
|
||
| operations = [ | ||
| migrations.AlterField( | ||
| model_name="notification", | ||
| name="verb", | ||
| field=models.CharField( | ||
| blank=True, max_length=255, null=True, verbose_name="verb" | ||
| ), | ||
| ), | ||
| ] |
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.
This will break the existing integration with other OpenWISP apps.
We have a context manager
notification_render_attributes, Can we set the verb using notification type in the context manage and then clear the field (set to None) in cleanup process?openwisp-notifications/openwisp_notifications/base/models.py
Lines 45 to 81 in b356e1d
It should behave similarly to the resolved_verb property.
Do you think a solution like this will solve our problem?
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.
I have not tested it yet. But I think it's a plausible solution.
I am a little busy at the moment. I'll get back to you sometime around next week after investigating this approach.
Thanks again for the review!