Edit blogs, and add blog icons and banners (#460)
Also adds a parameter to `md_to_html` to only render inline elements (so that we don't have titles or images in blog descriptions). And moves the delete button for the blog on the edition page. I still have to update the SQLite migration once others PRs with migrations will be merged. Also, there will be a problem when you edit a blog while not owning its banner or icon: when validating they will be reset to their default values… I don't see a good solution to this until we have a better way to handle uploads with Rocket (the same is probably happening for articles btw). And the icon/banner are not federated yet, I don't know if I should add it to this PR or if it can come after?   Fixes #453 Fixes #454
This commit is contained in:
@@ -34,14 +34,16 @@ pub struct NewFollow {
|
||||
}
|
||||
|
||||
impl Follow {
|
||||
insert!(follows, NewFollow, |inserted, conn| {
|
||||
if inserted.ap_url.is_empty() {
|
||||
insert!(
|
||||
follows,
|
||||
NewFollow,
|
||||
|inserted, conn| if inserted.ap_url.is_empty() {
|
||||
inserted.ap_url = ap_url(&format!("{}/follows/{}", CONFIG.base_url, inserted.id));
|
||||
inserted.save_changes(conn).map_err(Error::from)
|
||||
} else {
|
||||
Ok(inserted)
|
||||
}
|
||||
});
|
||||
);
|
||||
get!(follows);
|
||||
find_by!(follows, find_by_ap_url, ap_url as &str);
|
||||
|
||||
@@ -88,7 +90,11 @@ impl Follow {
|
||||
)?;
|
||||
|
||||
let mut accept = Accept::default();
|
||||
let accept_id = ap_url(&format!("{}/follow/{}/accept", CONFIG.base_url.as_str(), &res.id));
|
||||
let accept_id = ap_url(&format!(
|
||||
"{}/follow/{}/accept",
|
||||
CONFIG.base_url.as_str(),
|
||||
&res.id
|
||||
));
|
||||
accept.object_props.set_id_string(accept_id)?;
|
||||
accept.object_props.set_to_link(from.clone().into_id())?;
|
||||
accept.object_props.set_cc_link_vec::<Id>(vec![])?;
|
||||
|
||||
Reference in New Issue
Block a user