From e347621dc8ddd368d2aa026ce6c04dd39d4d0dc9 Mon Sep 17 00:00:00 2001 From: JC Brand Date: Wed, 17 Nov 2021 09:42:34 +0100 Subject: [PATCH] Add JSDoc example --- src/headless/plugins/muc/affiliations/api.js | 15 +++++++++++++++ src/headless/plugins/muc/api.js | 2 +- src/plugins/muc-views/utils.js | 2 +- 3 files changed, 17 insertions(+), 2 deletions(-) diff --git a/src/headless/plugins/muc/affiliations/api.js b/src/headless/plugins/muc/affiliations/api.js index 20f9ef6c5..5f5c2f5c1 100644 --- a/src/headless/plugins/muc/affiliations/api.js +++ b/src/headless/plugins/muc/affiliations/api.js @@ -19,6 +19,21 @@ export default { * @param { String } users[].jid - The JID of the user whose affiliation will change * @param { ('outcast'|'member'|'admin'|'owner') } users[].affiliation - The new affiliation for this user * @param { String } [users[].reason] - An optional reason for the affiliation change + * @returns { Promise } + * + * @example + * api.rooms.affiliations.set( + * [ + * 'muc1@muc.example.org', + * 'muc2@muc.example.org' + * ], [ + * { + * 'jid': 'user@example.org', + * 'affiliation': 'member', + * 'reason': "You're one of us now!" + * } + * ] + * ) */ set (muc_jids, users) { users = !Array.isArray(users) ? [users] : users; diff --git a/src/headless/plugins/muc/api.js b/src/headless/plugins/muc/api.js index 4685c59f6..d7e594695 100644 --- a/src/headless/plugins/muc/api.js +++ b/src/headless/plugins/muc/api.js @@ -70,7 +70,7 @@ export default { * @returns {Promise} Promise which resolves with the Model representing the chat. * * @example - * this.api.rooms.open('group@muc.example.com') + * api.rooms.open('group@muc.example.com') * * @example * // To return an array of rooms, provide an array of room JIDs: diff --git a/src/plugins/muc-views/utils.js b/src/plugins/muc-views/utils.js index 4c095e96b..240db7c19 100644 --- a/src/plugins/muc-views/utils.js +++ b/src/plugins/muc-views/utils.js @@ -7,7 +7,7 @@ import { html } from "lit"; import { parseMessageForCommands } from 'plugins/chatview/utils.js'; import { setAffiliation } from '@converse/headless/plugins/muc/affiliations/utils.js'; -const { Strophe, $pres, $iq, sizzle, u } = converse.env; +const { Strophe, $iq, sizzle, u } = converse.env; const COMMAND_TO_AFFILIATION = { 'admin': 'admin',