~launchpad-pqm/launchpad/devel

« back to all changes in this revision

Viewing changes to lib/lp/registry/browser/distroseriesdifference.py

  • Committer: Julian Edwards
  • Date: 2011-05-23 15:43:28 UTC
  • mto: (7675.1045.412 db-devel)
  • mto: This revision was merged to the branch mainline in revision 13163.
  • Revision ID: julian.edwards@canonical.com-20110523154328-ww2rfmmc6emup7u9
Only show blacklist radio button widget to archive admins.

Show diffs side-by-side

added added

removed removed

Lines of Context:
52
52
    IComment,
53
53
    IConversation,
54
54
    )
 
55
from lp.services.propertycache import cachedproperty
55
56
 
56
57
 
57
58
class DistroSeriesDifferenceNavigation(Navigation):
148
149
            DistroSeriesDifferenceDisplayComment(comment) for
149
150
                comment in comments]
150
151
 
151
 
    @property
 
152
    @cachedproperty
152
153
    def can_request_diffs(self):
153
154
        """Does the user have permission to request diff calculation?"""
154
155
        return check_permission('launchpad.Edit', self.context)
155
156
 
156
 
    @property
157
 
    def show_edit_options(self):
158
 
        """Only show the options if an editor requests via JS."""
 
157
    @cachedproperty
 
158
    def show_add_comment(self):
 
159
        """Only show the 'Add comment' if an editor requests via JS."""
159
160
        return self.request.is_ajax and self.can_request_diffs
160
161
 
 
162
    @cachedproperty
 
163
    def show_blacklist_options(self):
 
164
        """Should we show the blacklisting (ignore) radio widget options.
 
165
 
 
166
        Only show the options if an editor requests via JS and the user
 
167
        is an archive admin.
 
168
        """
 
169
        if not self.request.is_ajax:
 
170
            return False
 
171
 
 
172
        # Archive admin is done by component, so here we just see if the
 
173
        # user has that permission on any components at all.
 
174
        archive = self.context.derived_series.main_archive
 
175
        return bool(archive.getComponentsForQueueAdmin(self.user))
 
176
 
161
177
    @property
162
178
    def display_diffs(self):
163
179
        """Only show diffs if there's a base version."""