[notifications] Fix a few typos
This commit is contained in:
@ -3,6 +3,7 @@ import requests
|
||||
|
||||
from django.conf import settings
|
||||
from django.contrib.sites.models import Site
|
||||
from django.urls import reverse
|
||||
|
||||
class BasicNtfyNotification(ABC):
|
||||
ntfy_headers: dict = {}
|
||||
@ -10,7 +11,7 @@ class BasicNtfyNotification(ABC):
|
||||
title: str = ""
|
||||
|
||||
def __init__(self, profile: "UserProfile"):
|
||||
self.user = profile.user
|
||||
self.profile = profile.user
|
||||
protocol = "http" if settings.DEBUG else "https"
|
||||
domain = Site.objects.get_current().domain
|
||||
self.url_tmpl = f'{protocol}://{domain}' + '{path}'
|
||||
@ -69,8 +70,7 @@ class ScrobbleNtfyNotification(ScrobbleNotification):
|
||||
|
||||
class MoodNtfyNotification(BasicNtfyNotification):
|
||||
def __init__(self, profile, **kwargs):
|
||||
super().__init__(scrobble)
|
||||
self.profile = profile
|
||||
super().__init__(profile)
|
||||
self.ntfy_str: str = "Would you like to check in about your mood?"
|
||||
self.click_url = self.url_tmpl.format(path=reverse("moods:mood-list"))
|
||||
self.title = "Mood Check-in!"
|
||||
@ -82,7 +82,7 @@ class MoodNtfyNotification(BasicNtfyNotification):
|
||||
and self.profile.ntfy_url
|
||||
):
|
||||
requests.post(
|
||||
self.user.profile.ntfy_url,
|
||||
self.profile.ntfy_url,
|
||||
data=self.ntfy_str.encode(encoding="utf-8"),
|
||||
headers={
|
||||
"Title": self.title,
|
||||
|
||||
@ -330,7 +330,7 @@ def send_mood_checkin_reminders() -> int:
|
||||
now = timezone.now()
|
||||
notifications_sent = 0
|
||||
for profile in UserProfile.objects.filter(mood_checkin_enabled=True):
|
||||
if profile.mood_checkin_period == "hourly" and now.minute == 0:
|
||||
if profile.mood_checkin_frequency == "hourly" and now.minute == 0:
|
||||
MoodNtfyNotification(profile).send()
|
||||
notifications_sent += 1
|
||||
|
||||
|
||||
Reference in New Issue
Block a user