ScriptRunner for Confluence- bulk change

Neta Elyakim
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 Leaders.
April 11, 2018

Hey,

I'm using ScriptRunner for Confluence.

I want to create a script macro how can un-watch all Confluence content for a specific user?

I know how to create a macro with params but as anybody knows a commend for us-watching?

Additionally, Is it possible to remove all user drafts in Confluence (bulk with ScriptRunner for Confluence)?

Thanks!

1 answer

1 accepted

1 vote
Answer accepted
Christo Mastoroudes _Adaptavist_
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 Leaders.
April 11, 2018

Hi,

I will attempt to answer the first of your questions.

This should remove all content that a specific user is watching. I tried it quickly in the script console and it seems to be working.

 

import com.atlassian.sal.api.component.ComponentLocator
import com.atlassian.confluence.mail.notification.NotificationManager
import com.atlassian.user.UserManager

def notificationsManager = ComponentLocator.getComponent(NotificationManager)
def userManager = ComponentLocator.getComponent(UserManager)


notificationsManager.removeAllNotificationsForUser(userManager.getUser("admin"))

 

As for the second question, I don't see any reason why it shouldn't be possible to remove all drafts for a specific user, but I have not tried it before.

Neta Elyakim
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 Leaders.
April 11, 2018

Hey, Thanks!

I will try this.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events