-
Notifications
You must be signed in to change notification settings - Fork 5
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
Automatically convert event descriptions to/from HTML #449
base: master
Are you sure you want to change the base?
Conversation
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.
I feel uncomfortable with the subtle differences between Abstract/Message and Calendar/Event .
In email, we're writing .html = , here rawHTML. a possible reason might have been that we never write emails, but we do have to sync back cal events, so maybe that's why you read from rawHTML when syncing to server, and then you write to rawHTML for consistency? This kind of thing would be appreciated as code comments, or as PR comment.
In Message, we clear text in the caller, whereas in Event, the descriptionHTML clears the .text property in the setter.
- Could you please explain the reasons for the discrepancies (if they are intentional)?
- what's the plan to make it consistent? (i'd prefer a separate PR for email changes)
app/logic/Calendar/Event.ts
Outdated
if (this._rawHTML != null) { | ||
return this._sanitizedHTML = sanitizeHTML(this._rawHTML); | ||
} | ||
if (this._text != null) { | ||
return this._sanitizedHTML = convertTextToHTML(this._text); | ||
} |
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.
Needs try/catch, see Abstract/Message.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.
Needs try/catch, see Abstract/Message.ts
That's unhelpful, as I don't understand why there's a try/catch there in the first place. (Particularly as there isn't one in the text code, which also performs sanitisation. If that's a mistake on your part, then congratulations, you successfully confused me.)
The front end edits descriptionHTML
- obviously this needs to read the sanitised version, but also when the editor changes the value, we need to reset the text automatically; I don't know whether that's possible within the editor. I made the regular text and description accessors clear each other automatically for this reason.
On the other hand, the network and storage may have access to both text and HTML formats and would want to be able to process them separately, so they use the raw accessors for consistency.
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.
why there's a try/catch there in the first place
Because sanitizeHTML()
and convertTextToHTML()
can throw.
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.
Are those libraries that bad? Have you filed bugs? (Also convertHTMLToText
calls sanitizeHTML
, and there's no try/catch there.)
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.
I had to rebase the branch because of your merge conflict, but I added the try/catch
in a separate commit.
Hey Neil, coud you please address these points? |
See #449 (comment) |
2dd11dd
to
a4ceace
Compare
That depends on whether you agree with my reasoning for doing it the way I did. |
1578ddc
to
2f21a49
Compare
Needed for future calendar work: