Add htmlMfm key when relevant #878
No reviewers
Labels
No labels
approved, awaiting change
bug
configuration
documentation
duplicate
enhancement
extremely low priority
feature request
Fix it yourself
help wanted
invalid
mastodon_api
needs change/feedback
needs docs
needs tests
not a bug
planned
pleroma_api
privacy
question
static_fe
triage
wontfix
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: AkkomaGang/akkoma#878
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "ilja/akkoma:add_fep-c16b_discovery_mechanism_to_not_always_reparse_mfm"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Related: #381
Now that our
content
uses html for expressing MFM (#823), FEP-c16b allows us to use a detection mechanism to indicate that the MFM does not require reparsing. This PR is the implementation for that.I first thought about always adding the key, but then realised that older posts aren't FEP-c16b formatted. I therefor decided to explicitly add the key to newly created MFM statusses. There will be some posts between latest release and this PR who are properly formatted while not having this discovery mechanism, but that's OK. Receiving servers will re-parse the content just like what happened previously.
TODO in this PR
@context
to inlude the htmlMfm key2025-04-062025-06-21 (in latest form)content
for posts, also when it's MFM. #38116bb564380
to47766297e3
47766297e3
to1b12168063
1b12168063
to454244d13a
454244d13a
to4a57821093
4a57821093
tod64b730714
d64b730714
to908ec0a738
908ec0a738
to5c8537aa25
5c8537aa25
tof82fbb431a
f82fbb431a
to90ec2168fe
90ec2168fe
to3b701e9974
WIP: Add htmlMfm key when relevantto Add htmlMfm key when relevant3b701e9974
toc9a36e4340
looks good to me; just some cosmetic nits
will real-world test it too now
@ -8,1 +8,4 @@
### Added
- We mark our MFM posts as FEP-c16b compliant, and do not re-parsed when receiving an MFM post who is marked as FEP-c16b compliant.
nit: currently the second part of the sentence is ungrammatical; consider e.g..
[...] and retain remote HTML representations for incoming posts marked as FEP-c16b-compliant. (Safety scrubbers are still applied)
This indeed sounds better thk you! Fixed now
@ -36,2 +36,3 @@
The optional extension term `htmlMfm` is currently not used.
We set the optional extension term `htmlMfm: true` when using content type "text/x.misskeymarkdown".
Incomming messages containing `htmlMfm: true` will not have their content re-parsed.
nit: Incoming
@ -49,3 +49,2 @@
def create(user, params) do
user
|> new(params)
new(user, params)
unrelated cosmetic change and the previous
user |> new(params)
form also seems more common in the current code baseah, yes. I changed this to make it easier for myself to reason about the pipeline, and then kept it bc it seemed an improvement for readability.
The way it was written (
user |> new(params) |> ...
) gives an initial impression that you have a User struct who's then being changed. But that's not what's happening; The pipeline is about adapting an ActivityDraft struct. Starting the first line with the creation of said ActivityDraft (new(user, params) |> ...
) makes this more explicit to whoever reads it.If you still prefer me to change it back, let me know and I'll change it back.
The reasoning for the change is convincing.
As a general remark, I believe it’s good to separate functional and unrelated cosmetic changes (as well as distinct functional changes) into different commits. This makes reviewing easier (no need to wonder how a change relates to the rest and knowing whether something is supposed to change the logic or merely refactoring it without affecting the overall logic also helps), can make backporting easier if needed (and for distinct functional changes allows bisects to be more effective).
Admittedly this isn’t really followed in this project though so its probably fine as is (i cannot mark this thread as resolved, otherwise i would)
This is good feedback, and of a type I often feel I miss (and probably explains why not often followed), thank you. I'll leave it as is now bc you said you'll also be testing it, and otherwise it may give unwanted problems due to diverting branches, but I'll keep it in mind for the future. I approached this one a bit more chaotic than I usually do, but it would not have been difficult to keep the changes better separated.
Can you fix the merge conflict?
I believe I tested this before applying it myself, but it would be reassuring to have a test making sure any received HTML is still passed through the sanitizer to remove potential malicious bits
Add htmlMfm key when relevantto WIP: Add htmlMfm key when relevantWIP: Add htmlMfm key when relevantto Add htmlMfm key when relevant@Oneric wrote in #878 (comment):
Merge conflict resolved + I added extra tests. Doing this, I also noticed that the key was not stored in the database for incoming messages. This is now fixed and I added tests for the key having value true, false, or not be present.
thanks!
I deduplicated the test payloads in #943 which makes it easier to see at a glance how they differ and makes it imho easier to read in general