Details
-
Bug
-
Status: Done
-
Low
-
Resolution: Done
-
5.5.7
-
None
-
SR4J Sprint 80, SR4J Sprint 81, SR4J Sprint 82, SR4J Sprint 83, SR4J Sprint 84, SR4J Sprint 85
-
4.8
Description
The Projects selection field in the listener configuration screen is ignored if the event that triggers the listener is a "component event" such as the "ProjectComponent Event".
We currently only acknowledge the Project Selection field for Issue events, worklog events and version events.
We should add the component events to the list of events that consider the project selection field, and it would also be good to notify users when the selected event ignores the project select field.
Steps to reproduce
- Create a custom listener and set the event to the "ProjectComponentCreatedEvent"
- Set a specific Project in the "Project(s)" filter field
- Create a Component in a project you did not include in listeners the "Project(s)" filter
- You should see the Listener still gets triggered.
Workaround
A possible workaround would be to detect the project name within the actual script and then use if blocks to make sure the script logic only runs for your wanted projects.
Example Custom Listener script:
import com.atlassian.jira.component.ComponentAccessor import com.atlassian.jira.project.Project import com.atlassian.jira.project.ProjectManager import org.apache.log4j.Level import org.apache.log4j.Logger def log = Logger.getLogger(getClass()) log.setLevel(Level.DEBUG) ProjectManager projectManager = ComponentAccessor.getProjectManager() def triggeringProjectName = event?.getProjectComponent()?.getName() def triggeringProjectId = event?.getProjectComponent()?.projectId if(triggeringProjectId){ Project myProject = projectManager.getProjectObj(triggeringProjectId) log.debug("Project name where event came from = " + triggeringProjectName) log.debug("Project ID = " + triggeringProjectId) log.debug("Project Object = " + myProject) //perform your logic in here }else{ log.debug("Project Name not found") }
Attachments
Issue Links
- is related to
-
SRJIRA-4531 Customise the view html in Database Picker
-
- Triage
-