]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/actions/user.py
Fixes a bug happening when processing an user reputation more than once in the same...
[osqa.git] / forum / actions / user.py
index 19dfa5efb0b25d9a070edc8e05d27aee0e432802..6c174cee2e92ed989feee691931b69115f702e28 100644 (file)
@@ -1,14 +1,19 @@
 from django.utils.translation import ugettext as _
 from django.db.models import F
 from forum.models.action import ActionProxy
-from forum.models import Award, Badge
+from forum.models import Award, Badge, ValidationHash
 from forum import settings
 from forum.settings import APP_SHORT_NAME
+from forum.utils.mail import send_email, send_template_email
 
 class UserJoinsAction(ActionProxy):
     def repute_users(self):
         self.repute(self.user, int(settings.INITIAL_REP))
 
+    def process_action(self):
+        hash = ValidationHash.objects.create_new(self.user, 'email', [self.user.email])
+        send_template_email([self.user], "auth/email_validation.html", {'validation_code': hash})
+
     def describe(self, viewer=None):
         return _("%(user)s as joined the %(app_name)s Q&A community") % {
             'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),
@@ -64,7 +69,7 @@ class AwardAction(ActionProxy):
         if award.badge.type == Badge.SILVER:
             self.user.silver += 1
         if award.badge.type == Badge.BRONZE:
-            self.user.silver += 1
+            self.user.bronze += 1
 
         self.user.save()