Edit blogs, and add blog icons and banners #460
Değerlendirici yok
Etiketler
Etiket Yok
A: API
A: Backend
A: Federation
A: Front-End
A: I18N
A: Meta
A: Security
Build
C: Bug
C: Discussion
C: Enhancement
C: Feature
Compatibility
Dependency
Design
Documentation
Good first issue
Help welcome
Mobile
Rendering
S: Blocked
S: Duplicate
S: Incomplete
S: Instance specific
S: Invalid
S: Needs Voting/Discussion
S: Ready for review
Suggestion
S: Voted on Loomio
S: Wontfix
Kilometre Taşı Yok
Proje yok
Atanan Kişi Yok
2 Katılımcı
Bildirimler
Bitiş Tarihi
Bitiş tarihi atanmadı.
Bağımlılıklar
Bağımlılık yok.
Referans: Plume/Plume#460
Yükleniyor…
Tablo ekle
Yeni konuda referans
Herhangi bir açıklama sağlanmadı.
"blog-edit" Dalını Sil
Bir dalı silmek kalıcıdır. Her ne kadar silinen dal tamamen kaldırılana kadar çok kısa bir süre yaşamını sürdürse de, çoğu durumda bu işlem GERİ ALINAMAZ. Devam edilsin mi?
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
Codecov Report
👀
or all three?
@ -33,0 +47,4 @@
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)">@author.name()</a>}
</p>
@Html(blog.summary_html.clone())
</main>
isn't the Avatar also optional?
@ -33,0 +47,4 @@
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)">@author.name()</a>}
</p>
@Html(blog.summary_html.clone())
</main>
icon_url returns either the blog avatar, or the default one (see https://github.com/Plume-org/Plume/pull/460/files#diff-a4a32b57517e9459ff561610609f8044R364 )
Yes, at the time I wrote the comment
summary_html
was not here yet. 😁@ -33,0 +47,4 @@
<a class="author p-author" href="@uri!(user::details: name = &author.fqn)">@author.name()</a>}
</p>
@Html(blog.summary_html.clone())
</main>
duh, thanks!
👀
I find it a bit strange that one function return a default String and the other an Option (also,
unwrap_or(xxx.to_string())
, @igalic would get mad if it reached masterI'm not sure comments should be allowed to contain pictures and titles
@ -173,0 +282,4 @@
blog.summary = form.summary.clone();
blog.summary_html = SafeString::new(&utils::md_to_html(&form.summary, "", true).0);
blog.icon_id = form.icon;
blog.banner_id = form.banner;
user can provide the id of a media they don't own, or of a non-picture media
if let Some(banner) = blog.banner_url(ctx0)
would make more sense here, so there is no unwrap_or_defaultnot if my pr gets merged first
It makes sense to me that they don't have the same return type: in one case we provide a fallback URL, in the other case we just want to not display any image.
And I don't know what would be the correct way to replace this
unwrap_or
… 😅unwrap_or_else
because you're calling a function, so let's not call it if it's not necessaryDoes this function actually do what it says it does?
Looks like I pushed too fast… 😅
There is no way to remove pictures once you set theme, you can just replace with something else
👍
@ -47,3 +51,4 @@
pub banner_id: Option<i32>,
}
#[derive(Default, Insertable)]
I don't understand what this does, but apparently it did the trick
@ -47,3 +51,4 @@
pub banner_id: Option<i32>,
}
#[derive(Default, Insertable)]
It is an option for the
#[derive(AsChangeset)]
, that tells diesel to considerOption
fields that areNone
to be considered asNULL
in SQL, instead of not being included in the query at all.@ -47,3 +51,4 @@
pub banner_id: Option<i32>,
}
#[derive(Default, Insertable)]
Ok, doesn't this potentially break other things that relied on it before in our code?
@ -47,3 +51,4 @@
pub banner_id: Option<i32>,
}
#[derive(Default, Insertable)]
not according to our extensive tests
@ -47,3 +51,4 @@
pub banner_id: Option<i32>,
}
#[derive(Default, Insertable)]
Test in production ™️
@ -47,3 +51,4 @@
pub banner_id: Option<i32>,
}
#[derive(Default, Insertable)]
It only affects the
AsChangeset
implementation, which is used whenUPDATE
ing blogs, so I think it is the only place we are doing that.