You've already forked matrix-js-sdk
mirror of
https://github.com/matrix-org/matrix-js-sdk.git
synced 2025-08-09 10:22:46 +03:00
Update event redaction to keep sender and origin_server_ts
Required for fixing https://github.com/matrix-org/matrix-js-sdk/issues/387
This commit is contained in:
@@ -406,31 +406,18 @@ utils.extend(module.exports.MatrixEvent.prototype, {
|
|||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
/* http://matrix.org/docs/spec/r0.0.1/client_server.html#redactions says:
|
/* _REDACT_KEEP_KEY_MAP gives the keys we keep when an event is redacted
|
||||||
*
|
*
|
||||||
* the server should strip off any keys not in the following list:
|
* This is specified here:
|
||||||
* event_id
|
* http://matrix.org/speculator/spec/HEAD/client_server/unstable.html#redactions
|
||||||
* type
|
|
||||||
* room_id
|
|
||||||
* user_id
|
|
||||||
* state_key
|
|
||||||
* prev_state
|
|
||||||
* content
|
|
||||||
* [we keep 'unsigned' as well, since that is created by the local server]
|
|
||||||
*
|
*
|
||||||
* The content object should also be stripped of all keys, unless it is one of
|
* Also:
|
||||||
* one of the following event types:
|
* - We keep 'unsigned' since that is created by the local server
|
||||||
* m.room.member allows key membership
|
* - We keep user_id for backwards-compat with v1
|
||||||
* m.room.create allows key creator
|
|
||||||
* m.room.join_rules allows key join_rule
|
|
||||||
* m.room.power_levels allows keys ban, events, events_default, kick,
|
|
||||||
* redact, state_default, users, users_default.
|
|
||||||
* m.room.aliases allows key aliases
|
|
||||||
*/
|
*/
|
||||||
// a map giving the keys we keep when an event is redacted
|
|
||||||
const _REDACT_KEEP_KEY_MAP = [
|
const _REDACT_KEEP_KEY_MAP = [
|
||||||
'event_id', 'type', 'room_id', 'user_id', 'state_key', 'prev_state',
|
'event_id', 'type', 'room_id', 'user_id', 'sender', 'state_key', 'prev_state',
|
||||||
'content', 'unsigned',
|
'content', 'unsigned', 'origin_server_ts',
|
||||||
].reduce(function(ret, val) {
|
].reduce(function(ret, val) {
|
||||||
ret[val] = 1; return ret;
|
ret[val] = 1; return ret;
|
||||||
}, {});
|
}, {});
|
||||||
|
Reference in New Issue
Block a user