Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receive notifications only when involved / being the asignee #16

Open
alwibrm opened this issue Oct 22, 2019 · 7 comments
Open

Receive notifications only when involved / being the asignee #16

alwibrm opened this issue Oct 22, 2019 · 7 comments

Comments

@alwibrm
Copy link

alwibrm commented Oct 22, 2019

When you have a couple of projects hosted in GitBucket and the notifications plugin activated, you receive loads of mails by default (every time when someone is creating a PR, etc.). This can quickly become annoying and the risk that you miss the really important things (e.g. asignee = you) is increasing.

It would be nice to have an option which allows to receive notifications only when you're directly involved in a state change.

@alwibrm
Copy link
Author

alwibrm commented Oct 28, 2019

I just realized that you can adjust the "watch"-level per repository ("watching", "not watching", "ignoring"). But: I would find it useful to be able to set a "default watch level". Otherwise every single user has to adjust the settings per repository.

@rkno82
Copy link

rkno82 commented Sep 9, 2020

We would really appreciate that feature.

@takezoe
Copy link
Member

takezoe commented Sep 10, 2020

The current notification plugin sends email to only involved users.

def getNotificationUsers(issue: Issue)(implicit s: Session): List[String] = {
val watches = Watches.filter(t =>
t.userName === issue.userName.bind && t.repositoryName === issue.repositoryName.bind
).list
val notifications = IssueNotifications.filter(t =>
t.userName === issue.userName.bind && t.repositoryName === issue.repositoryName.bind && t.issueId === issue.issueId.bind
).list
(
Seq(
// auto-subscribe users for repository
autoSubscribeUsersForRepository(issue.userName, issue.repositoryName) :::
// watching users
watches.withFilter(_.notification == Watch.Watching).map(_.notificationUserName),
// participants
issue.openedUserName ::
getComments(issue.userName, issue.repositoryName, issue.issueId).map(_.commentedUserName),
// subscribers
notifications.withFilter(_.subscribed).map(_.notificationUserName)
) zip Seq(
// not watching users
watches.withFilter(_.notification == Watch.NotWatching).map(_.notificationUserName),
// ignoring users
watches.withFilter(_.notification == Watch.Ignoring).map(_.notificationUserName),
// unsubscribers
notifications.withFilter(!_.subscribed).map(_.notificationUserName)
)
).foldLeft[List[String]](Nil){ case (res, (add, remove)) =>
(add ++ res).distinct diff remove
}
}

@takezoe
Copy link
Member

takezoe commented Sep 10, 2020

Involved users include a repository owner. So, if you are the owner of many repositories, you could get many notification emails. Do you want to avoid this case?

@rkno82
Copy link

rkno82 commented Sep 11, 2020

Out situation is the following.
We are working as teams with multiple roles, developers and operations, and are using pull requests to ensure 4-eyes-principle within each role.
The current setup leads to situations where every ops'ler is receiving every dev-pr and vise versa. We would like to be able to configure that less "spammy".

Thanks.

@takezoe
Copy link
Member

takezoe commented Sep 12, 2020

Hm, I see. Group members and collaborators are included in the notification target. Will an option to exclude them work?

def autoSubscribeUsersForRepository(owner: String, repository: String)(implicit s: Session): List[String] = {
// individual repository's owner
owner ::
// group members of group repository
getGroupMembers(owner).map(_.userName) :::
// collaborators
getCollaboratorUserNames(owner, repository)
}

@alwibrm
Copy link
Author

alwibrm commented Sep 25, 2020

As soon as collaborators are only users involved in the related PR / branch you get the notification for - that should work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

3 participants