X-Git-Url: https://git.openstreetmap.org./osqa.git/blobdiff_plain/0ba16baba0615dd405486c7d87f943d71518375c..01eed1521a67afc04a8112b44ca4cd1c4a32cf00:/forum/actions/node.py?ds=inline diff --git a/forum/actions/node.py b/forum/actions/node.py index 5283a8e..dbbb658 100644 --- a/forum/actions/node.py +++ b/forum/actions/node.py @@ -42,7 +42,7 @@ class AnswerAction(NodeEditAction): def describe(self, viewer=None): question = self.node.parent - return _("%(user)s answered %(asker)s %(question)s") % { + return _("%(user)s answered %(asker)s on %(question)s") % { 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)), 'asker': self.hyperlink(question.author.get_profile_url(), self.friendly_username(viewer, question.author)), 'question': self.hyperlink(self.node.get_absolute_url(), question.title) @@ -134,13 +134,14 @@ class CloseAction(ActionProxy): verb = _("closed") def process_action(self): - self.node.extra_action = self self.node.marked = True + self.node.nstate.closed = self + self.node.last_edited = self self.node.update_last_activity(self.user, save=True) def cancel_action(self): - self.node.extra_action = None self.node.marked = False + self.node.nstate.closed = None self.node.update_last_activity(self.user, save=True) def describe(self, viewer=None): @@ -161,7 +162,8 @@ class AnswerToCommentAction(ActionProxy): comment.parent = new_parent comment.save() - self.node.save() + self.node.last_edited = self + self.node.update_last_activity(self.user, save=True) try: self.node.abs_parent.reset_answer_count_cache() except AttributeError: @@ -173,3 +175,21 @@ class AnswerToCommentAction(ActionProxy): 'question': self.describe_node(viewer, self.node.abs_parent), } +class WikifyAction(ActionProxy): + verb = _("wikified") + + def process_action(self): + self.node.nstate.wiki = self + self.node.last_edited = self + self.node.update_last_activity(self.user, save=True) + + def cancel_action(self): + self.node.nstate.wiki = None + self.node.update_last_activity(self.user, save=True) + + def describe(self, viewer=None): + return _("%(user)s marked %(node)s as community wiki.") % { + 'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)), + 'node': self.describe_node(viewer, self.node), + } +