Skip to content

Commit

Permalink
fix(add-ons): fix filtering project-wide installed repo scope add-ons
Browse files Browse the repository at this point in the history
  • Loading branch information
nijel committed May 3, 2024
1 parent cb63e8e commit 0f4618c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions weblate/addons/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,15 @@

class AddonQuerySet(models.QuerySet):
def filter_for_execution(self, component):
return self.prefetch_related("event_set").filter(
query = (
Q(component=component)
| Q(project=component.project)
| (Q(component__linked_component=component) & Q(repo_scope=True))
| (Q(component=component.linked_component) & Q(repo_scope=True))
| (Q(component__isnull=True) & Q(project__isnull=True))
)
if component.linked_component:
query |= Q(component=component.linked_component) & Q(repo_scope=True)
return self.filter(query).prefetch_related("event_set")

def filter_component(self, component):
return self.prefetch_related("event_set").filter(component=component)
Expand Down

0 comments on commit 0f4618c

Please sign in to comment.