flag.save()\r
self.node.reset_flag_count_cache()\r
\r
- if self.node.flag_count == int(settings.FLAG_COUNT_TO_HIDE_POST):\r
+ if self.node.flag_count >= int(settings.FLAG_COUNT_TO_HIDE_POST):\r
self.repute(self.node.author, -int(settings.REP_LOST_BY_FLAGGED_3_TIMES))\r
\r
- if self.node.flag_count == int(settings.FLAG_COUNT_TO_DELETE_POST):\r
+ if self.node.flag_count >= int(settings.FLAG_COUNT_TO_DELETE_POST):\r
self.repute(self.node.author, -int(settings.REP_LOST_BY_FLAGGED_5_TIMES))\r
- if not self.node.deleted:\r
+ if not self.node.nis.deleted:\r
DeleteAction(node=self.node, user=self.user, extra="BYFLAGGED").save()\r
\r
def cancel_action(self):\r
self.repute(self.node.author, int(settings.REP_GAIN_BY_ACCEPTED))\r
\r
def process_action(self):\r
- self.node.parent.extra_ref = self.node\r
- self.node.parent.save()\r
self.node.marked = True\r
- self.node.extra_action = self\r
+ self.node.nstate.accepted = self\r
self.node.save()\r
+ self.node.question.reset_accepted_count_cache()\r
\r
def cancel_action(self):\r
- self.node.parent.extra_ref = None\r
- self.node.parent.save()\r
self.node.marked = False\r
- self.node.extra_action = None\r
+ self.node.nstate.accepted = None\r
self.node.save()\r
+ self.node.question.reset_accepted_count_cache()\r
\r
def describe(self, viewer=None):\r
answer = self.node\r
\r
return _("%(user)s accepted %(answerer)s answer on %(asker)s question %(question)s") % {\r
'user': self.hyperlink(self.user.get_profile_url(), self.friendly_username(viewer, self.user)),\r
- 'answerer': self.hyperlink(answer.author.get_profile_url(), self.friendly_username(viewer, answer.author)),\r
+ 'answerer': self.hyperlink(answer.author.get_profile_url(), self.friendly_ownername(viewer, answer.author)),\r
'asker': asker,\r
'question': self.hyperlink(question.get_absolute_url(), question.title)\r
}\r