-
Notifications
You must be signed in to change notification settings - Fork 633
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #8438 from jamalex/dont_sync_the_messenger
First pass at regression test and fix for SoUD FacilityUser sync conflict
- Loading branch information
Showing
4 changed files
with
120 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from kolibri.core.auth.hooks import FacilityDataSyncHook | ||
from kolibri.core.auth.models import FacilityUser | ||
from kolibri.plugins.hooks import register_hook | ||
|
||
|
||
@register_hook | ||
class SingleFacilityUserChangeClearingHook(FacilityDataSyncHook): | ||
def pre_transfer( | ||
self, | ||
dataset_id, | ||
local_is_single_user, | ||
remote_is_single_user, | ||
single_user_id, | ||
context, | ||
): | ||
|
||
# If this is a single-user device, make sure we ignore any changes | ||
# that have been made to FacilityUsers, to avoid conflicts. | ||
if local_is_single_user and single_user_id is not None: | ||
try: | ||
user = FacilityUser.objects.get( | ||
id=single_user_id, _morango_dirty_bit=True | ||
) | ||
user.save(update_dirty_bit_to=False) | ||
except FacilityUser.DoesNotExist: | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters