XF 2.2 Bug? Alert icon shows "New" count even if none

creativeforge

Well-known member
Not sure of it is a bug or what it is related to, but when we change page, the bell icon shows a count and red bubble, the nothing.


If you click any of these threads, you will see it. Plus it shows twice, something I had fixed before 2.2.2. The bell in the member applet disappears within a second.

Thanks for any help.

Andre

alerts.webp
 
This issue is essentially always down to outdated templates/incorrect template customizations or an add-on. Given the appearance of your screenshot, it's very likely that it's a template issue (as there are now 2 values which may refer to alerts, including the "correct" version being renamed to make their individual meanings clearer).
 
(Thanks for moving my post to the right forum). Yes, I customized the template to place that notification on a sticky toolbar menu, and hide the top icon (https://xenforo.com/community/threads/replicate-the-alerts-icon-dropdown.170919/). Which occurs with one second delay now AND showing a notification when there is not alerts (the red bubble disappears, illustrating that). But it wasn't this way before the upgrade to 2.2.2. So I'm wondering what changed in 2.2.2 so I could address it.

Thank you, Mike.

Andre
 
Last edited:
This isn't something that changed in 2.2.2 specifically, though I don't know what you upgraded from. It did change between 2.1 and 2.2. If you were already running 2.2, I can only guess that there was a bad template merge at some point.

If you did just upgrade from 2.1, you may want to redo the customizations to ensure they're fully up to date, though this particular issue is likely because you're referring to the "old" alerts count value. The new way would be via $xf.visitor.alerts_unviewed.
 
This isn't something that changed in 2.2.2 specifically, though I don't know what you upgraded from. It did change between 2.1 and 2.2. If you were already running 2.2, I can only guess that there was a bad template merge at some point.

If you did just upgrade from 2.1, you may want to redo the customizations to ensure they're fully up to date, though this particular issue is likely because you're referring to the "old" alerts count value. The new way would be via $xf.visitor.alerts_unviewed.

Yes, we updated from 2.1.x.

So I see this in the template helper_js_global

Code:
visitorCounts: {
                conversations_unread: '{$xf.visitor.conversations_unread|number}',
                alerts_unviewed: '{$xf.visitor.alerts_unviewed|number}',
                total_unread: '{{ ($xf.visitor.conversations_unread + $xf.visitor.alerts_unviewed)|number }}',
                title_count: {{ in_array($xf.options.displayVisitorCount, ['title_count', 'title_and_icon']) ? 'true' : 'false' }},
                icon_indicator: {{ in_array($xf.options.displayVisitorCount, ['icon_indicator', 'title_and_icon']) ? 'true' : 'false' }}
            },


Does it look right? Looks like it is using $xf.visitor.alerts_unviewed or am I not understanding?

Thanks!
 
So the question: if there
This isn't something that changed in 2.2.2 specifically, though I don't know what you upgraded from. It did change between 2.1 and 2.2. If you were already running 2.2, I can only guess that there was a bad template merge at some point.

If you did just upgrade from 2.1, you may want to redo the customizations to ensure they're fully up to date, though this particular issue is likely because you're referring to the "old" alerts count value. The new way would be via $xf.visitor.alerts_unviewed.

EDIT: doing that right now, updating the styles.

Thanks!
 
Last edited:
This isn't something that changed in 2.2.2 specifically, though I don't know what you upgraded from. It did change between 2.1 and 2.2. If you were already running 2.2, I can only guess that there was a bad template merge at some point.

If you did just upgrade from 2.1, you may want to redo the customizations to ensure they're fully up to date, though this particular issue is likely because you're referring to the "old" alerts count value. The new way would be via $xf.visitor.alerts_unviewed.
Hi Mike,

OK, so I find this code in my Page_Container template.
Code:
$xf.visitor.user_id
.

Are you suggesting I manually change all of these to
Code:
$xf.visitor.alerts_unviewed
?


Regards,

Andre
 
When I'm referring to redoing customizations, I generally mean reverting your customizations and then roughly reapplying them. Depending on the changes you're making, this may be down to moving the new version of the code to the location you desire and then making your changes to it.

In terms of the specific change, you probably still have code that's referring to alerts_unread -- this is now alerts_unviewed -- in the PAGE_CONTAINER template. (That's why I was suggesting redoing edits based on the new version of the code, because if you reverted the template and then just pasted the old code in, you'd still have that and you wouldn't have picked up on what has changed.)
 
When I'm referring to redoing customizations, I generally mean reverting your customizations and then roughly reapplying them. Depending on the changes you're making, this may be down to moving the new version of the code to the location you desire and then making your changes to it.

In terms of the specific change, you probably still have code that's referring to alerts_unread -- this is now alerts_unviewed -- in the PAGE_CONTAINER template. (That's why I was suggesting redoing edits based on the new version of the code, because if you reverted the template and then just pasted the old code in, you'd still have that and you wouldn't have picked up on what has changed.)

OK, so we did that (although, and you are right it's not doing this anymore. Although, I did not change "unread" with "unviewed." So not sure if that is essential to do anyway if there are no issues anymore?

Thanks!
 
alerts_unread and alerts_unviewed simply mean different separate things now. There was only one value in the past (unread), but the meaning of that has changed to be more fitting with the actual name. You should use "unviewed" as that's the correct value for the old behavior (and what we expect).

The issue you were reporting initially -- alerts showing and then disappearing -- is specifically because you're referring to "unread" instead of "unviewed" as it's using inconsistent values and thus creating inconsistent behavior.
 
alerts_unread and alerts_unviewed simply mean different separate things now. There was only one value in the past (unread), but the meaning of that has changed to be more fitting with the actual name. You should use "unviewed" as that's the correct value for the old behavior (and what we expect).

The issue you were reporting initially -- alerts showing and then disappearing -- is specifically because you're referring to "unread" instead of "unviewed" as it's using inconsistent values and thus creating inconsistent behavior.
AH, good to know, thanks for this, Mike. Understanding why is helpful. So basically I renamed all tags "unread" to "unviewed" in Page_Container. But if I do a search for unread, I get a load of templates using the term. Only 4 of them are "red."

In EXTRA.LESS,
Code:
.is-unread .structItem-title {
    letter-spacing: 0.05em;
}

Sorry if this should be self-evident, I just don't want to break the site.

Regards,

Andre
 
Do NOT hard-code replace the word "unread" with "unviewed" in Page_Container. It resulted in 2678 pages of 53,550 server errors.

replaced-unviewed.webp


So, what did I miss?

My question is in response to Mike's explanation: "You should use "unviewed" as that's the correct value for the old behavior (and what we expect). The issue you were reporting initially -- alerts showing and then disappearing -- is specifically because you're referring to "unread" instead of "unviewed" as it's using inconsistent values and thus creating inconsistent behavior."

What do I do with this ^ information? I need to know exactly which template should be modified specifically, otherwise it clearly makes little sense to me (and I feel pretty stupid).

Thank you in advance,

Andre
 
I was definitely not suggesting any sort of global replacements. My comments all relate to the use of $xf.visitor.alerts_unread (old, now incorrect) instead of $xf.visitor.alerts_unviewed (new, now correct) in the PAGE_CONTAINER template. I was also specifically referring to changes in your customizations (assuming you have been using the template merging system to bring other changes into place). Definitely not in other templates that you haven't modified (because they are automatically updated as needed).
 
I was definitely not suggesting any sort of global replacements. My comments all relate to the use of $xf.visitor.alerts_unread (old, now incorrect) instead of $xf.visitor.alerts_unviewed (new, now correct) in the PAGE_CONTAINER template. I was also specifically referring to changes in your customizations (assuming you have been using the template merging system to bring other changes into place). Definitely not in other templates that you haven't modified (because they are automatically updated as needed).

Thanks Mike, that is the information I needed. In my ignorance I obviously misunderstood, so that's why I asked again.

Thanks for taking the time to clarify. :)

Andre
 
Quite honestly, your best bet is to revert the template, then add your edits back in, instead of trying to reverse engineer it.

I wish I could, but I hacked templates I shouldn't have, and in the end everything was fine until I updated the styles. And I don't recall everything I did over the past 2 years...
 
I wish I could, but I hacked templates I shouldn't have, and in the end everything was fine until I updated the styles. And I don't recall everything I did over the past 2 years...
did you wind up fixing this?
I think we are having the same problem, whenever I, or anyone else logs on, the alert red bubble will show some number, lets say 12 notifications, and immediately change to the actual, like 4. this has been happening since the last upgrade, and I'm not quite sure how to fix it.
thanks
 
Not sure of it is a bug or what it is related to, but when we change page, the bell icon shows a count and red bubble, the nothing.


If you click any of these threads, you will see it. Plus it shows twice, something I had fixed before 2.2.2. The bell in the member applet disappears within a second.

Thanks for any help.

Andre

View attachment 242881

how did you get notifications from left to right
 
Top Bottom