Defect #5679

Watchers not cleaned/updated when deleting/moving watched object

Added by Alexey Kiryanov over 10 years ago. Updated 7 months ago.

Status:ClosedStart date:2010-06-12
Priority:NormalDue date:
Assignee:-% Done:

0%

Category:Database
Target version:-
Resolution:Fixed Affected version:

Description

I have found field in the 'watchers' table to the non-existing forum post (it was deleted with a project).

Postgresql 8.1
ruby 1.8.7
Rails 2.3.5


Related issues

Related to Redmine - Patch #33329: Improve watchers functionality to mark the users that are... New
Related to Redmine - Feature #7296: Ability for admin to delete users Closed 2011-01-11

History

#1 Updated by de ewr over 10 years ago

  • Assignee set to Jean-Baptiste Barth
  • % Done changed from 0 to 10

#2 Updated by Holger Just over 10 years ago

  • Assignee deleted (Jean-Baptiste Barth)
  • % Done changed from 10 to 0

This is a general issue with acts_as_watchable.

Watchers are not updated on

  • issue move
  • issue delete

#3 Updated by Jean-Baptiste Barth over 10 years ago

  • Subject changed from database garbage to Watchers not cleaned/updated when deleting/moving watched object
  • Affected version (unused) changed from 0.9.3 to devel
  • Affected version deleted (0.9.3)

#4 Updated by Marius BALTEANU 7 months ago

  • Status changed from New to Closed
  • Resolution set to Fixed

Tested on the current trunk and watchers are deleted when an issue is deleted.

Before:

D, [2020-04-20T14:49:48.968211 #66] DEBUG -- :   Watcher Load (0.7ms)  SELECT  `watchers`.* FROM `watchers` LIMIT 11
=> #<ActiveRecord::Relation [#<Watcher id: 362429562, watchable_type: "Issue", watchable_id: 2, user_id: 1>, #<Watcher id: 580717795, watchable_type: "Message", watchable_id: 1, user_id: 1>, #<Watcher id: 999578971, watchable_type: "Issue", watchable_id: 2, user_id: 3>, #<Watcher id: 999578972, watchable_type: "Issue", watchable_id: 4, user_id: 4>, #<Watcher id: 999578973, watchable_type: "Issue", watchable_id: 2, user_id: 4>]>
irb(main):002:0> Watcher.all

After I've deleted Issue#4

D, [2020-04-20T14:50:13.301428 #66] DEBUG -- :   Watcher Load (0.7ms)  SELECT  `watchers`.* FROM `watchers` LIMIT 11
=> #<ActiveRecord::Relation [#<Watcher id: 362429562, watchable_type: "Issue", watchable_id: 2, user_id: 1>, #<Watcher id: 580717795, watchable_type: "Message", watchable_id: 1, user_id: 1>, #<Watcher id: 999578971, watchable_type: "Issue", watchable_id: 2, user_id: 3>, #<Watcher id: 999578973, watchable_type: "Issue", watchable_id: 2, user_id: 4>]>

For issue move, the watcher should not be deleted automatically, but there is a new issue to mark them as invalid (when the watcher watches a non visible object, please see #33329).

#5 Updated by Marius BALTEANU 7 months ago

  • Related to Patch #33329: Improve watchers functionality to mark the users that are watching a non visible object and to not return watchers that cannot see the object added

#6 Updated by Marius BALTEANU 7 months ago

  • Related to Feature #7296: Ability for admin to delete users added

#7 Updated by Marius BALTEANU 7 months ago

Removing watchers on issue delete was fixed in #7296.

Also available in: Atom PDF