Commits

murarth committed ad79499

Showing comments in messages now follows general behavior regarding removed comments

Comments (0)

Files changed (4)

reddish/model/__init__.py

                 { '_id': self._id, 'last_reply': { '$lt': comment.created } },
                 { '$set': { 'last_reply': comment.created } })
 
-        if self.author and not self.deleted and self.author != comment.author:
+        if self.author and not (self.deleted or comment.hidden) and self.author != comment.author:
             try:
                 user = self.get_author()
                 user.add_message(author, ReplyMessage(other = author._id,
                 Session.update(Comment, { '_id': { '$in': self.parents } },
                     { '$inc': { 'num_replies': 1 } }, multi = True)
 
-        if self.author and not self.deleted and self.author != reply.author:
+        if self.author and not (self.deleted or reply.hidden) and self.author != reply.author:
             try:
                 user = self.get_author()
                 user.add_message(author, ReplyMessage(other = author._id,
 
         return r
 
-mongo.Index(ReplyMessage, 'comment', sparse = True)
+mongo.Index(ReplyMessage, 'comment')
 mongo.Index(ReplyMessage, 'community', sparse = True)

reddish/templates/base.mako

 <script type="text/javascript" src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>
 % endif
 </%def>\
-<%def name="show_comment(comment, parent_rendered = False, can_reply = False)">\
+<%def name="show_comment(comment, parent_rendered = False, can_reply = False, as_message = False)">\
 <%
 hilight = ' hilight' if comment is c.hilight_comment else ''
 is_moderator = c.user and c.user.is_moderator(comment.get_community())
 </%def>\
 <div class="comment" id="c-${comment._id}">
     % if c.cmty is None:
+    %   if as_message:
+    %       if comment.parents:
+    <span class="message-subject">comment reply</span>
+    %       else:
+    <span class="message-subject">post reply</span>
+    %       endif
+    %   endif
     <% post = comment.get_post() %>
     <a href="${post.permalink}">${post.title}</a>
     by <span class="comment-author">${self.author(post.get_author(), post)}</span>
             % if is_moderator and comment.num_reports:
             <a href="${comment.get_community().permalink + '/reports/comment/' + comment._id}"${self.new_window}>${comment.num_reports} reports</a>
             % endif
+            % if as_message:
+            <a href="#" class="mark-unread">mark unread</a>
+            % endif
         </div>
         </div>
 

reddish/templates/community/comments.mako

         <textarea name="text"></textarea><br/>
         <div style="width:500px">
         <div class="right">
-            <a href="#" class="show-help">formatting help</a>
-            <a href="#" class="hide-help" style="display:none">hide help</a>
+            <a href="#" class="show-help" tabindex="99">formatting help</a>
+            <a href="#" class="hide-help" tabindex="99" style="display:none">hide help</a>
         </div>
         </div>
         <input type="submit" value="submit"/>
         <input type="hidden" name="render" value="html"/>
 
         <textarea name="text"></textarea><br/>
+        <div style="width:500px">
+        <div class="right">
+            <a href="#" class="show-help" tabindex="99">formatting help</a>
+            <a href="#" class="hide-help" tabindex="99" style="display:none">hide help</a>
+        </div>
+        </div>
         <input type="submit" value="submit"/>
         <button type="button" class="preview">preview</button>
         <button type="button" class="cancel">cancel</button>
         <a href="#" class="preview-hide">close</a>
         <div class="preview-box md"></div>
     </div>
+
+    ${self.markdown_help()}
 </div>
 % endif
 

reddish/templates/message/base.mako

 cmty = post.get_community()
 %>
 <div class="message${' unread' if msg.unread else '' | n}" id="m-${msg._id}">
-<div class="comment" id="c-${reply._id}">
-    <%self:header>
-        <span class="message-subject">
-            ${'comment' if msg.comment else 'post'} reply
-            <a href="${post.permalink}">${post.title}</a>
-            via <a href="${cmty.permalink}">${cmty.name}</a>
-        </span>
-        <div class="message-header">
-            from ${self.author(msg.get_other(), reply)}
-            sent ${h.ago(reply.created)}
-        </div>
-    </%self:header>
-    <div class="message-body md">
-        ${h.markdown(reply.text)}
-    </div>
-    <div class="link-box">
-        <a href="${url(reply.permalink, context = 3)}">context</a>
-        <a href="#" class="mark-unread">mark unread</a>
-    </div>
-</div>
+${self.show_comment(reply, as_message = True)}
 </div>
 </%def>\
 <%def name="show_sent(msg)">\