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

Added more moderation UI complete with user blocking/ignoring #3119

Closed
wants to merge 2 commits into from

Conversation

based-a-tron
Copy link

Thanks for making a pull request to converse.js!

Before submitting your request, please make sure the following conditions are met:

  • Add a changelog entry for your change in CHANGES.md
  • When adding a configuration variable, please make sure to
    document it in docs/source/configuration.rst
  • Please add a test for your change. Tests can be run in the commandline
    with make check or you can run them in the browser by running make serve
    and then opening http://localhost:8000/tests.html.

@licaon-kter
Copy link
Contributor

Pics? Workflow?

Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

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

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

const role = model.get('role') ?? 'none';
const affiliation = model.get('affiliation');

const ownRole = muc.getOwnRole();
Copy link
Author

Choose a reason for hiding this comment

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

It turns out that this variable is not needed since only applicable commands are considered,
and mute, kick, etc are not applicable to non moderators. So this variable factors out.

api.unblockUser([jid]);
};
let handleKick = (ev) => {
setRole(muc, 'kick', jid, [], ['moderator']);
Copy link
Author

Choose a reason for hiding this comment

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

Forgot to export setRole and verifyAndSetAffiliation from the other file

const adminButton = html`<button class='btn btn-primary' @click=${handleAdmin}>Make Admin</button>`
const ownerButton = html`<button class='btn btn-primary' @click=${handleOwner}>Make Owner</button>`

// The following table stores a map from Affiliation x Role -> Button
Copy link
Author

Choose a reason for hiding this comment

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

Should clarify, the mapping is from OwnAffiliation x { Target's Current Affiliation, Target's Current Role } -> Button

@@ -0,0 +1,10 @@
import { _converse, api, converse } from "@converse/headless/core.js";

const { Strophe, $iq } = converse.env;

Check notice

Code scanning / CodeQL

Unused variable, import, function or class

Unused variable $iq.
@jcbrand
Copy link
Member

jcbrand commented Feb 20, 2023

I've rebased and made some updates here: https://github.com/conversejs/converse.js/pull/

Closing this PR in favor of that one.

@jcbrand jcbrand closed this Feb 20, 2023
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.

4 participants