From 70460b551deb4ed7bda7e3bb64c7ef7714407926 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Jaussoin?= Date: Sun, 5 Mar 2023 23:07:38 +0100 Subject: [PATCH] Enforce at least one picture to be attached when the Community is a gallery --- app/helpers/UtilsHelper.php | 2 +- .../CommunityHeader/_communityheader.tpl | 4 ++-- .../_communitysubscriptions.tpl | 5 +++++ app/widgets/Post/_post_ticket.tpl | 19 +++++-------------- app/widgets/Publish/Publish.php | 14 ++++++++++++++ app/widgets/Publish/locales.ini | 1 + 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/app/helpers/UtilsHelper.php b/app/helpers/UtilsHelper.php index 4f8f0bb4a..ce5576f72 100644 --- a/app/helpers/UtilsHelper.php +++ b/app/helpers/UtilsHelper.php @@ -190,7 +190,7 @@ function resolveInfos($postCollection) /** * Return a picture with a specific size */ -function getPhoto(string $key, string $size = 'm') +function getPhoto(string $key, string $size = 'm'): ?string { $sizes = [ 'xxl' => [1280, 300], diff --git a/app/widgets/CommunityHeader/_communityheader.tpl b/app/widgets/CommunityHeader/_communityheader.tpl index add62fc33..76eac40e2 100644 --- a/app/widgets/CommunityHeader/_communityheader.tpl +++ b/app/widgets/CommunityHeader/_communityheader.tpl @@ -1,12 +1,12 @@ {if="$info != null && $info->pubsubpublishmodel != null && $info->pubsubpublishmodel != 'publishers'"} {if="$info->pubsubpublishmodel == 'open' || ($info->pubsubpublishmodel == 'subscribers' && $subscription != null)"} - post_add + {if="$info->isGallery()"}add_photo_alternate{else}post_add{/if} {/if} {else} - post_add + {if="$info!= null && $info->isGallery()"}add_photo_alternate{else}post_add{/if} {/if}