]> git.openstreetmap.org Git - osqa.git/blobdiff - forum/models/comment.py
Removed an unnecessary link to feedback. It was causing an exception, apparently...
[osqa.git] / forum / models / comment.py
index 2bf2824906f2370aa14eded1799b29ae23ecefc1..a70d4749f762a366a20b0a428c7498ad8f8f6db9 100644 (file)
@@ -1,7 +1,10 @@
 from base import *\r
+from django.utils.translation import ugettext as _\r
 import re\r
 \r
 class Comment(Node):\r
+    friendly_name = _("comment")\r
+\r
     class Meta(Node.Meta):\r
         ordering = ('-added_at',)\r
         proxy = True\r
@@ -13,7 +16,14 @@ class Comment(Node):
 \r
     @property\r
     def comment(self):\r
-        return self.body\r
+        if settings.FORM_ALLOW_MARKDOWN_IN_COMMENTS:\r
+            return self.as_markdown('limitedsyntax')\r
+        else:\r
+            return self.body\r
+\r
+    @property\r
+    def headline(self):\r
+        return self.absolute_parent.headline\r
 \r
     @property\r
     def content_object(self):\r
@@ -22,21 +32,16 @@ class Comment(Node):
     def save(self, *args, **kwargs):\r
         super(Comment,self).save(*args, **kwargs)\r
 \r
-        if self._is_new:\r
-            self._update_parent_comment_count(1)\r
-\r
-        try:\r
-            ping_google()\r
-        except Exception:\r
-            logging.debug('problem pinging google did you register you sitemap with google?')\r
+        if not self.id:\r
+            self.parent.reset_comment_count_cache()\r
 \r
     def mark_deleted(self, user):\r
         if super(Comment, self).mark_deleted(user):\r
-            self._update_parent_comment_count(-1)\r
+            self.parent.reset_comment_count_cache()\r
 \r
     def unmark_deleted(self):\r
         if super(Comment, self).unmark_deleted():\r
-            self._update_parent_comment_count(1)\r
+            self.parent.reset_comment_count_cache()\r
 \r
     def is_reply_to(self, user):\r
         inreply = re.search('@\w+', self.body)\r