Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update front.html.twig Add border to non federated notifications for admins and moderators #1297

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions templates/notifications/front.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,24 @@
</button>
</div>
</div>

</div>

{% for notification in notifications %}
<div class="{{ html_classes('section section--small notification', {'opacity-50': notification.status is not same as 'new' }) }}">
<div class="{{ html_classes('section section--small notification', {'opacity-50': notification.status is not same as 'new' }) }}"
{% if not notification.entry.magazine.apId and not notification.post.magazine.apId and (app.user.admin or app.user.moderator) %}
Copy link
Member

@melroy89 melroy89 Dec 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you also tested on if the variable is not-set / null or empty?? And if these checks are not causing any 503 errors?

(eg. when you are not an admin or something like that)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I tested the lot and it's live on my instance, the variables are always set, which surprised me. Check me in mbin development as there is one weird situation with comments

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I tested the lot and it's live on my instance, the variables are always set, which surprised me.

Well, because you are an admin? Try to login with a regular account?

Copy link
Contributor Author

@TheVillageGuy TheVillageGuy Dec 23, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes I tested the lot and it's live on my instance, the variables are always set, which surprised me.

Well, because you are an admin? Try to login with a regular account?

I did, and if the user is not an admin they never reach the code. I'm stil looking at moderators, it is not working as I had hoped.

I always test everything with a regular account after updates and when changing things

style="border-color:var(--kbin-upvoted-color);"
{% set titleString = 'notification_created_on_this_instance'|trans %}
{% if notification.comment.user is not same as null %}
{% set titleString = titleString ~ notification.comment.user.username %}
{% elseif notification.entry.user is not same as null %}
{% set titleString = titleString ~ notification.entry.user.username %}
{% elseif notification.post.user is not same as null %}
{% set titleString = titleString ~ notification.post.user.username %}
{% elseif notification.message.sender is not same as null %}
{% set titleString = titleString ~ notification.message.sender.username %}
{% endif %}
title="{{ titleString }}"
{% endif %}>
<div>
{%- with {
notification: notification,
Expand Down
Loading