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

Fixes #1360. Provide a param to assign a label to a new issue. #1453

Merged
merged 5 commits into from
Apr 17, 2017

Conversation

miketaylr
Copy link
Member

@miketaylr miketaylr commented Mar 28, 2017

Not ready for review, just opening as a place for discussion right now.

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.

@miketaylr
Copy link
Member Author

@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.

@miketaylr
Copy link
Member Author

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.

@karlcow
Copy link
Member

karlcow commented Apr 4, 2017

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.

@miketaylr
Copy link
Member Author

Cool, thanks @karlcow . I'll cook something up in the next few days.

We are not in the free tagging business.

Speak for yourself... 🎆

@karlcow
Copy link
Member

karlcow commented Apr 4, 2017

@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.
YAML, JSON, n3, rdf, cvs, turtle, name your own evil.

@miketaylr
Copy link
Member Author

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.

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.

@miketaylr
Copy link
Member Author

miketaylr commented Apr 12, 2017

Oh wait, I'm totally overthinking this. We can just have a small set of labels to whitelist what can be set via the extra_labels param, which for now will be 1 or 2 (type-media, type-webvr). That won't affect the labeler webhook.

@karlcow
Copy link
Member

karlcow commented Apr 13, 2017

@miketaylr yup. The benefit of having category-label is that we can adjust our policy depending on the category-. We can still have limited vocab for some of them.

@miketaylr
Copy link
Member Author

(update: i wrote patches for this 2 nights ago, hope to get them up for review today or over the weekend)

@@ -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.

@miketaylr
Copy link
Member Author

So, I guess type-media reports are coming in already, so landing this sooner than later will make less of a headache for triagers (cc @MDTsai @karlcow @adamopenweb).

Not 100% sure about tests, since we don't directly test issue creation.

r? @karlcow

@karlcow karlcow self-requested a review April 17, 2017 00:13
Copy link
Member

@karlcow karlcow left a 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.

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.

@karlcow karlcow merged commit 6b27c28 into master Apr 17, 2017
@karlcow karlcow deleted the issues/1360/1 branch April 17, 2017 00:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants