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

Scalar Messaging: Expose join_rules and restrict to currently viewed room #443

Merged
merged 11 commits into from
Sep 9, 2016

Conversation

lukebarnard1
Copy link
Contributor

The post message API now:

  • exposes a way of getting the join rules for a room (which must be public in some cases);
  • returns an error if the room_id specified is not the one of the room currently being views.

(@kegsay, I'm hoping you know how one could test this...)

@matrixbot
Copy link
Member

Can one of the admins verify this patch?

@kegsay
Copy link
Member

kegsay commented Sep 5, 2016

ok to test

@@ -193,12 +194,16 @@ function getMembershipState(event, roomId, userId) {
returnStateEvent(event, roomId, "m.room.member", userId);
}

function getJoinRules(event, roomId) {
console.log(`join_rules of ${roomId} requested.`);
returnStateEvent(event, roomId, "m.room.join_rules");
Copy link
Member

Choose a reason for hiding this comment

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

Needs a state_key of "":

returnStateEvent(event, roomId, "m.room.join_rules", "");

@kegsay
Copy link
Member

kegsay commented Sep 5, 2016

(@kegsay, I'm hoping you know how one could test this...)

Bwahahaha, no. Aside from running locally, there is little more you can do. The architecture makes mocking hard (singletons forces you to use something like proxyquire), and there's so many moving parts on the UI (when exactly does view_room fire?) that it's almost impossible to get good coverage here.

We could split this lot out into a class, inject the MatrixClient in the constructor (so we can mock it) and then inject postMessage requests, but I do not believe this file is complicated enough to warrant this (yet).

Luke Barnard added 2 commits September 6, 2016 10:29
- use an empty state key
- swap switch for if
- s/not in view/not visible/
@kegsay
Copy link
Member

kegsay commented Sep 6, 2016

LGTM aside from user_id being required when it shouldn't be.

@lukebarnard1
Copy link
Contributor Author

@kegsay pls take another look, I had to add the set power level API and other stuff

return;
}

console.log(`Received request to set power level for bot ${userId} in room ${roomId}.`);
Copy link
Member

Choose a reason for hiding this comment

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

To what level?

@kegsay
Copy link
Member

kegsay commented Sep 8, 2016

LGTM aside from comment.

@kegsay
Copy link
Member

kegsay commented Sep 9, 2016

LGTM

@lukebarnard1 lukebarnard1 merged commit 6ddc31f into develop Sep 9, 2016
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.

3 participants