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

RESTAPI: missing add/remove leader #13288

Closed
Montel opened this issue Jan 30, 2019 · 9 comments
Closed

RESTAPI: missing add/remove leader #13288

Montel opened this issue Jan 30, 2019 · 9 comments
Assignees

Comments

@Montel
Copy link
Contributor

Montel commented Jan 30, 2019

In last version we don"t have rest api for adding/removing leader role:

We have method for adding/removing Moderator/Owner role but not leader.

I think that we need code as:

RocketChat.API.v1.addRoute('channels.addLeader', { authRequired: true }, {
        post() {
                const findResult = findChannelByIdOrName({ params: this.requestParams() });

                const user = this.getUserFromParams();

                Meteor.runAsUser(this.userId, () => {
                        Meteor.call('addRoomLeader', findResult._id, user._id);
                });

                return RocketChat.API.v1.success();
        },
});

RocketChat.API.v1.addRoute('channels.removeLeader', { authRequired: true }, {
        post() {
                const findResult = findChannelByIdOrName({ params: this.requestParams() });

                const user = this.getUserFromParams();

                Meteor.runAsUser(this.userId, () => {
                        Meteor.call('removeRoomLeader', findResult._id, user._id);
                });

                return RocketChat.API.v1.success();
        },
});

Regards.

@ggazzo
Copy link
Member

ggazzo commented Jan 31, 2019

hey @Montel looking your snippet seems you are in the right path, why not open a pull request? feel free to open and we can help you to merge it :)

@Montel
Copy link
Contributor Author

Montel commented Jan 31, 2019

I can try to make a pull request tomorrow.
I need it for my rocketchat client (kde - ruqola)

I will do it tomorrow

@Montel
Copy link
Contributor Author

Montel commented Jan 31, 2019

Montel#1
I created this pull request I think :)
Not sure that all is ok

@MarcosSpessatto
Copy link
Contributor

@Montel I think you opened the PR only in your fork, you should open the PR and choose as the target branch: RocketChat:develop and not the develop branch of your fork. 😅 Can you please fix it?

@Montel
Copy link
Contributor Author

Montel commented Feb 1, 2019

Ah !
Sorry I didn't use a lot github :) I will try to fix it soon :)

@MarcosSpessatto
Copy link
Contributor

No problem :)

@Montel
Copy link
Contributor Author

Montel commented Feb 1, 2019

#13314

it seems that I need to add some reviewer but I don't know who (and how :) )

@MarcosSpessatto
Copy link
Contributor

I'll do that. :)

@Montel
Copy link
Contributor Author

Montel commented Feb 1, 2019

oops sorry I wanted to update my patch and it closed it...
I recreated a new one:
#13315

I hope that it'"s ok.

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

No branches or pull requests

3 participants