瀏覽代碼

Fix loadEmojis hook.

John Livingston 1 年之前
父節點
當前提交
925edaa3cd
共有 1 個文件被更改,包括 5 次插入3 次删除
  1. 5 3
      src/headless/plugins/emoji/plugin.js

+ 5 - 3
src/headless/plugins/emoji/plugin.js

@@ -83,11 +83,13 @@ converse.plugins.add('converse-emoji', {
                          * Note: This hook is only fired one time, when Converse is initialized.
                          *
                          * @event _converse#loadEmojis
+                         * @param context
+                         *      An empty context object.
                          * @param json
                          *      See {@link src/headless/emojis.json} for more information about the content of
                          *      this parameter.
                          * @example
-                         *  api.listen.on('loadEmojis', (json) => {
+                         *  api.listen.on('loadEmojis', (context, json) => {
                          *      json.custom??= {};
                          *      json.custom[":my_emoji"] = {
                          *          "sn":":my_emoji:","url":"https://example.com/my_emoji.png","c":"custom"
@@ -97,8 +99,8 @@ converse.plugins.add('converse-emoji', {
                          *  });
                          */
                         const json = (
-                            await api.hook('loadEmojis', module.default)
-                        ) ?? module.default; // in case there is no plugin to listen for the hook.
+                            await api.hook('loadEmojis', {}, module.default)
+                        )
                         converse.emojis.json = json;