diff options
author | Erik Johnston <erik@matrix.org> | 2017-10-27 15:07:08 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-10-27 15:07:08 +0100 |
commit | 4ab8abbc2b7376f1fad8b69f05f129a0438d8d20 (patch) | |
tree | 692f839a218353f3e1a0263c12ea08a5c7be0019 /synapse/groups/attestations.py | |
parent | Merge pull request #2595 from matrix-org/erikj/attestation_commnet (diff) | |
parent | Import logger (diff) | |
download | synapse-4ab8abbc2b7376f1fad8b69f05f129a0438d8d20.tar.xz |
Merge branch 'erikj/attestation_local_fix' of github.com:matrix-org/synapse into develop
Diffstat (limited to 'synapse/groups/attestations.py')
-rw-r--r-- | synapse/groups/attestations.py | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/synapse/groups/attestations.py b/synapse/groups/attestations.py index c52e020989..28bbff9bbb 100644 --- a/synapse/groups/attestations.py +++ b/synapse/groups/attestations.py @@ -35,6 +35,8 @@ An attestsation is a signed blob of json that looks like: } """ +import logging + from twisted.internet import defer from synapse.api.errors import SynapseError @@ -44,6 +46,9 @@ from synapse.util.logcontext import preserve_fn from signedjson.sign import sign_json +logger = logging.getLogger(__name__) + + # Default validity duration for new attestations we create DEFAULT_ATTESTATION_LENGTH_MS = 3 * 24 * 60 * 60 * 1000 @@ -150,12 +155,19 @@ class GroupAttestionRenewer(object): @defer.inlineCallbacks def _renew_attestation(group_id, user_id): - attestation = self.attestations.create_attestation(group_id, user_id) - - if self.is_mine_id(group_id): + if not self.is_mine_id(group_id): + destination = get_domain_from_id(group_id) + elif not self.is_mine_id(user_id): destination = get_domain_from_id(user_id) else: - destination = get_domain_from_id(group_id) + logger.warn( + "Incorrectly trying to do attestations for user: %r in %r", + user_id, group_id, + ) + yield self.store.remove_attestation_renewal(group_id, user_id) + return + + attestation = self.attestations.create_attestation(group_id, user_id) yield self.transport_client.renew_group_attestation( destination, group_id, user_id, |