From 4b24b887c7004739ef0e7cc7e29c00d46fadc283 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Tue, 1 Sep 2015 11:53:30 +0100 Subject: [PATCH 1/5] Document m.room.history_visibility --- specification/47_history_visibility.rst | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 specification/47_history_visibility.rst diff --git a/specification/47_history_visibility.rst b/specification/47_history_visibility.rst new file mode 100644 index 00000000..d1c1f0d3 --- /dev/null +++ b/specification/47_history_visibility.rst @@ -0,0 +1,25 @@ +Room History Visibility +======================= + +The visibility of events to users before they joined can be controlled by the +``m.room.history_visibility`` state event. + +More specifically, the string value of the content key ``history_visibility`` +controls the visibility of events. The valid values are: + +- ``shared`` +- ``invited`` +- ``joined`` + +By default, ``history_visibility`` is set to ``shared``. + +The rules governing whether a user is allowed to see an event depend solely on +the state at that event: + +1. If the user was joined, allow. +2. If the user was invited and the ``history_visibility`` was set to + ``invited`` or ``shared``, allow. +3. If the user was neither invited nor joined but the ``history_visibility`` + was set to ``shared``, allow. +4. Otherwise, deny. + From 80bb51d9bbf752550ff5f930fbf0787ebddad4d9 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 4 Sep 2015 11:21:14 +0100 Subject: [PATCH 2/5] Make it clearer --- specification/47_history_visibility.rst | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/specification/47_history_visibility.rst b/specification/47_history_visibility.rst index d1c1f0d3..b1630f1e 100644 --- a/specification/47_history_visibility.rst +++ b/specification/47_history_visibility.rst @@ -1,20 +1,19 @@ Room History Visibility ======================= -The visibility of events to users before they joined can be controlled by the -``m.room.history_visibility`` state event. - -More specifically, the string value of the content key ``history_visibility`` -controls the visibility of events. The valid values are: +Whether a member of a room can see the events that happened in a room from +before they joined the room is controlled by the ``history_visibility`` key +of the ``m.room.history_visibility`` state event. The valid values for +``history_visibility`` are: - ``shared`` - ``invited`` - ``joined`` -By default, ``history_visibility`` is set to ``shared``. +By default if no ``history_visibility`` is set it is assumed to be ``shared``. The rules governing whether a user is allowed to see an event depend solely on -the state at that event: +the state of the room at that event: 1. If the user was joined, allow. 2. If the user was invited and the ``history_visibility`` was set to From c6d143447b5112265741613e9af3571a6b840ca1 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 4 Sep 2015 13:27:01 +0100 Subject: [PATCH 3/5] Add schemas --- .../examples/v1/m.room.history_visibility | 12 +++++++ .../schema/v1/m.room.history_visibility | 31 +++++++++++++++++++ 2 files changed, 43 insertions(+) create mode 100644 event-schemas/examples/v1/m.room.history_visibility create mode 100644 event-schemas/schema/v1/m.room.history_visibility diff --git a/event-schemas/examples/v1/m.room.history_visibility b/event-schemas/examples/v1/m.room.history_visibility new file mode 100644 index 00000000..ad1ea9ae --- /dev/null +++ b/event-schemas/examples/v1/m.room.history_visibility @@ -0,0 +1,12 @@ +{ + "age": 242352, + "content": { + "history_visibility": "shared" + }, + "state_key": "localhost", + "origin_server_ts": 1431961217939, + "event_id": "$WLGTSEFSEF:localhost", + "type": "m.room.history_visibility", + "room_id": "!Cuyf34gef24t:localhost", + "user_id": "@example:localhost" +} diff --git a/event-schemas/schema/v1/m.room.history_visibility b/event-schemas/schema/v1/m.room.history_visibility new file mode 100644 index 00000000..58cd7e7a --- /dev/null +++ b/event-schemas/schema/v1/m.room.history_visibility @@ -0,0 +1,31 @@ + + "$schema": "http://json-schema.org/draft-04/schema#", + "type": "object", + "title": "Controls visibility of history.", + "description": "This event controls whether a member of a room can see the events that happened in a room from before they joined.", + "allOf": [{ + "$ref": "core#/definitions/state_event" + }], + "properties": { + "content": { + "type": "object", + "properties": { + "history_visibility": { + "type": "string", + "description": "Who can see the room history.", + "enum": ["invited","joined","shared"] + } + }, + "required": ["history_visibility"] + }, + "state_key": { + "type": "string", + "description": "A zero-length string.", + "pattern": "^$" + }, + "type": { + "type": "string", + "enum": ["m.room.history_visibility"] + } + } +} From 1e3d9a6a503f576ecbd01d5dda29eefd4030bc2a Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 4 Sep 2015 13:30:11 +0100 Subject: [PATCH 4/5] Typo --- event-schemas/schema/v1/m.room.history_visibility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event-schemas/schema/v1/m.room.history_visibility b/event-schemas/schema/v1/m.room.history_visibility index 58cd7e7a..07bd39ff 100644 --- a/event-schemas/schema/v1/m.room.history_visibility +++ b/event-schemas/schema/v1/m.room.history_visibility @@ -1,4 +1,4 @@ - +{ "$schema": "http://json-schema.org/draft-04/schema#", "type": "object", "title": "Controls visibility of history.", From b4c2cba4062003c2e915e8249571d5ac1f4e69b2 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Fri, 4 Sep 2015 13:31:51 +0100 Subject: [PATCH 5/5] State key should be empty --- event-schemas/examples/v1/m.room.history_visibility | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/event-schemas/examples/v1/m.room.history_visibility b/event-schemas/examples/v1/m.room.history_visibility index ad1ea9ae..fcc3f881 100644 --- a/event-schemas/examples/v1/m.room.history_visibility +++ b/event-schemas/examples/v1/m.room.history_visibility @@ -3,7 +3,7 @@ "content": { "history_visibility": "shared" }, - "state_key": "localhost", + "state_key": "", "origin_server_ts": 1431961217939, "event_id": "$WLGTSEFSEF:localhost", "type": "m.room.history_visibility",