Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle +m by setting events_default to 1 (and back to 0 on -m) #465

Merged
merged 8 commits into from
Jul 3, 2017

Conversation

kegsay
Copy link
Member

@kegsay kegsay commented Jun 28, 2017

In order for this to work, I also needed to fix #385 so that real IRC users can send into moderated Matrix rooms.

Fixes #453.

kegsay added 7 commits June 26, 2017 16:51
- This only works if `modePowerMap` has values >0 set for `v`, `o`, etc.
- This currently doesn't work for IRC users, as the virtual matrix user does
  not have power in the room because we do not bridge power level for those
  users. See #385.

Other than that, it seems to be working as intended.
…l prefix

Currently doesn't do anything as onMode bails out with "no client" since it's
an IRC user.
And is required to fix #453, which is now working.
Copy link
Contributor

@lukebarnard1 lukebarnard1 left a comment

Choose a reason for hiding this comment

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

LGTM apart from minor squabbles

const roomId = matrixRooms[i].getId();
try {
const plContent = yield botClient.getStateEvent(roomId, "m.room.power_levels", "");
plContent.events_default = enabled ? 1 : 0;
Copy link
Contributor

Choose a reason for hiding this comment

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

could plContent be undefined ?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, Synapse should make sure that every room has a m.room.power_levels event, and you can't delete state. The CS API states it'll 404 if the event doesn't exist which will throw instead of returning undefined.

Copy link
Contributor

Choose a reason for hiding this comment

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

The CS API states it'll 404 if the event doesn't exist which will throw instead of returning undefined.

Ah ok, then no worries

req, server, createUser(name.nick), name.chan, "names"
));
if (!name.opLevel || name.opLevel === "") {
Copy link
Contributor

Choose a reason for hiding this comment

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

But !"" === true so name.opLevel === "" feels redundant.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. ef5c3f1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants