diff --git a/app/dashboard/migrations/0111_auto_20181101_1922.py b/app/dashboard/migrations/0111_auto_20181101_1922.py new file mode 100644 index 00000000000..3d21a67dd2b --- /dev/null +++ b/app/dashboard/migrations/0111_auto_20181101_1922.py @@ -0,0 +1,25 @@ +# Generated by Django 2.1.2 on 2018-11-01 19:22 + +from django.db import migrations, models +import django.db.models.deletion + + +class Migration(migrations.Migration): + + dependencies = [ + ('kudos', '0005_auto_20181101_1356'), + ('dashboard', '0110_auto_20181027_1727'), + ] + + operations = [ + migrations.AddField( + model_name='activity', + name='kudos', + field=models.ForeignKey(blank=True, null=True, on_delete=django.db.models.deletion.CASCADE, related_name='activities', to='kudos.KudosTransfer'), + ), + migrations.AlterField( + model_name='activity', + name='activity_type', + field=models.CharField(blank=True, choices=[('new_bounty', 'New Bounty'), ('start_work', 'Work Started'), ('stop_work', 'Work Stopped'), ('work_submitted', 'Work Submitted'), ('work_done', 'Work Done'), ('worker_approved', 'Worker Approved'), ('worker_rejected', 'Worker Rejected'), ('worker_applied', 'Worker Applied'), ('increased_bounty', 'Increased Funding'), ('killed_bounty', 'Canceled Bounty'), ('new_tip', 'New Tip'), ('receive_tip', 'Tip Received'), ('bounty_abandonment_escalation_to_mods', 'Escalated for Abandonment of Bounty'), ('bounty_abandonment_warning', 'Warning for Abandonment of Bounty'), ('bounty_removed_slashed_by_staff', 'Dinged and Removed from Bounty by Staff'), ('bounty_removed_by_staff', 'Removed from Bounty by Staff'), ('bounty_removed_by_funder', 'Removed from Bounty by Funder'), ('new_crowdfund', 'New Crowdfund Contribution'), ('new_kudos', 'New Kudos')], max_length=50), + ), + ] diff --git a/app/dashboard/models.py b/app/dashboard/models.py index 26b76562c84..2dc4d037a9a 100644 --- a/app/dashboard/models.py +++ b/app/dashboard/models.py @@ -1455,6 +1455,7 @@ def i18n_name(self): @property def view_props(self): from dashboard.tokens import token_by_name + from kudos.models import Token icons = { 'new_tip': 'fa-thumbs-up', 'start_work': 'fa-lightbulb', @@ -1465,6 +1466,8 @@ def view_props(self): activity = self activity.icon = icons.get(activity.activity_type, 'fa-check-circle') + if activity.kudos: + activity.kudos_data = Token.objects.get(pk=activity.kudos.kudos_token_cloned_from_id) obj = activity.metadata if 'new_bounty' in activity.metadata: obj = activity.metadata['new_bounty'] diff --git a/app/kudos/views.py b/app/kudos/views.py index 6f707f0f7d9..c86a550c055 100644 --- a/app/kudos/views.py +++ b/app/kudos/views.py @@ -470,7 +470,7 @@ def record_kudos_activity(kudos_transfer, github_handle, event_name): kwargs['bounty'] = kudos_transfer.bounty except: pass - try: + try: Activity.objects.create(**kwargs) except Exception as e: logging.error(f"error in record_kudos_activity: {e} - {event_name} - {kudos_transfer} - {github_handle}") diff --git a/app/retail/templates/shared/activity.html b/app/retail/templates/shared/activity.html index 6f4537a4a79..f972344b869 100644 --- a/app/retail/templates/shared/activity.html +++ b/app/retail/templates/shared/activity.html @@ -20,6 +20,10 @@