maxrossello / redmine_extended_watchers

Grant additional issue and project view permissions to watcher users
GNU General Public License v3.0
44 stars 20 forks source link

Adding group members in protected mode prevents the add watchers dialog to popup #32

Closed maxrossello closed 2 years ago

maxrossello commented 3 years ago

In protected mode, when adding a group of users in the project memberships, the add watchers dialog for any issue is not popping up. Tested on 4.2.1 pre-release.

DolezalDavid commented 3 years ago

May I help you somehow? :-)

maxrossello commented 3 years ago

If you have development skills for debugging... :-) I need to get to some spare time to first align to RM 4.2.2 and then cover the case in automated tests and do some debugging

DolezalDavid commented 3 years ago

Hi, I don't know if it helps, but here is what I tracked in firefox, when I want add new watcher and plugin is in protected mode

obrazek

maxrossello commented 3 years ago

WatchersController.users_for_new_watcher lists also groups as assignable watchers, but Groups do not respond to :allowed_to?

I am going to validate the following patch

diff --git a/plugins/redmine_extended_watchers/lib/extended_watchers_controller_patch.rb b/plugins/redmine_extended_watchers/lib/extended_watchers_controller_patch.rb
index 36b1d110f..5eaf89841 100644
--- a/plugins/redmine_extended_watchers/lib/extended_watchers_controller_patch.rb
+++ b/plugins/redmine_extended_watchers/lib/extended_watchers_controller_patch.rb
@@ -36,7 +36,7 @@ module ExtendedWatchersControllerPatch
       end
     end
     if Setting.plugin_redmine_extended_watchers["policy"] == "protected" and @project.present?
-      users.reject! {|user| !user.allowed_to?(:view_issues, @project)}
+      users.reject! {|user| user.respond_to?(:allowed_to?) && !user.allowed_to?(:view_issues, @project)}
     end
     users
   end
DolezalDavid commented 3 years ago

Hi @maxrossello , I just test this patch and it dosn't work how I expected. Pop up windows with members to add doesn't show.

DolezalDavid commented 3 years ago

Hi @maxrossello , any news?

maxrossello commented 3 years ago

I haven't finalized the automated tests for a release because I've been rather busy, but the patch works for me. Please try cleaning stuff in the browser and make sure that the patch is applied. Do you still have a 500 error?

DolezalDavid commented 3 years ago

Huh... I made big mistake. Sorry @maxrossello .... The patch is OK. I made some tests on it and it looks OK. Thank you for quick support... :-)

maxrossello commented 2 years ago

Fix deployed in release 4.2.2 (branches: 4.2 and master). Thanks