-
Notifications
You must be signed in to change notification settings - Fork 192
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
Fixes #1360. Provide a param to assign a label to a new issue. #1453
Conversation
webcompat/form.py
Outdated
return {'title': summary, 'body': body} | ||
rv = {'title': summary, 'body': body} | ||
if 'label' in form_object: | ||
rv.update({'labels': [form_object.get('label')]}) |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
@karlcow any ideas here? the original plan is here: #1360 (comment), but done this way, anybody could add any arbitrary label to our repo because @webcompat-bot has elevated privs. |
The other approach I was thinking about was to fetch the current labels via the API when the app is booted, and keep those in memory. Or we could have a yaml file or similar in the project config, and parse that on app boot-up. It really just depends on where we want to manage what labels exist for the web-bugs repo. If there's a match for an already existing label, we add it via the labeler webhooks. If there isn't a match, we ignore it. |
I don't think the creation of labels will be intense. Or at least it should not. We are not in the free tagging business. So I would make a list of accepted labels and use the webhooks. Benefits it gives us an overview of all labels. And we have already code, we can export in a new module dedicated to labels. |
Cool, thanks @karlcow . I'll cook something up in the next few days.
Speak for yourself... 🎆 |
@miketaylr The code in my previous comment relates to namedtuples, a cheap way to create structured objects. >>> categories = CATEGORIES
>>> categories
[Category(name='needstriage', dataAttribute='needstriage', label='Needs Triage'), Category(name='needsDiagnosis', dataAttribute='needsdiagnosis', label='Needs Diagnosis'), Category(name='needsContact', dataAttribute='needscontact', label='Needs Contact'), Category(name='ready', dataAttribute='contactready', label='Ready for Outreach'), Category(name='sitewait', dataAttribute='sitewait', label='Site Contacted'), Category(name='close', dataAttribute='closed', label='Closed')]
>>> categories[0].name
'needstriage'
>>> categories[0].dataAttribute
'needstriage'
>>> categories[0].label
'Needs Triage' but we can change that to another model if we prefer or if this one is too confusing. No issue for me. |
One concern I have about this is browsers that we dont currently know about wont get their automatic labels. But maybe thats not a big issue.... If the triagers note it, they can file a bug and we can just add that new label to the config. |
Oh wait, I'm totally overthinking this. We can just have a small set of labels to whitelist what can be set via the |
@miketaylr yup. The benefit of having |
(update: i wrote patches for this 2 nights ago, hope to get them up for review today or over the weekend) |
2d479aa
to
c613a78
Compare
@@ -165,8 +165,9 @@ def create_issue(): | |||
bug_form = get_form(request.headers.get('User-Agent')) | |||
if g.user: | |||
get_user_info() | |||
if request.args.get('src'): | |||
session['src'] = request.args.get('src') | |||
for param in ['src', 'label']: |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
So, I guess Not 100% sure about tests, since we don't directly test issue creation. r? @karlcow |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good to go for me.
@@ -165,8 +165,9 @@ def create_issue(): | |||
bug_form = get_form(request.headers.get('User-Agent')) | |||
if g.user: | |||
get_user_info() | |||
if request.args.get('src'): | |||
session['src'] = request.args.get('src') | |||
for param in ['src', 'label']: |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
extra_label = form_object.get('label', None) | ||
if extra_label and extra_label in app.config['EXTRA_LABELS']: | ||
rv.update({'labels': [extra_label]}) | ||
return rv |
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
This comment was marked as abuse.
This comment was marked as abuse.
Sorry, something went wrong.
Not ready for review, just opening as a place for discussion right now.