Do not retry unmute if mute never expires

This commit is contained in:
Henri Dickson 2023-11-26 14:46:31 -05:00 committed by GitHub
parent a58d7ccd8f
commit 6855e74c6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -37,7 +37,7 @@ class BlockStates(StateGraph):
""" """
# Mutes don't send but might need expiry # Mutes don't send but might need expiry
if instance.mute: if instance.mute:
return cls.awaiting_expiry return cls.awaiting_expiry if instance.expires else cls.sent
# Remote blocks should not be here, local blocks just work # Remote blocks should not be here, local blocks just work
if not instance.source.local or instance.target.local: if not instance.source.local or instance.target.local:
return cls.sent return cls.sent
@ -195,7 +195,6 @@ class Block(StatorModel):
raise ValueError("You cannot mute from a remote Identity") raise ValueError("You cannot mute from a remote Identity")
block = cls.maybe_get(source=source, target=target, mute=True) block = cls.maybe_get(source=source, target=target, mute=True)
if block is not None: if block is not None:
if not block.active:
block.state = BlockStates.new # type:ignore block.state = BlockStates.new # type:ignore
if duration: if duration:
block.expires = timezone.now() + datetime.timedelta(seconds=duration) block.expires = timezone.now() + datetime.timedelta(seconds=duration)