Skip to content

Commit

Permalink
fix(component): fix updating revision info in database
Browse files Browse the repository at this point in the history
The linked components were updated only upon commit and not on update
making it likely that some updates will not be parsed.

Fixes #12275
Fixes #12365
  • Loading branch information
nijel committed Sep 2, 2024
1 parent e8e1a56 commit 8a8cc7c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
2 changes: 2 additions & 0 deletions docs/changes.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Not yet released.

**Bug fixes**

* Updating of translations from the repository in linked components.

**Compatibility**

**Upgrading**
Expand Down
7 changes: 4 additions & 3 deletions weblate/trans/models/component.py
Original file line number Diff line number Diff line change
Expand Up @@ -2026,10 +2026,11 @@ def reuse_self(translation):
):
translation.store_hash()

self.store_local_revision()

# Fire postponed post commit signals
for component in components.values():
component.send_post_commit_signal()
component.store_local_revision()
component.update_import_alerts(delete=False)

# Push if enabled
Expand Down Expand Up @@ -2131,8 +2132,8 @@ def store_local_revision(self) -> None:
self.local_revision = self.repository.last_revision
# Avoid using using save as that does complex things and we
# just want to update the database
Component.objects.filter(pk=self.pk).update(
local_revision=self.repository.last_revision
Component.objects.filter(Q(pk=self.pk) | Q(linked_component=self)).update(
local_revision=self.local_revision
)

@perform_on_link
Expand Down

0 comments on commit 8a8cc7c

Please sign in to comment.