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

fix moderator commands that change affiliation #1413

Conversation

@ChaosKid42
Copy link
Contributor

commented Jan 14, 2019

I believe it should be possible to change affiliation of non-occupants. Currently converse rejects this. This tries to fix it.

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch from 1be5087 to dd166e7 Jan 14, 2019

@ChaosKid42 ChaosKid42 changed the title WIP: fix moderator commands that change affiliation fix moderator commands that change affiliation Jan 14, 2019

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch from dd166e7 to ad94201 Jan 14, 2019

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch from ad94201 to cdc3b27 Jan 23, 2019

@ChaosKid42 ChaosKid42 requested a review from jcbrand Jan 28, 2019

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch 2 times, most recently from c147378 to 83fbffb Jan 28, 2019

@jcbrand

This comment has been minimized.

Copy link
Member

commented Jan 29, 2019

This will only work if you provide a valid JID instead of just a nickname right?

I think you'll need to do some validation that it's really a JID being passed in.
You can use the isValidJID utility method.

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch from 83fbffb to 1c9ed79 Jan 29, 2019

@ChaosKid42

This comment has been minimized.

Copy link
Contributor Author

commented Jan 29, 2019

@jcbrand Ok. Added the check.

@@ -841,7 +841,8 @@ converse.plugins.add('converse-muc-views', {
);
return false;
}
if (!this.model.occupants.findWhere({'nick': args[0]}) && !this.model.occupants.findWhere({'jid': args[0]})) {
if (!(_.includes(['admin', 'ban', 'owner', 'member', 'revoke'], command) && u.isValidJID(args[0])) &&

This comment has been minimized.

Copy link
@jcbrand

jcbrand Jan 30, 2019

Member

Please create a const AFFILIATION_CHANGE_COMANDS at the top of the file which is set to these commands and then use that here.

Would be nice if you also wrapped the line (below).

And then please rebase again, so that I can merge from github.

Thanks.

This comment has been minimized.

Copy link
@ChaosKid42

ChaosKid42 Jan 30, 2019

Author Contributor

@jcbrand Done.

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch 4 times, most recently from a18db46 to 9b3f36d Jan 30, 2019

@ChaosKid42

This comment has been minimized.

Copy link
Contributor Author

commented Feb 1, 2019

@jcbrand Friendlly reminder: Do you still plan to merge this PR?

@jcbrand

This comment has been minimized.

Copy link
Member

commented Feb 1, 2019

Yes, but I first need to figure out why the tests on Travis are failing. They're all green on my own machine.

@ChaosKid42 ChaosKid42 force-pushed the ChaosKid42:fix_moderator_commands_that_change_affiliation branch from 9b3f36d to 9a0daaf Feb 3, 2019

@ChaosKid42

This comment has been minimized.

Copy link
Contributor Author

commented Feb 4, 2019

Thanks for fixing the tests. This PR now passes the checks on travis.

@jcbrand jcbrand merged commit 5e1f578 into conversejs:master Feb 5, 2019

1 check passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details

@ChaosKid42 ChaosKid42 deleted the ChaosKid42:fix_moderator_commands_that_change_affiliation branch Feb 10, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.