Remove notificationRecipient (emails) in Linstener of plugin

Hi Experts,

I want to stop notification for few emails. I found the NotificationFilter class which has method called
`removeRecipient(NotificationRecipient recipient, NotificationFilterContext context). So how can I create object of these classs and remove recipient using this class.

Please find my Listener code here:

@SuppressWarnings("unused")
    @EventListener
    public void onIssueEvent(IssueEvent issueEvent) throws RemoveException {
        
    	 if (issueEvent.isSendMail()) {
    		 
    		 NotificationSchemeManager notificationSchemeManager = ComponentAccessor.getNotificationSchemeManager();
    		 
    		 
    		 Set<NotificationRecipient> notificationRecipients = notificationSchemeManager.getRecipients(issueEvent);
    		 for (NotificationRecipient notificationRecipient : notificationRecipients) {
				System.out.println("Recipient--------------:"+notificationRecipient.getEmail());
			}
    		 
    	 }
    	
    }

Note: I am getting all notification recipient in code and Now i want to remove one recipient (dchoukseyXX@gmail.com) using below class. How to get these below objects in my code.

  • NotificationFilterManager
  • NotificationFilterContext

Reference Link:
https://docs.atlassian.com/software/jira/docs/api/7.2.1/com/atlassian/jira/notification/NotificationFilterManager.html

@david.pinn @danielwester @epehrson

1 Like

Any solution for this ?