In this guide, we will show you how to print the Watchers of an Issue using our Reporter plugin.
Code examples
We got an issue with 3 watchers added to it.
We could print them in a short way. Just in a row one after another, separated with a comma. The following code is used.
{{ issue.watchers.all | map: 'name' | join: ', ' }}
And the result is this one.
Also, we will provide one more example with a bit more information added for the watchers. They will be listed with the ID of the user, first name, last name, full name, and email. This code is used.
{% for watcher in issue.watchers %} <p> <span>{{ watcher.id }}, </span> <span>{{ watcher.name }}, </span> <span>{{ watcher.firstname }}, </span> <span>{{ watcher.lastname }}, </span> <span>{{ watcher.mail }}</span> </p> {% endfor %}
As a result, you will have this list.