The Atlassian Community Forums are currently in read-only mode. We will be relaunching on a new platform on September 22 (read more here). We apologize for the extended downtime. For concerns or questions, please email communitymanagers@atlassian.com. See you on the other side, on the new Atlassian Community Forums! :)

×

Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How to cancel all watches?

Richard Boult
December 19, 2016

My role has changed. Hundreds of pages I was watching are now no longer relevant for me. I want to be able to do mass unwatch, rather than one by one. Or simply wipe the slate clean and unwatch all. 

An alternative would be to unwatch all pages in a particular space, thus I could go through the spaces more quickly than through all the separate pages.

Any suggestions?  Do I need to raise a suggestion?

 

Confluence 5.8 

2 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

0 votes
Anton Kulikov
April 15, 2021

this code help me 

import com.atlassian.confluence.mail.notification.NotificationManager
import com.atlassian.spring.container.ContainerManager
import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.pages.PageManager
import com.atlassian.confluence.search.service.ContentTypeEnum
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import com.atlassian.confluence.user.UserAccessor
import com.atlassian.confluence.spaces.SpaceManager
import com.atlassian.user.UserManager 
Logger log = LoggerFactory.getLogger("console") 

def userManager = ComponentLocator.getComponent(UserManager)

NotificationManager nm = ( NotificationManager) ContainerManager.getComponent(
"notificationManager")
PageManager pageManager = ComponentLocator.getComponent(PageManager)
ContentTypeEnum ctp = ComponentLocator.getComponent(ContentTypeEnum)
UserAccessor userAccessor = ComponentLocator.getComponent(UserAccessor)
def spaceManager = ComponentLocator.getComponent(SpaceManager)
def users = userManager.users.find{it.getName() == "username"} 
def nfu = nm.getNotificationsByUser(userAccessor.getUserByName(users?.getName()))
nm.removeAllNotificationsForUser(userAccessor.getUserByName(users.getName()))
return  nm.getNotificationsByUser(userAccessor.getUserByName(users.getName()))
0 votes
Dave Bosman
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Champions.
December 20, 2016

Hi Richard,

 

Check out this question and answers. 

https://answers.atlassian.com/questions/33993

 

Regards,

Dave

TAGS
AUG Leaders

Atlassian Community Events