Re: [Tails-dev] Requesting help: mass-unsubscribe from notif…

Delete this message

Reply to this message
Autore: intrigeri
Data:  
To: tails-dev
Oggetto: Re: [Tails-dev] Requesting help: mass-unsubscribe from notifications
Hi,

Cyril Brulebois (2020-07-27):
> Having being responsible for a number of releases lately, I've been
> automatically “subscribed” to any tickets I ever touched, even if only
> to push back the target version (Redmine) / milestone (GitLab) to the
> next release.


It sounds like a bug in the algorithm our migration scripts have used
to identify issues for which you should be subscribed to :/

> but that doesn't seem to be sufficient, as I'm still getting
> notifications for issues I didn't participate (besides adjusting
> target version/milestone)…
>
> The signal-to-noise ratio of my gitlab folder is therefore very very
> very low… :(
>
> Help welcome!


After sending this message, I'm going to send you links to the 143
issues you're currently subscribed to, generated by the attached script.

If anyone else is facing similar problems, I'm happy to run the script
for you too :)

Cheers!

#!/usr/bin/python3

import gitlab
import os

from pathlib import Path

PYTHON_GITLAB_CONFIG_FILE = os.getenv('PYTHON_GITLAB_CONFIG_FILE',
                                      default=Path.home() /
                                      '.python-gitlab.cfg')


PYTHON_GITLAB_NAME = os.getenv('GITLAB_NAME', default='Tails')

GITLAB_USERNAME = os.getenv('GITLAB_USERNAME', default='CyrilBrulebois')

GITLAB_URL = 'https://gitlab.tails.boum.org'

gl = gitlab.Gitlab.from_config(PYTHON_GITLAB_NAME,
                               config_files=[PYTHON_GITLAB_CONFIG_FILE])
gl.auth()


projects = [gl.projects.get(project.id)
            for project in gl.groups.get(2).projects.list(all=True)]


for project in projects:
    for issue in [project.issues.get(i.iid)
                  for i in project.issues.list(state='opened', all=True)]:
        if GITLAB_USERNAME in [user['username']
                               for user in issue.participants()]:
            issue_url = "%(gl)s/%(p)s/-/issues/%(i)i" % {
                'gl': GITLAB_URL,
                'p': project.path_with_namespace,
                'i': issue.iid,
            }
            print(issue_url)