~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/bugs/browser/bugtask.py

[r=sinzui][bug=885672] Allow users in project roles and the comment
 owner to hide/unhide bug comments.

Show diffs side-by-side

added added

removed removed

Lines of Context:
332
332
 
333
333
 
334
334
def get_comments_for_bugtask(bugtask, truncate=False, for_display=False,
335
 
    slice_info=None, show_spam_controls=False):
 
335
    slice_info=None, show_spam_controls=False, user=None):
336
336
    """Return BugComments related to a bugtask.
337
337
 
338
338
    This code builds a sorted list of BugComments in one shot,
345
345
        to retrieve.
346
346
    """
347
347
    comments = build_comments_from_chunks(bugtask, truncate=truncate,
348
 
        slice_info=slice_info, show_spam_controls=show_spam_controls)
 
348
        slice_info=slice_info, show_spam_controls=show_spam_controls,
 
349
        user=user)
349
350
    # TODO: further fat can be shaved off here by limiting the attachments we
350
351
    # query to those that slice_info would include.
351
352
    for attachment in bugtask.bug.attachments_unpopulated:
752
753
        return self._getComments()
753
754
 
754
755
    def _getComments(self, slice_info=None):
755
 
        show_spam_controls = check_permission(
756
 
            'launchpad.Admin', self.context.bug)
 
756
        bug = self.context.bug
 
757
        show_spam_controls = bug.userCanSetCommentVisibility(self.user)
757
758
        return get_comments_for_bugtask(
758
759
            self.context, truncate=True, slice_info=slice_info,
759
 
            for_display=True, show_spam_controls=show_spam_controls)
 
760
            for_display=True, show_spam_controls=show_spam_controls,
 
761
            user=self.user)
760
762
 
761
763
    @cachedproperty
762
764
    def interesting_activity(self):