ProLight

Clicking Mark all read makes notification icon move right - ProLight

Clicking Mark all read makes notification icon move right

by exemplary1 » Mon Sep 09, 2024 5:41 pm

Hi,
When I click on Mark all read on Notification icon, the icon moves toward message icon. Refreshing page or browsing makes it OK again.
Any solution to this ?
Thank you.
exemplary1
Registered User
Posts: 216
Joined: Mon Feb 05, 2024 11:41 am

Re: Clicking Mark all read makes notification icon move righ

by cabot » Mon Sep 23, 2024 3:27 pm

Hello,

Because there is a class added in the HTML if a badge is displayed (with the number of notifications).
But this class is not removed directly when you click on ‘Mark all read’, only when the page is refreshed.

One solution would be to extend the AJAX function to remove the class at the same time as the badge.
Untested but you can try by adding something like this to overall_footer.html (before EVENT overall_footer_body_after):

Code: Select all

<script>
    var originalMarkNotifications = phpbb.markNotifications;

    phpbb.markNotifications = function($popup, unreadCount) {
        originalMarkNotifications($popup, unreadCount);

        if (!unreadCount) {
            $('#notification_list_button').parent().removeClass('light-badge-count');
        }
    };
</script>
User avatar
cabot
Registered User
Posts: 797
Joined: Sat Jan 07, 2012 4:16 pm

Re: Clicking Mark all read makes notification icon move righ

by exemplary1 » Mon Sep 23, 2024 4:46 pm

cabot wrote: Hello,

Because there is a class added in the HTML if a badge is displayed (with the number of notifications).
But this class is not removed directly when you click on ‘Mark all read’, only when the page is refreshed.

One solution would be to extend the AJAX function to remove the class at the same time as the badge.
Untested but you can try by adding something like this to overall_footer.html (before EVENT overall_footer_body_after):

Code: Select all

<script>
    var originalMarkNotifications = phpbb.markNotifications;

    phpbb.markNotifications = function($popup, unreadCount) {
        originalMarkNotifications($popup, unreadCount);

        if (!unreadCount) {
            $('#notification_list_button').parent().removeClass('light-badge-count');
        }
    };
</script>
Worked like a charm! Thank you very much.
exemplary1
Registered User
Posts: 216
Joined: Mon Feb 05, 2024 11:41 am