]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/actions/node.py
Tags name is included into their classname. Just like on stackoverflow. Jira OSQA...
[osqa.git] / forum / actions / node.py
index 50e4ef13060ff5eb9064537d2a1c679c6f952dae..05d89eca09db4553c5327c8b0bbcc0f55db9389a 100644 (file)
@@ -179,6 +179,27 @@ class AnswerToCommentAction(ActionProxy):
             'question': self.describe_node(viewer, self.node.abs_parent),\r
         }\r
 \r
+class AnswerToQuestionAction(ActionProxy):\r
+    verb = _("converted to question")\r
+\r
+    def process_data(self, title):\r
+        self.node.node_type = "question"\r
+        self.node.title = title\r
+        self.node.last_edited = self\r
+        self.node.update_last_activity(self.user, save=True)\r
+\r
+        try:\r
+            self.node.abs_parent.reset_answer_count_cache()\r
+        except AttributeError:\r
+            pass\r
+\r
+\r
+    def describe(self, viewer=None):\r
+        return _("%(user)s converted an answer to %(question)s into a separate question") % {\r
+            'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),\r
+            'question': self.describe_node(viewer, self.node.abs_parent),\r
+        }\r
+\r
 class WikifyAction(ActionProxy):\r
     verb = _("wikified")\r
 \r