Skip to content

Commit

Permalink
BC-7040 - Set copy status of collaborativ text editor to partial (#5031)
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax authored May 31, 2024
1 parent ad7ef53 commit c619386
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,7 @@ describe(RecursiveCopyVisitor.name, () => {
expect(status).toEqual<CopyStatus>({
copyEntity: expectedCopyEntity,
type: CopyElementType.COLLABORATIVE_TEXT_EDITOR_ELEMENT,
status: CopyStatusEnum.SUCCESS,
status: CopyStatusEnum.PARTIAL,
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
private readonly toolFeatures: IToolFeatures
) {}

async copy(original: AnyBoardDo): Promise<CopyStatus> {
public async copy(original: AnyBoardDo): Promise<CopyStatus> {
await original.acceptAsync(this);

const result = this.resultMap.get(original.id);
Expand All @@ -47,7 +47,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return result;
}

async visitColumnBoardAsync(original: ColumnBoard): Promise<void> {
public async visitColumnBoardAsync(original: ColumnBoard): Promise<void> {
await this.visitChildrenOf(original);

const copy = new ColumnBoard({
Expand All @@ -70,7 +70,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
this.copyMap.set(original.id, copy);
}

async visitColumnAsync(original: Column): Promise<void> {
public async visitColumnAsync(original: Column): Promise<void> {
await this.visitChildrenOf(original);
const copy = new Column({
id: new ObjectId().toHexString(),
Expand All @@ -88,7 +88,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
this.copyMap.set(original.id, copy);
}

async visitCardAsync(original: Card): Promise<void> {
public async visitCardAsync(original: Card): Promise<void> {
await this.visitChildrenOf(original);
const copy = new Card({
id: new ObjectId().toHexString(),
Expand All @@ -107,7 +107,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
this.copyMap.set(original.id, copy);
}

async visitFileElementAsync(original: FileElement): Promise<void> {
public async visitFileElementAsync(original: FileElement): Promise<void> {
const copy = new FileElement({
id: new ObjectId().toHexString(),
caption: original.caption,
Expand Down Expand Up @@ -137,7 +137,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
this.copyMap.set(original.id, copy);
}

async visitDrawingElementAsync(original: DrawingElement): Promise<void> {
public async visitDrawingElementAsync(original: DrawingElement): Promise<void> {
const copy = new DrawingElement({
id: new ObjectId().toHexString(),
description: original.description,
Expand All @@ -155,7 +155,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return Promise.resolve();
}

async visitLinkElementAsync(original: LinkElement): Promise<void> {
public async visitLinkElementAsync(original: LinkElement): Promise<void> {
const copy = new LinkElement({
id: new ObjectId().toHexString(),
url: original.url,
Expand Down Expand Up @@ -202,7 +202,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return Promise.resolve();
}

async visitRichTextElementAsync(original: RichTextElement): Promise<void> {
public async visitRichTextElementAsync(original: RichTextElement): Promise<void> {
const copy = new RichTextElement({
id: new ObjectId().toHexString(),
text: original.text,
Expand All @@ -221,7 +221,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return Promise.resolve();
}

async visitSubmissionContainerElementAsync(original: SubmissionContainerElement): Promise<void> {
public async visitSubmissionContainerElementAsync(original: SubmissionContainerElement): Promise<void> {
await this.visitChildrenOf(original);
const copy = new SubmissionContainerElement({
id: new ObjectId().toHexString(),
Expand All @@ -239,7 +239,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
this.copyMap.set(original.id, copy);
}

async visitSubmissionItemAsync(original: SubmissionItem): Promise<void> {
public async visitSubmissionItemAsync(original: SubmissionItem): Promise<void> {
this.resultMap.set(original.id, {
type: CopyElementType.SUBMISSION_ITEM,
status: CopyStatusEnum.NOT_DOING,
Expand All @@ -248,7 +248,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return Promise.resolve();
}

async visitExternalToolElementAsync(original: ExternalToolElement): Promise<void> {
public async visitExternalToolElementAsync(original: ExternalToolElement): Promise<void> {
const boardElementCopy: ExternalToolElement = new ExternalToolElement({
id: new ObjectId().toHexString(),
contextExternalToolId: undefined,
Expand Down Expand Up @@ -287,7 +287,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return Promise.resolve();
}

async visitCollaborativeTextEditorElementAsync(original: CollaborativeTextEditorElement): Promise<void> {
public async visitCollaborativeTextEditorElementAsync(original: CollaborativeTextEditorElement): Promise<void> {
const now = new Date();
const copy = new CollaborativeTextEditorElement({
id: new ObjectId().toHexString(),
Expand All @@ -298,14 +298,14 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
this.resultMap.set(original.id, {
copyEntity: copy,
type: CopyElementType.COLLABORATIVE_TEXT_EDITOR_ELEMENT,
status: CopyStatusEnum.SUCCESS,
status: CopyStatusEnum.PARTIAL,
});
this.copyMap.set(original.id, copy);

return Promise.resolve();
}

async visitMediaBoardAsync(original: MediaBoard): Promise<void> {
public async visitMediaBoardAsync(original: MediaBoard): Promise<void> {
await this.visitChildrenOf(original);

this.resultMap.set(original.id, {
Expand All @@ -315,7 +315,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
});
}

async visitMediaLineAsync(original: MediaLine): Promise<void> {
public async visitMediaLineAsync(original: MediaLine): Promise<void> {
await this.visitChildrenOf(original);

this.resultMap.set(original.id, {
Expand All @@ -325,7 +325,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
});
}

visitMediaExternalToolElementAsync(original: MediaExternalToolElement): Promise<void> {
public visitMediaExternalToolElementAsync(original: MediaExternalToolElement): Promise<void> {
this.resultMap.set(original.id, {
type: CopyElementType.MEDIA_EXTERNAL_TOOL_ELEMENT,
status: CopyStatusEnum.NOT_DOING,
Expand All @@ -334,11 +334,11 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return Promise.resolve();
}

async visitChildrenOf(boardDo: AnyBoardDo): Promise<PromiseSettledResult<void>[]> {
private async visitChildrenOf(boardDo: AnyBoardDo): Promise<PromiseSettledResult<void>[]> {
return Promise.allSettled(boardDo.children.map((child) => child.acceptAsync(this)));
}

getCopyStatusesForChildrenOf(original: AnyBoardDo) {
private getCopyStatusesForChildrenOf(original: AnyBoardDo) {
const childstatusses: CopyStatus[] = [];

original.children.forEach((child) => {
Expand All @@ -351,7 +351,7 @@ export class RecursiveCopyVisitor implements BoardCompositeVisitorAsync {
return childstatusses;
}

getCopiesForChildrenOf(original: AnyBoardDo) {
private getCopiesForChildrenOf(original: AnyBoardDo) {
const copies: AnyBoardDo[] = [];
original.children.forEach((child) => {
const childCopy = this.copyMap.get(child.id);
Expand Down

0 comments on commit c619386

Please sign in to comment.