feat: complete Ancestor quote bot with production-ready Docker support
This commit is contained in:
40
node_modules/matrix-js-sdk/src/models/MSC3089Branch.ts
generated
vendored
40
node_modules/matrix-js-sdk/src/models/MSC3089Branch.ts
generated
vendored
@@ -14,28 +14,13 @@ See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
*/
|
||||
|
||||
import { type MatrixClient } from "../client.ts";
|
||||
import { RelationType, UNSTABLE_MSC3089_BRANCH } from "../@types/event.ts";
|
||||
import { type IContent, type MatrixEvent } from "./event.ts";
|
||||
import { type MSC3089TreeSpace } from "./MSC3089TreeSpace.ts";
|
||||
import { EventTimeline } from "./event-timeline.ts";
|
||||
import { type FileType } from "../http-api/index.ts";
|
||||
import type { ISendEventResponse } from "../@types/requests.ts";
|
||||
import { type EncryptedFile } from "../@types/media.ts";
|
||||
|
||||
export interface MSC3089EventContent {
|
||||
active?: boolean;
|
||||
name?: string;
|
||||
locked?: boolean;
|
||||
version?: number;
|
||||
}
|
||||
|
||||
export interface MSC3089EventContent {
|
||||
active?: boolean;
|
||||
name?: string;
|
||||
locked?: boolean;
|
||||
version?: number;
|
||||
}
|
||||
import { MatrixClient } from "../client";
|
||||
import { IEncryptedFile, RelationType, UNSTABLE_MSC3089_BRANCH } from "../@types/event";
|
||||
import { IContent, MatrixEvent } from "./event";
|
||||
import { MSC3089TreeSpace } from "./MSC3089TreeSpace";
|
||||
import { EventTimeline } from "./event-timeline";
|
||||
import { FileType } from "../http-api";
|
||||
import type { ISendEventResponse } from "../@types/requests";
|
||||
|
||||
/**
|
||||
* Represents a [MSC3089](https://github.com/matrix-org/matrix-doc/pull/3089) branch - a reference
|
||||
@@ -146,7 +131,7 @@ export class MSC3089Branch {
|
||||
* Gets information about the file needed to download it.
|
||||
* @returns Information about the file.
|
||||
*/
|
||||
public async getFileInfo(): Promise<{ info: EncryptedFile; httpUrl: string }> {
|
||||
public async getFileInfo(): Promise<{ info: IEncryptedFile; httpUrl: string }> {
|
||||
const event = await this.getFileEvent();
|
||||
|
||||
const file = event.getOriginalContent()["file"];
|
||||
@@ -177,8 +162,9 @@ export class MSC3089Branch {
|
||||
|
||||
if (!event) throw new Error("Failed to find event");
|
||||
|
||||
// Sometimes the event isn't decrypted for us, so do that.
|
||||
await this.client.decryptEventIfNeeded(event);
|
||||
// Sometimes the event isn't decrypted for us, so do that. We specifically set `emit: true`
|
||||
// to ensure that the relations system in the sdk will function.
|
||||
await this.client.decryptEventIfNeeded(event, { emit: true, isRetry: true });
|
||||
|
||||
return event;
|
||||
}
|
||||
@@ -194,11 +180,11 @@ export class MSC3089Branch {
|
||||
public async createNewVersion(
|
||||
name: string,
|
||||
encryptedContents: FileType,
|
||||
info: EncryptedFile,
|
||||
info: Partial<IEncryptedFile>,
|
||||
additionalContent?: IContent,
|
||||
): Promise<ISendEventResponse> {
|
||||
const fileEventResponse = await this.directory.createFile(name, encryptedContents, info, {
|
||||
...additionalContent,
|
||||
...(additionalContent ?? {}),
|
||||
"m.new_content": true,
|
||||
"m.relates_to": {
|
||||
rel_type: RelationType.Replace,
|
||||
|
||||
Reference in New Issue
Block a user