@@ -50,6 +50,8 @@ import MUCSession from './session';
5050
5151const { u, stx } = converse . env ;
5252
53+ const DISCO_INFO_TIMEOUT_ON_JOIN = 5000 ;
54+
5355/**
5456 * Represents a groupchat conversation.
5557 */
@@ -192,7 +194,9 @@ class MUC extends ModelWithVCard(ModelWithMessages(ColorAwareModel(ChatBoxBase))
192194 // Set this early, so we don't rejoin in onHiddenChange
193195 this . session . save ( 'connection_status' , ROOMSTATUS . CONNECTING ) ;
194196
195- const is_new = ( await this . refreshDiscoInfo ( ) ) instanceof ItemNotFoundError ;
197+ const result = await this . refreshDiscoInfo ( { timeout : DISCO_INFO_TIMEOUT_ON_JOIN } ) ;
198+ const is_new = result instanceof ItemNotFoundError ;
199+
196200 nick = await this . getAndPersistNickname ( nick ) ;
197201 if ( ! nick ) {
198202 safeSave ( this . session , { 'connection_status' : ROOMSTATUS . NICKNAME_REQUIRED } ) ;
@@ -1254,10 +1258,11 @@ class MUC extends ModelWithVCard(ModelWithMessages(ColorAwareModel(ChatBoxBase))
12541258 * Refresh the disco identity, features and fields for this {@link MUC}.
12551259 * *features* are stored on the features {@link Model} attribute on this {@link MUC}.
12561260 * *fields* are stored on the config {@link Model} attribute on this {@link MUC}.
1261+ * @param {import('@converse/headless/plugins/disco/types').DiscoInfoOptions } [options]
12571262 * @returns {Promise }
12581263 */
1259- async refreshDiscoInfo ( ) {
1260- const result = await api . disco . refresh ( this . get ( 'jid' ) ) ;
1264+ async refreshDiscoInfo ( options ) {
1265+ const result = await api . disco . refresh ( this . get ( 'jid' ) , options ) ;
12611266 if ( result instanceof StanzaError ) {
12621267 return result ;
12631268 }
@@ -1738,7 +1743,8 @@ class MUC extends ModelWithVCard(ModelWithMessages(ColorAwareModel(ChatBoxBase))
17381743 <iq to="${ this . get ( 'jid' ) } " type="get" xmlns="jabber:client">
17391744 <query xmlns="${ Strophe . NS . DISCO_INFO } " node="x-roomuser-item"/>
17401745 </iq>` ;
1741- const result = await api . sendIQ ( stanza , null , false ) ;
1746+
1747+ const result = await api . sendIQ ( stanza , DISCO_INFO_TIMEOUT_ON_JOIN , false ) ;
17421748 if ( u . isErrorObject ( result ) ) {
17431749 throw result ;
17441750 }
0 commit comments