Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
AlekSIS-Core
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
AlekSIS®
Official
AlekSIS-Core
Commits
d2a359bb
Verified
Commit
d2a359bb
authored
4 years ago
by
Jonathan Weth
Browse files
Options
Downloads
Patches
Plain Diff
Fix use of some preferences
parent
256e3864
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!217
Migrate from constance to dynamic-preferences
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
aleksis/core/preferences.py
+3
-5
3 additions, 5 deletions
aleksis/core/preferences.py
aleksis/core/util/notifications.py
+3
-3
3 additions, 3 deletions
aleksis/core/util/notifications.py
with
6 additions
and
8 deletions
aleksis/core/preferences.py
+
3
−
5
View file @
d2a359bb
...
...
@@ -43,7 +43,6 @@ class ColourPrimary(StringPreference):
default
=
"
#0d5eaf
"
required
=
False
verbose_name
=
_
(
"
Primary colour
"
)
widget
=
ColorWidget
@global_preferences_registry.register
...
...
@@ -53,7 +52,6 @@ class ColourSecondary(StringPreference):
default
=
"
#0d5eaf
"
required
=
False
verbose_name
=
_
(
"
Secondary colour
"
)
widget
=
ColorWidget
@global_preferences_registry.register
...
...
@@ -68,7 +66,7 @@ class MailOutName(StringPreference):
@global_preferences_registry.register
class
MailOut
(
StringPreference
):
section
=
mail
name
=
"
name
"
name
=
"
address
"
default
=
settings
.
DEFAULT_FROM_EMAIL
required
=
False
verbose_name
=
_
(
"
Mail out address
"
)
...
...
@@ -115,10 +113,10 @@ class NotificationChannels(ChoicePreference):
# FIXME should be a MultipleChoicePreference
section
=
notification
name
=
"
channels
"
default
=
[
"
email
"
]
default
=
"
email
"
required
=
False
verbose_name
=
_
(
"
Channels to use for notifications
"
)
choices
=
get_notification_choices_lazy
choices
=
get_notification_choices_lazy
()
@global_preferences_registry.register
...
...
This diff is collapsed.
Click to expand it.
aleksis/core/util/notifications.py
+
3
−
3
View file @
d2a359bb
...
...
@@ -38,7 +38,7 @@ def _send_notification_email(notification: "Notification", template: str = "noti
}
send_templated_mail
(
template_name
=
template
,
from_email
=
lazy_preference
(
"
notification__mail_out
"
),
from_email
=
lazy_preference
(
"
mail
"
,
"
address
"
),
recipient_list
=
[
notification
.
recipient
.
email
],
context
=
context
,
)
...
...
@@ -63,7 +63,7 @@ def _send_notification_sms(
# - Check for availability
# - Send notification through it
_CHANNELS_MAP
=
{
"
email
"
:
(
_
(
"
E-Mail
"
),
lambda
:
lazy_preference
(
"
notification__mail_out
"
),
_send_notification_email
),
"
email
"
:
(
_
(
"
E-Mail
"
),
lambda
:
lazy_preference
(
"
mail
"
,
"
address
"
),
_send_notification_email
),
"
sms
"
:
(
_
(
"
SMS
"
),
lambda
:
getattr
(
settings
,
"
TWILIO_SID
"
,
None
),
_send_notification_sms
),
}
...
...
@@ -75,7 +75,7 @@ def send_notification(notification: Union[int, "Notification"], resend: bool = F
previously marked as sent.
"""
channels
=
lazy_preference
(
"
notification
__
channels
"
)
channels
=
lazy_preference
(
"
notification
"
,
"
channels
"
)
if
isinstance
(
notification
,
int
):
Notification
=
apps
.
get_model
(
"
core
"
,
"
Notification
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment