-
Notifications
You must be signed in to change notification settings - Fork 133
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
make blog/instance description a SafeString #223
Conversation
long_description & short_description's documentation say they can be Markdown, but they are String, not SafeString. This led to escaped strings being printed in the editor #220
n.b.: This is a work-in-progress and does not solve the problem yet |
For the
|
plume-models/src/blogs.rs
Outdated
@@ -142,8 +143,8 @@ impl Blog { | |||
name: inst.clone(), | |||
local: false, | |||
// We don't really care about all the following for remote instances | |||
long_description: String::new(), | |||
short_description: String::new(), | |||
long_description: SafeString::new(&<String>::new()), |
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.
you can change &<String>::new
here to just ""
, since SafeString::new()
takes a &str
. It will save an allocation, at least, especially since currently the allocation just gets dropped and another is made in the ammonia::clean
function.
plume-models/src/users.rs
Outdated
@@ -205,8 +205,8 @@ impl User { | |||
public_domain: inst.clone(), | |||
local: false, | |||
// We don't really care about all the following for remote instances | |||
long_description: String::new(), | |||
short_description: String::new(), | |||
long_description: SafeString::new(&<String>::new()), |
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.
Same comment here re: String::new
src/setup.rs
Outdated
@@ -152,8 +153,8 @@ fn quick_setup(conn: DbConn) { | |||
public_domain: domain, | |||
name: name, | |||
local: true, | |||
long_description: String::new(), | |||
short_description: String::new(), | |||
long_description: SafeString::new(&<String>::new()), |
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.
and here as well
@pwoolcoc thank you for your review! (by which i mean, "now to find out how to make use of it") |
@igalic Thanks for working on this. Rocket will use your |
thanks to @fdb-hiroshima for this review!
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.
big confused about @pwoolcoc's code here ;)
okay! so with the last commit (06718a5) i've now done everything everyone on here has so helpfully suggested which means that it now… still doesn't work 😅 |
I think you did all that was needed on rust side. Now you just have to edit templates to add Plume/templates/users/header.html.tera Line 41 in d355379
This should be in templates/instance/admin.html.tera I think.
|
but that's not done with content: Plume/templates/posts/new.html.tera Line 31 in d355379
|
@fdb-hiroshima i tried |
The exact line you need is |
thanks again to @fdb-hiroshima for pointing me in the right direction!
long_description & short_description's documentation say they can be
Markdown, but they are String, not SafeString.
This led to escaped strings being printed in the editor
#220