Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Allow guest access to /sync #455

Merged
merged 9 commits into from
Dec 22, 2015
Merged

Allow guest access to /sync #455

merged 9 commits into from
Dec 22, 2015

Conversation

NegativeMjark
Copy link
Contributor

Tested by matrix-org/sytest#122

TODO:

  • Allow access to read-receipts and typing notifications to guest users.

EventTypes.RoomHistoryVisibility
)
if state and "history_visibility" in state.content:
defer.returnValue(state.content["history_visibility"] == "world_readable")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

http://matrix.org/docs/spec/r0.0.0/client_server.html#redactions makes no mention of history_visibility being a preserved key in the event of a redacted m.room.history_visibility event. This will throw if the event is redacted.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this will throw because we check if the history_visibility is in the content before accessing it.
This the same check as used for /events FWIW

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

My bad; completely didn't see that you are indeed checking. Sorry!

@@ -118,8 +120,14 @@ def on_GET(self, request):
except:
filter = FilterCollection({})

if is_guest and filter.list_rooms() is None:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like filter.list_rooms() will return None iff there is no rooms key but there is no 0-length array check. We should probably guard against { "rooms": [] } as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does it matter? I'm not sure if passing an empty list of rooms is invalid or not here.

if "rooms" in self.filter_json:
return list(set(self.filter_json["rooms"]))
else:
return None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't do None checks in a ton of places in this PR which call list_rooms(). Either do the null-guards or make non-existence return an empty list, else this is too error-prone IMO.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We check that the list is non-None before calling into these handlers. I'd rather have a hard error here than a default.

@kegsay kegsay assigned NegativeMjark and unassigned kegsay Dec 22, 2015
@kegsay
Copy link
Member

kegsay commented Dec 22, 2015

Other than these points, LGTM though I don't have the full context to be confident on these changes.

@kegsay
Copy link
Member

kegsay commented Dec 22, 2015

Okay, LGTM

NegativeMjark added a commit that referenced this pull request Dec 22, 2015
@NegativeMjark NegativeMjark merged commit 7df276d into develop Dec 22, 2015
@erikjohnston erikjohnston deleted the markjh/guest_access branch January 12, 2016 16:52
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants