Simple Machines Community Forum

SMF Development => Bug Reports => Fixed or Bogus Bugs => Topic started by: @rjen on May 04, 2022, 06:25:51 AM

Title: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on May 04, 2022, 06:25:51 AM
Forum version: SMF2.1.1.
PHP Version 7.4.29

Trying to use the new function to "Not Follow" a topic gives some strange results..

This is what happens:
I set a topic to "Not Following".

According to the text this should result in the Topic not showing up in my Unread items when new replies are posted...
2022-05-04_122200.jpg

But this seems not to work: when a new Reply is posted the topic is showing as unread regardless..
Funny side effect is that now it is not possible to mark it read anymore..

Reading it, and it still shows up as new in the unread topics.
In the message itself it does state that the message is read: If I thane change the topic back to "No Alerts or Emails" it disappears from the Unread items

It seems that the logic for Unread items is somehow not working correctly for topics that are marked to "Not Follow"


Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on May 08, 2022, 05:09:47 AM
Is this just me, or is this a bug in SMF 2.1?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Arantor on May 08, 2022, 05:15:49 AM
It's sort of the point but also a bit of a bug.

The idea is that if you are explicitly not watching, you don't want it to appear in unread etc. but I think this has moved slightly since it was originally implemented like 10 years ago.
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on May 08, 2022, 05:24:08 AM
Thing is that it DOES show up in unread when I try not to follow a topic
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Arantor on May 08, 2022, 05:25:18 AM
Then it's definitely not working as intended :(
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on May 08, 2022, 05:36:45 AM
It is working here, so it must be a local issue
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on May 12, 2022, 11:59:38 AM
Setup a vanilla install of SMF2.1.2 and that works fine.

My production forum is if course upgraded from 2.0.19 and it behaves differently: the topic that I set to not follow DOES show up in the recent topics, and I cannot mark it read as long as I leave it set on NOFOLLOW..

I did some digging in the code and in the tables, but I do not see any differences in the core files such as Recent.php and Recent.template.php, nor do I see differences in the database updates that explain this behaviour..

Anyony have any idea where to look further?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Dekudibusei on September 03, 2022, 05:38:43 PM
Hi everyone, I'm one of @rjen's minions (hehe). It's quite the annoying bug, and as one of the support guys I run into it as well, and more often than most users, I reckon. Has there this been verified already? Is it a borked setting? If not, it's definitely a bug, but we can't seem to find where it's coming from. Any hope of a centralized fix?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Steve on September 19, 2022, 09:21:26 AM
Is this still an issue?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 19, 2022, 10:10:27 AM
Yep
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Kindred on September 19, 2022, 10:51:56 AM
rjen -- you confirmed that it works as expected on a clean installation ---   so, it has to be due to some configuration, mod or customization -- yes?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 19, 2022, 11:31:53 AM
Correct, but like I mentioned at the time: I cannot find the cause, so I am still hoping for some guidance where to look...
I personally am not suffering that much from the situation, but as it seems my 'Minions'  do...

Quote from: @rjen on May 12, 2022, 11:59:38 AMSetup a vanilla install of SMF2.1.2 and that works fine.

My production forum is if course upgraded from 2.0.19 and it behaves differently: the topic that I set to not follow DOES show up in the recent topics, and I cannot mark it read as long as I leave it set on NOFOLLOW..

I did some digging in the code and in the tables, but I do not see any differences in the core files such as Recent.php and Recent.template.php, nor do I see differences in the database updates that explain this behaviour..

Anyony have any idea where to look further?


386b4d3f939714a3185d543b79ba5a4a.jpg
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Steve on September 19, 2022, 12:24:46 PM
Should I assume you've tried uninstalling the mods one at a time and see if the problem goes away?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 20, 2022, 08:32:44 AM
You can assume that, but that is not what I have done: since this is a productive forum I do not want to start uninstalling mods and hinder the users because I need to find a bug somewhere.

Instead I have done this:
- installed a vanilla 2.1.2 forum on Xampp locally

tested the 'Not Follow" function and it worked fine

- took a backup of the production database and imported that into the test forum

tested the 'Not Follow" function and it worked fine

- one by one installed the MODs and after each mod tested the 'Not Follow' function and it work fine everytime

So now I have a new install 2.1.2 locally with the production database and all mods that are in production, and the functionality works fine...

That is pretty well were I am... still no clue where the problem originates...

The last thing I will do later is to compare the full local codebase with that of the productive forum and see if any code difference come to light.... >:(
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: TwitchisMental on September 20, 2022, 12:12:22 PM
Quote from: @rjen on September 20, 2022, 08:32:44 AMYou can assume that, but that is not what I have done: since this is a productive forum I do not want to start uninstalling mods and hinder the users because I need to find a bug somewhere.

Instead I have done this:
- installed a vanilla 2.1.2 forum on Xampp locally

tested the 'Not Follow" function and it worked fine

- took a backup of the production database and imported that into the test forum

tested the 'Not Follow" function and it worked fine

- one by one installed the MODs and after each mod tested the 'Not Follow' function and it work fine everytime

So now I have a new install 2.1.2 locally with the production database and all mods that are in production, and the functionality works fine...

That is pretty well were I am... still no clue where the problem originates...

The last thing I will do later is to compare the full local codebase with that of the productive forum and see if any code difference come to light.... >:(
Just throwing this out there from left field..

During the testing on your local xampp setup, are you using the same theme as the production site?
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 20, 2022, 12:18:54 PM
Yep, happens on both themes,

And I compared sources and both theme files and not finding any relevant differences
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: TwitchisMental on September 20, 2022, 12:28:50 PM
Quote from: @rjen on September 20, 2022, 12:18:54 PMYep, happens on both themes,

And I compared sources and both theme files and not finding any relevant differences
Another really random and crazy idea here..

Have you tried making a local SMF 2.0 install, then upgrade it to 2.1, then try to replicate the issue?

While unlikely, I am wondering if something during the upgrade process could be the cause. 


Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 20, 2022, 04:44:29 PM
Right now I can only try to debug the code to find what the ... is happening.

Can someone tell me where the "Not Following" information is stored when a user chooses not to follow a certain topic?

Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Kindred on September 20, 2022, 05:12:15 PM
I would assume that the "not following"" record is not an existent instant as such. Instead instead the logic probably is remove the following tracker Of course I haven't looked at the actual code myself
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: shawnb61 on September 20, 2022, 06:03:36 PM
Did you migrate during RC, or later, directly to 2.1.0+?

This PR comes to mind, late in the RCs:
https://github.com/SimpleMachines/SMF/pull/6683

Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 21, 2022, 01:32:24 AM
I migrated directly from 2.0.19 to 2.1

Thinks for the link, I will check it later today
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 21, 2022, 03:06:53 AM
Quote from: shawnb61 on September 20, 2022, 06:03:36 PMThis PR comes to mind, late in the RCs:
https://github.com/SimpleMachines/SMF/pull/6683


Checked the PR, but that does not seem to apply: the PR is releated to the update of table 'smf_log_notify' which holds entries for topics that users DO want to be notified on.

The problem I have is with the setting "Not following" on a topic
2022-09-21_090315.jpg
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 21, 2022, 03:53:50 PM
Got a little further and some result...

The Not following is stored in table smf_log_topics in the column 'unwatched'
Update and all working

In recent.php this table is read.

Now there is something specific:

If there are less then 100.000 messages in the forum the code builds up an internal table called "log_topics_unread" and processes that, if the number of messages exceeds 100.000 another query is used to retrieve the data...

Now my forum has around 300.000 messages, so query 2 is used, and it keeps showing the topics that re 'unwatched' in the unread topics.
Now when I change the threshold value to 1.000.000 messages the functionality works..

So the first query with the internal table  "log_topics_unread" gives the correct result, but the second query, reading the smf_log_topics table does not.

Still hoping that one of the devs can have a look into these functions and explain the different behaviour...
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: shawnb61 on September 22, 2022, 11:28:38 PM
There was a fix in this area not too long ago:
https://github.com/SimpleMachines/SMF/pull/6908

To:
https://github.com/SimpleMachines/SMF/issues/6907

My initial thought is that the fix addressed the <=100000 but not the >100000.  I'll take a peek.
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: shawnb61 on September 25, 2022, 01:33:03 AM
I believe I have a fix for this:
https://github.com/SimpleMachines/SMF/pull/7548

I was able to confirm the issue in my test forum, of a similar size (245K posts).

BUT...  Not just by clicking "Unread Posts".  Unread Posts invokes the logic for "RECENT UNREAD TOPICS".  That logic, I think, was working fine.  However, if you subsequently press the button for "ALL UNREAD TOPICS", the issue is visible.  I think this is why this was difficult for folks to reproduce.

I suspect @@rjen has a setting or template tweak somewhere that defaults "Unread Posts" to invoke "ALL UNREAD TOPICS".  I.e.,
/index.php?action=unread;all;start=0 as opposed to
/index.php?action=unread
The 'all;' in the URL is important.

The temporary table used for forums with > 100000 messages is only used when processing "ALL UNREAD TOPICS".

@@rjen - let me know if this addresses the issue!
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 25, 2022, 01:39:50 AM
I will check today.

I can confirm that we use the all unread instead of the default since last visit: that is indeed a tweak I made..
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: @rjen on September 25, 2022, 02:15:05 AM
Confirmed: I applied your correction and it solves the problem..

Wow, glad you found that one, that took a while...
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Steve on September 25, 2022, 06:55:46 AM
Marking solved as a solution to the OP's problem has been provided and submitted for future release.
Title: Re: "Not following" a Topic causes it to not be marked Read?
Post by: Dekudibusei on September 25, 2022, 01:27:39 PM
Brilliant! Many thanks, Shawn, hero material indeed!