-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[CMS-307] #295
base: main
Are you sure you want to change the base?
Conversation
hdphuong
commented
Oct 18, 2022
- test for UploadDocument - lots of "inspiration" from test for UploadImage
- move EditType into Operations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Go part of it looks good but theres also some TS code that needs to be updated too: https://github.com/csesoc/website/blob/main/backend/editor/OT/OTClient/operation.ts
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Refer to comments + also I feel like this PR introduces a discontinuity between how TS will parse incoming operation payloads and how Go will.
Your types for TS seem to suggest that opType
is of type "insert" | "delete"
while for Go it is simply an integer, its been a while since I've looked at this so I may be wrong
transformAgainst = (op: AtomicOperation): AtomicOperation[] => [this, op]; | ||
} | ||
|
||
export class BooleanOperation implements AtomicOperation { | ||
type = "booleanOperation"; | ||
newValue: boolean; | ||
constructor(newValue: boolean) { | ||
opType: "insert" | "delete"; | ||
constructor(newValue: boolean, opType: "insert" | "delete") { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a lot of unneeded duplication here, abstract this out into its own type:
type OperationType = "insert" | "delete";
export class BooleanOperation implements AtomicOperation {
type = "booleanOperation";
newValue: boolean;
constructor(newValue: boolean) {
opType: OperationType;
constructor(newValue: boolean, opType: OperationType) {
// ....
}
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wait i thought that's what i'm supposed to do according to this jira ticket?