php-redmine-api icon indicating copy to clipboard operation
php-redmine-api copied to clipboard

Get an issue's watchers

Open pkoevesdi opened this issue 2 years ago • 4 comments

How can one get the current watchers of an issue? Is there any implemented way, other than using the low level API? If not, I'd like to put this as an feature request. Thank You very much!

pkoevesdi avatar Dec 15 '23 14:12 pkoevesdi

Since Redmine 2.3.0 you can include the watchers in the issues details, see https://www.redmine.org/projects/redmine/wiki/Rest_Issues#Showing-an-issue

Using the mid level API it should work like this:

$client->getApi('issue')->list([
    'include' => [
        'watchers',
    ],
]);

Art4 avatar Dec 16 '23 12:12 Art4

That's similar to what I tried (passed 'watchers' as string, not list), but no luck, still no watchers in the Array. To clarify my problem: I can show them for a certain issue $client->getApi('issue')->show($issueId);, but not inside a list of issues.

pkoevesdi avatar Dec 16 '23 13:12 pkoevesdi

You are right. Including the watchers to a list of issues is missing in the Redmine API atm. I've found this feature request: https://www.redmine.org/issues/36848

As a workaorund you could call every issue in a separate call with included watchers. But this might become very costly.

Art4 avatar Dec 17 '23 18:12 Art4

But this might become very costly.

Yes, definately, with a list of 6000 issues that need to be filtered by watchers over network, it takes too long. Sadly, one of the many open feature requests of redmine. Thanks for pointing there. :-)

pkoevesdi avatar Dec 22 '23 07:12 pkoevesdi