Skip to content

Commit

Permalink
feat: Updates userRegion from backend. (#2626)
Browse files Browse the repository at this point in the history
* feat: Updates userRegion from backend.

* squash: Update comment.

* squash: Fix options.
  • Loading branch information
damencho authored Jan 28, 2025
1 parent dfc23df commit 0d3304b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions JitsiConference.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,6 +560,8 @@ JitsiConference.prototype._init = function(options = {}) {
// creates dominant speaker detection that works only in p2p mode
this.p2pDominantSpeakerDetection = new P2PDominantSpeakerDetection(this);

// TODO: Drop this after the change to use the region from the http requests
// to prosody is propagated to majority of deployments
if (config && config.deploymentInfo && config.deploymentInfo.userRegion) {
this.setLocalParticipantProperty(
'region', config.deploymentInfo.userRegion);
Expand Down
8 changes: 8 additions & 0 deletions modules/xmpp/ChatRoom.js
Original file line number Diff line number Diff line change
Expand Up @@ -605,6 +605,10 @@ export default class ChatRoom extends Listenable {
member.features = this._extractFeatures(node);
break;
}
case 'jitsi_participant_region': {
member.region = node.value;
break;
}
case 'stat': {
const { attributes } = node;

Expand Down Expand Up @@ -652,6 +656,10 @@ export default class ChatRoom extends Listenable {
this.locked = true;
}

if (member.region && this.options?.deploymentInfo) {
this.options.deploymentInfo.userRegion = member.region;
}

// Re-send presence in case any presence updates were added,
// but blocked from sending, during the join process.
// send the presence only if there was a modification after we had synced it
Expand Down

0 comments on commit 0d3304b

Please sign in to comment.