Skip to content

Commit

Permalink
Merge pull request #8490 from OpenMined/feature/turn_off_notifier
Browse files Browse the repository at this point in the history
5 - ADD Notifier turn off service
  • Loading branch information
IonesioJunior authored Feb 15, 2024
2 parents 2bace8b + 69ef589 commit 8046670
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions packages/syft/src/syft/service/notifier/notifier_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,17 @@ def turn_off(
self,
context: AuthedServiceContext,
) -> Union[SyftSuccess, SyftError]:
return SyftError(message="Not Implemented")
# Set Notifier Model active field to False
# Store the current state of the notifier in the stash
result = self.stash.get(credentials=context.credentials)

if result.is_err():
return SyftError(message=result.err())

notifier = result.ok()
notifier.active = False
result = self.stash.update(credentials=context.credentials, settings=notifier)
if result.is_err():
return SyftError(message=result.err())
return SyftSuccess(message="Notifier turned off")

@service_method(
path="notifier.enable_notifications",
Expand Down

0 comments on commit 8046670

Please sign in to comment.