mirror of
https://github.com/element-hq/synapse.git
synced 2024-11-26 19:47:05 +03:00
Fix bug where we changes in outlier in metadata dict propogated to other events
This commit is contained in:
parent
78015948a7
commit
c1c7b39827
3 changed files with 8 additions and 4 deletions
|
@ -18,7 +18,7 @@ from synapse.util.frozenutils import freeze, unfreeze
|
||||||
|
|
||||||
class _EventInternalMetadata(object):
|
class _EventInternalMetadata(object):
|
||||||
def __init__(self, internal_metadata_dict):
|
def __init__(self, internal_metadata_dict):
|
||||||
self.__dict__ = internal_metadata_dict
|
self.__dict__ = dict(internal_metadata_dict)
|
||||||
|
|
||||||
def get_dict(self):
|
def get_dict(self):
|
||||||
return dict(self.__dict__)
|
return dict(self.__dict__)
|
||||||
|
|
|
@ -23,14 +23,15 @@ import copy
|
||||||
|
|
||||||
|
|
||||||
class EventBuilder(EventBase):
|
class EventBuilder(EventBase):
|
||||||
def __init__(self, key_values={}):
|
def __init__(self, key_values={}, internal_metadata_dict={}):
|
||||||
signatures = copy.deepcopy(key_values.pop("signatures", {}))
|
signatures = copy.deepcopy(key_values.pop("signatures", {}))
|
||||||
unsigned = copy.deepcopy(key_values.pop("unsigned", {}))
|
unsigned = copy.deepcopy(key_values.pop("unsigned", {}))
|
||||||
|
|
||||||
super(EventBuilder, self).__init__(
|
super(EventBuilder, self).__init__(
|
||||||
key_values,
|
key_values,
|
||||||
signatures=signatures,
|
signatures=signatures,
|
||||||
unsigned=unsigned
|
unsigned=unsigned,
|
||||||
|
internal_metadata_dict=internal_metadata_dict,
|
||||||
)
|
)
|
||||||
|
|
||||||
def build(self):
|
def build(self):
|
||||||
|
|
|
@ -88,7 +88,10 @@ def prune_event(event):
|
||||||
if "age_ts" in event.unsigned:
|
if "age_ts" in event.unsigned:
|
||||||
allowed_fields["unsigned"]["age_ts"] = event.unsigned["age_ts"]
|
allowed_fields["unsigned"]["age_ts"] = event.unsigned["age_ts"]
|
||||||
|
|
||||||
return type(event)(allowed_fields)
|
return type(event)(
|
||||||
|
allowed_fields,
|
||||||
|
internal_metadata_dict=event.internal_metadata.get_dict()
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def serialize_event(hs, e, client_event=True):
|
def serialize_event(hs, e, client_event=True):
|
||||||
|
|
Loading…
Reference in a new issue