1
0
mirror of https://github.com/matrix-org/matrix-js-sdk.git synced 2025-12-01 04:43:29 +03:00

Return send event response from MSC3089Branch.createNewVersion() (#2186)

* Return send event response from MSC3089Branch.createNewVersion()

* docs: update JSDoc to match
This commit is contained in:
Hugh Nimmo-Smith
2022-02-21 15:45:43 +00:00
committed by GitHub
parent 4e72290d53
commit a89c1990d6

View File

@@ -20,6 +20,7 @@ import { IContent, MatrixEvent } from "./event";
import { MSC3089TreeSpace } from "./MSC3089TreeSpace"; import { MSC3089TreeSpace } from "./MSC3089TreeSpace";
import { EventTimeline } from "./event-timeline"; import { EventTimeline } from "./event-timeline";
import { FileType } from "../http-api"; import { FileType } from "../http-api";
import type { ISendEventResponse } from "..";
/** /**
* Represents a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) branch - a reference * Represents a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) branch - a reference
@@ -164,14 +165,14 @@ export class MSC3089Branch {
* @param {File | String | Buffer | ReadStream | Blob} encryptedContents The encrypted contents. * @param {File | String | Buffer | ReadStream | Blob} encryptedContents The encrypted contents.
* @param {Partial<IEncryptedFile>} info The encrypted file information. * @param {Partial<IEncryptedFile>} info The encrypted file information.
* @param {IContent} additionalContent Optional event content fields to include in the message. * @param {IContent} additionalContent Optional event content fields to include in the message.
* @returns {Promise<void>} Resolves when uploaded. * @returns {Promise<ISendEventResponse>} Resolves to the file event's sent response.
*/ */
public async createNewVersion( public async createNewVersion(
name: string, name: string,
encryptedContents: FileType, encryptedContents: FileType,
info: Partial<IEncryptedFile>, info: Partial<IEncryptedFile>,
additionalContent?: IContent, additionalContent?: IContent,
): Promise<void> { ): Promise<ISendEventResponse> {
const fileEventResponse = await this.directory.createFile(name, encryptedContents, info, { const fileEventResponse = await this.directory.createFile(name, encryptedContents, info, {
...(additionalContent ?? {}), ...(additionalContent ?? {}),
"m.new_content": true, "m.new_content": true,
@@ -193,6 +194,8 @@ export class MSC3089Branch {
...(this.indexEvent.getContent()), ...(this.indexEvent.getContent()),
active: false, active: false,
}, this.id); }, this.id);
return fileEventResponse;
} }
/** /**