Skip to content

Commit

Permalink
Merge pull request #45 from matrix-hacks/set_rooms_invite_only
Browse files Browse the repository at this point in the history
Set rooms invite only
  • Loading branch information
thomas-profitt authored Feb 23, 2019
2 parents 913b64f + daafc24 commit decce78
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/base.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,21 @@ class Base {
return matrixRoomId;
}
});
}).then(matrixRoomId => {
info("setting room as invite-only", matrixRoomId);
return puppetClient.sendStateEvent(matrixRoomId, "m.room.join_rules", {"join_rule": "invite"}).then(() =>{
info("succeeded in setting room as invite-only using puppet client. Room:", matrixRoomId);
return matrixRoomId;
}, (err) => {
info("Since setting join rules with puppet client failed, now trying with bot client");
return botIntent.sendStateEvent(matrixRoomId, "m.room.join_rules", "", {"join_rule": "invite"}).then(()=>{
info("succeeded in setting room as invite-only using bot client. Room:", matrixRoomId);
return matrixRoomId;
}, (err) => {
warn("Both puppet and bot client invite only settings failed :( Error:", err.message);
return matrixRoomId;
});
});
}).then(matrixRoomId => {
this.puppet.saveThirdPartyRoomId(matrixRoomId, thirdPartyRoomId);
return matrixRoomId;
Expand Down

0 comments on commit decce78

Please sign in to comment.