Selaa lähdekoodia

Update converse-mam.js

I think why do not come archives from group chats, and it turns out that you need to add "groupchat" in options. I spent half an hour searching in the documentation, and half an hour searching in the convers tests. And finally found in tests.
Yaskhan 5 vuotta sitten
vanhempi
commit
1653c1ae92
1 muutettua tiedostoa jossa 3 lisäystä ja 1 poistoa
  1. 3 1
      src/headless/converse-mam.js

+ 3 - 1
src/headless/converse-mam.js

@@ -93,6 +93,7 @@ converse.plugins.add('converse-mam', {
              *  after which messages should be returned. Implies forward paging.
              *  after which messages should be returned. Implies forward paging.
              * @param { string } [options.with] - The JID of the entity with
              * @param { string } [options.with] - The JID of the entity with
              *  which messages were exchanged.
              *  which messages were exchanged.
+             * @param { boolean } [options.groupchat] - True if archive in groupchat.
              * @param { boolean } [page] - Whether this function should recursively
              * @param { boolean } [page] - Whether this function should recursively
              *  page through the entire result set if a limited number of results
              *  page through the entire result set if a limited number of results
              *  were returned.
              *  were returned.
@@ -300,6 +301,7 @@ converse.plugins.add('converse-mam', {
                   * * `before`
                   * * `before`
                   * * `index`
                   * * `index`
                   * * `count`
                   * * `count`
+                  * * `groupchat`
                   * @throws {Error} An error is thrown if the XMPP server responds with an error.
                   * @throws {Error} An error is thrown if the XMPP server responds with an error.
                   * @returns { (Promise<Object> | _converse.TimeoutError) } A promise which resolves
                   * @returns { (Promise<Object> | _converse.TimeoutError) } A promise which resolves
                   * to an object which will have keys `messages` and `rsm` which contains a _converse.RSM
                   * to an object which will have keys `messages` and `rsm` which contains a _converse.RSM
@@ -343,7 +345,7 @@ converse.plugins.add('converse-mam', {
                   * // For a particular room
                   * // For a particular room
                   * let result;
                   * let result;
                   * try {
                   * try {
-                  *    result = await _converse.api.archive.query({'with': 'discuss@conference.doglovers.net'});
+                  *    result = await _converse.api.archive.query({'with': 'discuss@conference.doglovers.net', 'groupchat': true});
                   * } catch (e) {
                   * } catch (e) {
                   *     // The query was not successful
                   *     // The query was not successful
                   * }
                   * }