verb = _("asked")\r
\r
def process_data(self, **data):\r
- question = Question(author=self.user, **self.create_revision_data(True, **data))\r
+ processed_data = self.create_revision_data(True, **data)\r
+ if 'added_at' in data:\r
+ processed_data['added_at'] = data['added_at']\r
+\r
+ question = Question(author=self.user, **processed_data)\r
question.save()\r
self.node = question\r
\r
\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
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
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
'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
+ 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