1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-11-28 05:03:59 +03:00

more consistent naming

This commit is contained in:
Bruno Windels
2018-07-19 15:24:57 +02:00
parent 5de0d39553
commit 5e30aff418
6 changed files with 16 additions and 16 deletions

View File

@@ -779,7 +779,7 @@ MatrixClient.prototype.loadRoomMembersIfNeeded = async function(roomId) {
}; };
}); });
}); });
await room.setLazilyLoadedMembers(membersPromise); await room.setLazyLoadedMembers(membersPromise);
}; };
/** /**

View File

@@ -77,8 +77,8 @@ utils.inherits(EventTimelineSet, EventEmitter);
* Sets the lazily loaded members. * Sets the lazily loaded members.
* @param {Member[]} members array of {userId, avatarUrl, displayName, membership} tuples * @param {Member[]} members array of {userId, avatarUrl, displayName, membership} tuples
*/ */
EventTimelineSet.prototype.setLazilyLoadedMembers = function(members) { EventTimelineSet.prototype.setLazyLoadedMembers = function(members) {
this._timelines.forEach((tl) => tl.setLazilyLoadedMembers(members)); this._timelines.forEach((tl) => tl.setLazyLoadedMembers(members));
}; };
/** /**

View File

@@ -162,9 +162,9 @@ EventTimeline.prototype.getRoomId = function() {
* Sets the lazily loaded members. * Sets the lazily loaded members.
* @param {Member[]} members array of {userId, avatarUrl, displayName, membership} tuples * @param {Member[]} members array of {userId, avatarUrl, displayName, membership} tuples
*/ */
EventTimeline.prototype.setLazilyLoadedMembers = function(members) { EventTimeline.prototype.setLazyLoadedMembers = function(members) {
this._startState.setLazilyLoadedMembers(members); this._startState.setLazyLoadedMembers(members);
this._endState.setLazilyLoadedMembers(members); this._endState.setLazyLoadedMembers(members);
}; };
/** /**

View File

@@ -59,13 +59,13 @@ function RoomMember(roomId, userId) {
member: null, member: null,
}; };
this._lazyLoadAvatarUrl = null; this._lazyLoadAvatarUrl = null;
this._isLazilyLoaded = false; this._isLazyLoaded = false;
this._updateModifiedTime(); this._updateModifiedTime();
} }
utils.inherits(RoomMember, EventEmitter); utils.inherits(RoomMember, EventEmitter);
RoomMember.prototype.isLazyLoaded = function() { RoomMember.prototype.isLazyLoaded = function() {
return this._isLazilyLoaded; return this._isLazyLoaded;
}; };
/** /**
@@ -108,12 +108,12 @@ RoomMember.prototype.setMembershipEvent = function(event, roomState) {
* @param {Member} memberInfo a {userId, avatarUrl, displayName, membership} tuple * @param {Member} memberInfo a {userId, avatarUrl, displayName, membership} tuple
* @param {RoomState} roomState the room state this member is part of, needed to disambiguate the display name * @param {RoomState} roomState the room state this member is part of, needed to disambiguate the display name
*/ */
RoomMember.prototype.setAsLazilyLoadedMember = function(memberInfo, roomState) { RoomMember.prototype.setAsLazyLoadedMember = function(memberInfo, roomState) {
this.membership = memberInfo.membership; this.membership = memberInfo.membership;
this.name = calculateDisplayName(this.userId, memberInfo.displayName, roomState); this.name = calculateDisplayName(this.userId, memberInfo.displayName, roomState);
this.rawDisplayName = memberInfo.displayName || this.userId; this.rawDisplayName = memberInfo.displayName || this.userId;
this._lazyLoadAvatarUrl = memberInfo.avatarUrl; this._lazyLoadAvatarUrl = memberInfo.avatarUrl;
this._isLazilyLoaded = true; this._isLazyLoaded = true;
//TODO: race condition between existing membership events since started syncing //TODO: race condition between existing membership events since started syncing
}; };

View File

@@ -278,14 +278,14 @@ RoomState.prototype._updateMember = function(member) {
* Sets the lazily loaded members. * Sets the lazily loaded members.
* @param {Member[]} members array of {userId, avatarUrl, displayName, membership} tuples * @param {Member[]} members array of {userId, avatarUrl, displayName, membership} tuples
*/ */
RoomState.prototype.setLazilyLoadedMembers = function(members) { RoomState.prototype.setLazyLoadedMembers = function(members) {
members.forEach((member) => this._setLazilyLoadedMember(member)); members.forEach((member) => this._setLazyLoadedMember(member));
}; };
/** /**
* Add/updates a lazily loaded member. * Add/updates a lazily loaded member.
* @param {Member} memberInfo a {userId, avatarUrl, displayName, membership} tuple * @param {Member} memberInfo a {userId, avatarUrl, displayName, membership} tuple
*/ */
RoomState.prototype._setLazilyLoadedMember = function(memberInfo) { RoomState.prototype._setLazyLoadedMember = function(memberInfo) {
const member = new RoomMember(this.roomId, memberInfo.userId); const member = new RoomMember(this.roomId, memberInfo.userId);
// try to find the member event for the user and set it first on the member // try to find the member event for the user and set it first on the member
// so inspection of the event is possible later on if we have it // so inspection of the event is possible later on if we have it
@@ -295,7 +295,7 @@ RoomState.prototype._setLazilyLoadedMember = function(memberInfo) {
} }
// override the displayName and avatarUrl from the lazily loaded members // override the displayName and avatarUrl from the lazily loaded members
// as this is guaranteed to be the current state // as this is guaranteed to be the current state
member.setAsLazilyLoadedMember(memberInfo, this); member.setAsLazyLoadedMember(memberInfo, this);
const isNewMember = !this.members[member.userId]; const isNewMember = !this.members[member.userId];

View File

@@ -228,7 +228,7 @@ Room.prototype.membersNeedLoading = function() {
* Sets the lazily loaded members from the result of calling /joined_members * Sets the lazily loaded members from the result of calling /joined_members
* @param {Promise} membersPromise promise with array of {userId, avatarUrl, displayName, membership} tuples * @param {Promise} membersPromise promise with array of {userId, avatarUrl, displayName, membership} tuples
*/ */
Room.prototype.setLazilyLoadedMembers = async function(membersPromise) { Room.prototype.setLazyLoadedMembers = async function(membersPromise) {
this._membersNeedLoading = false; this._membersNeedLoading = false;
let members = null; let members = null;
try { try {
@@ -237,7 +237,7 @@ Room.prototype.setLazilyLoadedMembers = async function(membersPromise) {
this._membersNeedLoading = true; this._membersNeedLoading = true;
throw err; //rethrow so calling code is aware operation failed throw err; //rethrow so calling code is aware operation failed
} }
this._timelineSets.forEach((tlSet) => tlSet.setLazilyLoadedMembers(members)); this._timelineSets.forEach((tlSet) => tlSet.setLazyLoadedMembers(members));
this.emit('Room', this); this.emit('Room', this);
}; };