Kunena/Kunena-Forum

Protected Attachments shows only for Admins and Moderators

rich20 opened this issue · 9 comments

Describe the bug
https://www.kunena.org/forum/general-questions-and-how-tos/168491-images-not-shown-in-posts
Confirmed

To Reproduce

  1. set protect attachments to Yes
  2. write an answer in a topic
  3. upload an attachment (do not insert it into the post)
  4. submit
  5. go as Registered or Guest to this post

Actual result
No attachment is visible

System information

  • Joomla version: ‎5.1.2-dev and 4.4.6-dev
  • Joomla template: CASSIOPEIA
  • Kunena version: 6.3.3-DEV
  • Kunena template: Aurelia
  • Php version: 8.2.18
  • Database version: 10.5.23-MariaDB

Desktop

  • OS: Ubuntu 22.04.1 LTS
  • Browser: Chromium, Firefox and Opera

Furthermore when Enable private message is set to NO, attachments that aren't inserted in the message aren't even showing for admins and moderators.

I have made a fix for it, can-you check if it's ok now ?

Now also registered users can see the attachments but no guests, even it is set: Show Attachments for Guests and Show Images for Guests is yes.
Guests see: This message has an attachment file.
Please log in or register to see it.

  • Admins, mods and registered users can see attachments
  • Guests cannot see attachments

Can confirm. And when setting Show Attachments for Guests and Show Images for Guests to No, then no message is shown.
Furthermore when inserting an image in the post, for registered users the image is shown but the thumbnail as well with a wrong layout (independent from setting show image for quest)

2024-08-15 Screenshot 533

Just committed a new change to fix that

  • Success

Additional context
What I noticed:
When setting Show Images for Guests and Show Attachments for Guests = No
If you upload pictures or other attachments, but these are not inserted into the message, there is no hint for guests that they are not allowed to see the attachments.
Has this always been the case?

When setting Show Images for Guests and Show Attachments for Guests = No = no notice as I stated before. Really don't remember if this has always been the case, I know it worked and works well with inserted images.

Inserted image for guests with settings = NO
2024-08-16 Screenshot 535

Inserted image for registered: notice the fact that thumb is shown as well and with a weird layout
2024-08-16 Screenshot 536

Uploaded image for guests: no notice
2024-08-16 Screenshot 539

Uploaded image for registered: notice the fact that thumb is in correct layout.
2024-08-16 Screenshot 537

Just my findings. I am already very happy with the work you did and can live with it. The most important issues have been solved.

Another finding:
2024-08-16 Screenshot 540
With multiple images, the text is displayed twice. So the constants COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG_MULTIPLES and COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG_SIMPLE are not used.

When inspecting with language debug it shows constant COM_KUNENA_SHOWIMGFORGUEST_HIDEIMG.
2024-08-17 Screenshot 541

This constant is found in KunenaAttachment.php and KunenaBBCode.php.

No big problem either, but I think there is a conflict somewhere.

This issue is stale because it has been open 30 days with no activity.