mirror of
https://github.com/cinnyapp/cinny.git
synced 2025-11-13 10:40:28 +03:00
Add option to select role on roomCreation
Signed-off-by: Ajay Bura <ajbura@gmail.com>
This commit is contained in:
parent
f53f54af7f
commit
e25dc46863
3 changed files with 34 additions and 2 deletions
|
|
@ -132,9 +132,11 @@ function leave(roomId) {
|
|||
* @param {boolean} [opts.isEncrypted=false] Makes room encrypted
|
||||
* @param {boolean} [opts.isDirect=false] Makes room as direct message
|
||||
* @param {string[]} [opts.invite=[]] An array of userId's to invite
|
||||
* @param{number} [opts.powerLevel=100] My power level
|
||||
*/
|
||||
async function create(opts) {
|
||||
const mx = initMatrix.matrixClient;
|
||||
const customPowerLevels = [101];
|
||||
const options = {
|
||||
name: opts.name,
|
||||
topic: opts.topic,
|
||||
|
|
@ -144,6 +146,9 @@ async function create(opts) {
|
|||
invite: opts.invite || [],
|
||||
initial_state: [],
|
||||
preset: opts.isDirect === true ? 'trusted_private_chat' : undefined,
|
||||
power_level_content_override: customPowerLevels.indexOf(opts.powerLevel) === -1 ? undefined : {
|
||||
users: { [initMatrix.matrixClient.getUserId()]: opts.powerLevel },
|
||||
},
|
||||
};
|
||||
|
||||
if (opts.isPublic !== true && opts.isEncrypted === true) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue