mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-05-17 01:12:39 +00:00
Apply suggestions from code review
Co-authored-by: SleeplessOne1917 <28871516+SleeplessOne1917@users.noreply.github.com>
This commit is contained in:
parent
8d3498d288
commit
c275db4c03
|
@ -239,7 +239,7 @@ test("No image proxying if setting is disabled", async () => {
|
|||
let betaPost = await waitForPost(
|
||||
beta,
|
||||
post.post_view.post,
|
||||
res => res?.post.alt_text != null,
|
||||
res => res?.post.alt_text !== null,
|
||||
);
|
||||
expect(betaPost.post).toBeDefined();
|
||||
|
||||
|
|
|
@ -59,12 +59,12 @@ async function assertPostFederation(postOne: PostView, postTwo: PostView) {
|
|||
// Link metadata is generated in background task and may not be ready yet at this time,
|
||||
// so wait for it explicitly. For removed posts we cant refetch anything.
|
||||
postOne = await waitForPost(beta, postOne.post, res => {
|
||||
return res == null || res?.post.embed_title != null;
|
||||
return res === null || res?.post.embed_title !== null;
|
||||
});
|
||||
postTwo = await waitForPost(
|
||||
beta,
|
||||
postTwo.post,
|
||||
res => res == null || res?.post.embed_title != null,
|
||||
res => res === null || res?.post.embed_title !== null,
|
||||
);
|
||||
|
||||
expect(postOne?.post.ap_id).toBe(postTwo?.post.ap_id);
|
||||
|
|
|
@ -104,7 +104,7 @@ pub fn generate_post_link_metadata(
|
|||
let allow_sensitive = local_site_opt_to_sensitive(&local_site);
|
||||
let page_is_sensitive = post.nsfw;
|
||||
let allow_generate_thumbnail = allow_sensitive || !page_is_sensitive;
|
||||
let mut thumbnail_url = custom_thumbnail.or(post.thumbnail_url.map(Into::into));
|
||||
let mut thumbnail_url = custom_thumbnail.or_else(|| post.thumbnail_url.map(Into::into));
|
||||
let do_generate_thumbnail = thumbnail_url.is_none() && allow_generate_thumbnail;
|
||||
|
||||
// Generate local thumbnail only if no thumbnail was federated and 'sensitive' attributes allow it.
|
||||
|
|
Loading…
Reference in a new issue