rename kickAuthor to kickedBy

This commit is contained in:
Bruno Windels 2021-05-11 13:07:11 +02:00
parent 24731687dc
commit 00d4dc9518

View file

@ -22,7 +22,7 @@ export class ArchivedRoom extends BaseRoom {
constructor(options) { constructor(options) {
super(options); super(options);
this._kickDetails = null; this._kickDetails = null;
this._kickAuthor = null; this._kickedBy = null;
} }
async _getKickAuthor(sender, txn) { async _getKickAuthor(sender, txn) {
@ -38,7 +38,7 @@ export class ArchivedRoom extends BaseRoom {
const {summary, kickDetails} = archivedRoomSummary; const {summary, kickDetails} = archivedRoomSummary;
this._kickDetails = kickDetails; this._kickDetails = kickDetails;
if (this._kickDetails) { if (this._kickDetails) {
this._kickAuthor = await this._getKickAuthor(this._kickDetails.sender, txn); this._kickedBy = await this._getKickAuthor(this._kickDetails.sender, txn);
} }
return super.load(summary, txn, log); return super.load(summary, txn, log);
} }
@ -50,16 +50,16 @@ export class ArchivedRoom extends BaseRoom {
const newKickDetails = findKickDetails(roomResponse, this._user.id); const newKickDetails = findKickDetails(roomResponse, this._user.id);
if (newKickDetails || joinedSummaryData) { if (newKickDetails || joinedSummaryData) {
const kickDetails = newKickDetails || this._kickDetails; const kickDetails = newKickDetails || this._kickDetails;
let kickAuthor; let kickedBy;
if (newKickDetails) { if (newKickDetails) {
kickAuthor = await this._getKickAuthor(newKickDetails.sender, txn); kickedBy = await this._getKickAuthor(newKickDetails.sender, txn);
} }
const summaryData = joinedSummaryData || this._summary.data; const summaryData = joinedSummaryData || this._summary.data;
txn.archivedRoomSummary.set({ txn.archivedRoomSummary.set({
summary: summaryData.serialize(), summary: summaryData.serialize(),
kickDetails, kickDetails,
}); });
return {kickDetails, kickAuthor, summaryData}; return {kickDetails, kickedBy, summaryData};
} }
} else if (membership === "join") { } else if (membership === "join") {
txn.archivedRoomSummary.remove(this.id); txn.archivedRoomSummary.remove(this.id);
@ -73,7 +73,7 @@ export class ArchivedRoom extends BaseRoom {
* Called with the changes returned from `writeSync` to apply them and emit changes. * Called with the changes returned from `writeSync` to apply them and emit changes.
* No storage or network operations should be done here. * No storage or network operations should be done here.
*/ */
afterSync({summaryData, kickDetails, kickAuthor}, log) { afterSync({summaryData, kickDetails, kickedBy}, log) {
log.set("id", this.id); log.set("id", this.id);
if (summaryData) { if (summaryData) {
this._summary.applyChanges(summaryData); this._summary.applyChanges(summaryData);
@ -81,8 +81,8 @@ export class ArchivedRoom extends BaseRoom {
if (kickDetails) { if (kickDetails) {
this._kickDetails = kickDetails; this._kickDetails = kickDetails;
} }
if (kickAuthor) { if (kickedBy) {
this._kickAuthor = kickAuthor; this._kickedBy = kickedBy;
} }
this._emitUpdate(); this._emitUpdate();
} }