Skip to content

Commit

Permalink
Merge pull request #6214 from zoek1/feature/alter-kudos-url
Browse files Browse the repository at this point in the history
Take User to Profile After Clicking See Kudos Notification
  • Loading branch information
thelostone-mc authored Mar 26, 2020
2 parents cc44443 + 90d1439 commit 5567b84
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions app/inbox/signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
from django.contrib.auth import get_user_model
from django.db.models.signals import post_save
from django.dispatch import receiver
from django.urls import reverse

from app.utils import get_profiles_from_text
from dashboard.models import Activity
Expand Down Expand Up @@ -127,14 +128,21 @@ def create_notification(sender, **kwargs):
)

if activity.activity_type == 'new_kudos':
kudos_url = reverse('profile_min', args=[
activity.kudos_transfer.recipient_profile.handle,
'kudos'
])

if activity.kudos_transfer and activity.kudos_transfer.recipient_profile:
send_notification_to_user(
activity.profile.user,
activity.kudos_transfer.recipient_profile.user,
activity.kudos_transfer.receive_url_for_recipient,
'new_kudos',
f'You received a <b>new kudos from {activity.profile.user}</b>'
)
kudos_url = activity.kudos_transfer.receive_url_for_recipient

send_notification_to_user(
activity.profile.user,
activity.kudos_transfer.recipient_profile.user,
kudos_url,
'new_kudos',
f'You received a <b>new kudos from {activity.profile.user}</b>'
)

if activity.activity_type == 'status_update':
text = activity.metadata['title']
Expand Down

0 comments on commit 5567b84

Please sign in to comment.