Skip to content

Commit

Permalink
Merge pull request #1739 from matrix-org/t3chguy/fix/15051
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy authored Jun 24, 2021
2 parents 1171c33 + 6deb2bc commit 4181799
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 16 deletions.
26 changes: 13 additions & 13 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3800,10 +3800,10 @@ export class MatrixClient extends EventEmitter {
* @param {string} userId
* @param {module:client.callback} callback Optional.
* @param {string} reason Optional.
* @return {Promise} Resolves: TODO
* @return {Promise} Resolves: {} an empty object.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
public invite(roomId: string, userId: string, callback?: Callback, reason?: string): Promise<void> {
public invite(roomId: string, userId: string, callback?: Callback, reason?: string): Promise<{}> {
return this.membershipChange(roomId, userId, "invite", reason, callback);
}

Expand All @@ -3812,10 +3812,10 @@ export class MatrixClient extends EventEmitter {
* @param {string} roomId The room to invite the user to.
* @param {string} email The email address to invite.
* @param {module:client.callback} callback Optional.
* @return {Promise} Resolves: TODO
* @return {Promise} Resolves: {} an empty object.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
public inviteByEmail(roomId: string, email: string, callback?: Callback): Promise<void> {
public inviteByEmail(roomId: string, email: string, callback?: Callback): Promise<{}> {
return this.inviteByThreePid(roomId, "email", email, callback);
}

Expand All @@ -3825,10 +3825,10 @@ export class MatrixClient extends EventEmitter {
* @param {string} medium The medium to invite the user e.g. "email".
* @param {string} address The address for the specified medium.
* @param {module:client.callback} callback Optional.
* @return {Promise} Resolves: TODO
* @return {Promise} Resolves: {} an empty object.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
public async inviteByThreePid(roomId: string, medium: string, address: string, callback?: Callback): Promise<void> {
public async inviteByThreePid(roomId: string, medium: string, address: string, callback?: Callback): Promise<{}> {
const path = utils.encodeUri(
"/rooms/$roomId/invite",
{ $roomId: roomId },
Expand Down Expand Up @@ -3864,10 +3864,10 @@ export class MatrixClient extends EventEmitter {
/**
* @param {string} roomId
* @param {module:client.callback} callback Optional.
* @return {Promise} Resolves: TODO
* @return {Promise} Resolves: {} an empty object.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
public leave(roomId: string, callback?: Callback): Promise<void> {
public leave(roomId: string, callback?: Callback): Promise<{}> {
return this.membershipChange(roomId, undefined, "leave", undefined, callback);
}

Expand Down Expand Up @@ -3935,10 +3935,10 @@ export class MatrixClient extends EventEmitter {
* @param {boolean} deleteRoom True to delete the room from the store on success.
* Default: true.
* @param {module:client.callback} callback Optional.
* @return {Promise} Resolves: TODO
* @return {Promise} Resolves: {} an empty object.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
public forget(roomId: string, deleteRoom?: boolean, callback?: Callback): Promise<void> {
public forget(roomId: string, deleteRoom?: boolean, callback?: Callback): Promise<{}> {
if (deleteRoom === undefined) {
deleteRoom = true;
}
Expand Down Expand Up @@ -3983,10 +3983,10 @@ export class MatrixClient extends EventEmitter {
* @param {string} userId
* @param {string} reason Optional.
* @param {module:client.callback} callback Optional.
* @return {Promise} Resolves: TODO
* @return {Promise} Resolves: {} an empty object.
* @return {module:http-api.MatrixError} Rejects: with an error response.
*/
public kick(roomId: string, userId: string, reason?: string, callback?: Callback): Promise<void> {
public kick(roomId: string, userId: string, reason?: string, callback?: Callback): Promise<{}> {
return this.setMembershipState(roomId, userId, "leave", reason, callback);
}

Expand Down Expand Up @@ -4030,7 +4030,7 @@ export class MatrixClient extends EventEmitter {
membership: string,
reason?: string,
callback?: Callback,
): Promise<void> {
): Promise<{}> {
if (utils.isFunction(reason)) {
callback = reason as any as Callback; // legacy
reason = undefined;
Expand Down
6 changes: 3 additions & 3 deletions src/models/MSC3089TreeSpace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ export class MSC3089TreeSpace {
* which is an appropriate visibility for these purposes).
* @returns {Promise<void>} Resolves when complete.
*/
public invite(userId: string, andSubspaces = true, shareHistoryKeys = true): Promise<void> {
public async invite(userId: string, andSubspaces = true, shareHistoryKeys = true): Promise<void> {
const promises: Promise<void>[] = [this.retryInvite(userId)];
if (andSubspaces) {
promises.push(...this.getDirectories().map(d => d.invite(userId, andSubspaces, shareHistoryKeys)));
Expand All @@ -146,8 +146,8 @@ export class MSC3089TreeSpace {
}

private retryInvite(userId: string): Promise<void> {
return simpleRetryOperation(() => {
return this.client.invite(this.roomId, userId).catch(e => {
return simpleRetryOperation(async () => {
await this.client.invite(this.roomId, userId).catch(e => {
// We don't want to retry permission errors forever...
if (e?.errcode === "M_FORBIDDEN") {
throw new promiseRetry.AbortError(e);
Expand Down

0 comments on commit 4181799

Please sign in to comment.