Defect #38458
closedDisplay order of watchers in the sidebar is indeterminate
0%
Description
In the watcher section of an issue's sidebar, the order of watchers is not explicitly specified and is environment-dependent (see watcher_users
below).
I would suggest improving `watcher_users` to ensure that watchers are displayed in the order they are added.
lib/plugins/acts_as_watchable/lib/acts_as_watchable.rb:
module ClassMethods
def acts_as_watchable(options = {})
return if self.included_modules.include?(Redmine::Acts::Watchable::InstanceMethods)
class_eval do
has_many :watchers, :as => :watchable, :dependent => :delete_all
has_many :watcher_users, :through => :watchers, :source => :user, :validate => false
Files
Related issues
Updated by Holger Just over 1 year ago
How about ordering it alphabetically (or more specifically: sorted according to the chosen name formatting)? That way, long watcher lists would be easy to scan, we would not leak possible meta data about watchers, and the patch is small :)
This change could probably be implemented by this patch only:
diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb
index dfd3d5c490..d8a1e07759 100644
--- a/app/helpers/watchers_helper.rb
+++ b/app/helpers/watchers_helper.rb
@@ -48,7 +48,7 @@ def watcher_css(objects)
def watchers_list(object)
remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project)
content = ''.html_safe
- lis = object.watcher_users.collect do |user|
+ lis = object.watcher_users.sorted.collect do |user|
s = ''.html_safe
s << avatar(user, :size => "16").to_s
s << link_to_principal(user, class: user.class.to_s.downcase)
Updated by Go MAEDA over 1 year ago
I agree with your idea of sorting watchers by their names.
The reason I suggested displaying watchers in the order they were added is that watchers are currently often displayed in this order.
But now I think sorting watchers by their name is better than the order they are added. It is intuitive and the order of addition is not so important in ordinary situations.
Updated by Go MAEDA over 1 year ago
- File test-for-38458-note-2.patch added
- Subject changed from Undefined display order of watchers in the sidebar to Display order of watchers in the sidebar is indeterminate
- Target version set to 5.1.0
Setting the target version to 5.1.0.
Updated by Go MAEDA over 1 year ago
Updated by Go MAEDA over 1 year ago
- Status changed from New to Closed
- Assignee set to Go MAEDA
- Resolution set to Fixed
Committed the patch in r22225.
Updated by Holger Just 10 months ago
- Has duplicate Feature #19484: Users ordering added