~launchpad-pqm/launchpad/devel

« back to all changes in this revision

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

[r=wgrant][ui=huwshimi][bug=878605] We don't want to support
 multi-tenanted private bugs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3555
3555
        else:
3556
3556
            return None
3557
3557
 
 
3558
    @property
 
3559
    def _allow_multipillar_private_bugs(self):
 
3560
        """ Some teams still need to have multi pillar private bugs."""
 
3561
        return bool(getFeatureFlag(
 
3562
            'disclosure.allow_multipillar_private_bugs.enabled'))
 
3563
 
 
3564
    def canAddProjectTask(self):
 
3565
        """Can a new bug task on a project be added to this bug?
 
3566
 
 
3567
        If a bug has any bug tasks already, were it to be private, it cannot
 
3568
        be marked as also affecting any other project, so return False.
 
3569
 
 
3570
        Note: this check is currently only relevant if a bug is private.
 
3571
        Eventually, even public bugs will have this restriction too. So what
 
3572
        happens now is that this API is used by the tales to add a class
 
3573
        called 'disallow-private' to the Also Affects Project link. A css rule
 
3574
        is used to hide the link when body.private is True.
 
3575
 
 
3576
        """
 
3577
        bug = self.context
 
3578
        if self._allow_multipillar_private_bugs:
 
3579
            return True
 
3580
        return len(bug.bugtasks) == 0
 
3581
 
 
3582
    def canAddPackageTask(self):
 
3583
        """Can a new bug task on a src pkg be added to this bug?
 
3584
 
 
3585
        If a bug has any existing bug tasks on a project, were it to
 
3586
        be private, then it cannot be marked as affecting a package,
 
3587
        so return False.
 
3588
 
 
3589
        A task on a given package may still be illegal to add, but
 
3590
        this will be caught when bug.addTask() is attempted.
 
3591
 
 
3592
        Note: this check is currently only relevant if a bug is private.
 
3593
        Eventually, even public bugs will have this restriction too. So what
 
3594
        happens now is that this API is used by the tales to add a class
 
3595
        called 'disallow-private' to the Also Affects Package link. A css rule
 
3596
        is used to hide the link when body.private is True.
 
3597
        """
 
3598
        bug = self.context
 
3599
        if self._allow_multipillar_private_bugs:
 
3600
            return True
 
3601
        for pillar in bug.affected_pillars:
 
3602
            if IProduct.providedBy(pillar):
 
3603
                return False
 
3604
        return True
 
3605
 
3558
3606
 
3559
3607
class BugTaskTableRowView(LaunchpadView, BugTaskBugWatchMixin):
3560
3608
    """Browser class for rendering a bugtask row on the bug page."""