Skip to content

Multiple thread follower rows can be added #1932

@trichoplax

Description

@trichoplax

Describe the bug
If a page is in a different state to the server (for example, if multiple tabs are open and one changes the state) it is possible to follow a thread multiple times, each time adding a separate row to the thread_followers table. Unfollowing then requires pressing "unfollow" that many times, since each time only removes 1 of the rows.

To Reproduce
Steps to reproduce the behavior:

  1. Open a post with a thread under it that the user is not following.
  2. Open it again in another tab.
  3. In the first tab, press "follow".
  4. In the second tab, press "follow".
  5. There are now 2 rows in the thread_followers table for that thread and that user, and "unfollow" will need to be pressed twice before it will change to show "follow" again.

Expected behavior
There should only ever be zero or one rows in the database for a given combination of user and thread. Compare with the behaviour for following new threads on a post. See app/controllers/comments_controller lines 332-350.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions