]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/actions/node.py
Fixes OSQA 317, Wrong links in the user profile in the new notification email, and...
[osqa.git] / forum / actions / node.py
index 5283a8e98587feff199b64a2eed8c343e775dcf1..dbbb6589107e1a11566da5f25a6c58f3e7cae2da 100644 (file)
@@ -42,7 +42,7 @@ class AnswerAction(NodeEditAction):
 \r
     def describe(self, viewer=None):\r
         question = self.node.parent\r
-        return _("%(user)s answered %(asker)s %(question)s") % {\r
+        return _("%(user)s answered %(asker)s on %(question)s") % {\r
             'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),\r
             'asker': self.hyperlink(question.author.get_profile_url(), self.friendly_username(viewer, question.author)),\r
             'question': self.hyperlink(self.node.get_absolute_url(), question.title)\r
@@ -134,13 +134,14 @@ class CloseAction(ActionProxy):
     verb = _("closed")\r
 \r
     def process_action(self):\r
-        self.node.extra_action = self\r
         self.node.marked = True\r
+        self.node.nstate.closed = self\r
+        self.node.last_edited = self\r
         self.node.update_last_activity(self.user, save=True)\r
 \r
     def cancel_action(self):\r
-        self.node.extra_action = None\r
         self.node.marked = False\r
+        self.node.nstate.closed = None\r
         self.node.update_last_activity(self.user, save=True)\r
 \r
     def describe(self, viewer=None):\r
@@ -161,7 +162,8 @@ class AnswerToCommentAction(ActionProxy):
             comment.parent = new_parent\r
             comment.save()\r
 \r
-        self.node.save()\r
+        self.node.last_edited = self\r
+        self.node.update_last_activity(self.user, save=True)\r
         try:\r
             self.node.abs_parent.reset_answer_count_cache()\r
         except AttributeError:\r
@@ -173,3 +175,21 @@ class AnswerToCommentAction(ActionProxy):
             'question': self.describe_node(viewer, self.node.abs_parent),\r
         }\r
 \r
+class WikifyAction(ActionProxy):\r
+    verb = _("wikified")\r
+\r
+    def process_action(self):\r
+        self.node.nstate.wiki = self\r
+        self.node.last_edited = self\r
+        self.node.update_last_activity(self.user, save=True)\r
+\r
+    def cancel_action(self):\r
+        self.node.nstate.wiki = None\r
+        self.node.update_last_activity(self.user, save=True)\r
+\r
+    def describe(self, viewer=None):\r
+        return _("%(user)s marked %(node)s as community wiki.") % {\r
+            'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),\r
+            'node': self.describe_node(viewer, self.node),\r
+        }\r
+\r