Skip to content

Commit f9f4e67

Browse files
committed
Merge pull request #653 from /issues/652
Issue #652: Account for new label scheme in the API endpoints.
2 parents b091d18 + 8fc20ef commit f9f4e67

File tree

4 files changed

+15
-11
lines changed

4 files changed

+15
-11
lines changed

tests/test_urls.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,16 +90,16 @@ def test_issues_new(self):
9090
{u'labels': [],
9191
u'title': u"fake bug 1",
9292
u'id': 1},
93-
{u'labels': [{u'name': u'contactready'}],
93+
{u'labels': [{u'name': u'status-contactready'}],
9494
u'title': u"fake bug 2",
9595
u'id': 2},
96-
{u'labels': [{u'name': u'needsdiagnosis'}],
96+
{u'labels': [{u'name': u'status-needsdiagnosis'}],
9797
u'title': u"fake bug 3",
9898
u'id': 3},
99-
{u'labels': [{u'name': u'needscontact'}],
99+
{u'labels': [{u'name': u'status-needscontact'}],
100100
u'title': u"fake bug 4",
101101
u'id': 4},
102-
{u'labels': [{u'name': u'sitewait'}],
102+
{u'labels': [{u'name': u'status-sitewait'}],
103103
u'title': u"fake bug 5",
104104
u'id': 5}]
105105
result = '[{"labels": [{"name": "bug"}, {"name": "help wanted"}], "id": 0, "title": "fake bug 0"}, {"labels": [], "id": 1, "title": "fake bug 1"}]'

webcompat/api/endpoints.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,9 @@ def get_issue_category(issue_category):
120120
params = request.args.copy()
121121

122122
if issue_category in category_list:
123-
params['labels'] = issue_category
123+
# add "status-" before the filter param to match the naming scheme
124+
# of the repo labels.
125+
params['labels'] = 'status-' + issue_category
124126
if g.user:
125127
issues = github.raw_request('GET', issues_path, params=params)
126128
else:
@@ -202,7 +204,9 @@ def get_category_from_search(issue_category):
202204
params = request.args.copy()
203205

204206
if issue_category in category_list:
205-
query_string = 'label:{0}'.format(issue_category)
207+
# add "status-" before the issue_category to match the naming scheme
208+
# of the repo labels.
209+
query_string = 'label:{0}'.format('status-' + issue_category)
206210
elif issue_category == 'new':
207211
query_string = ' '.join(['-label:%s' % cat for cat in category_list])
208212
query_string += ' state:open '

webcompat/issues.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,8 @@ def filter_new(issues):
6363
def is_new(issue):
6464
'''Filter function.'''
6565
match = True
66-
category_list = ['contactready', 'needscontact',
67-
'needsdiagnosis', 'sitewait']
66+
category_list = ['status-contactready', 'status-needscontact',
67+
'status-needsdiagnosis', 'status-sitewait']
6868
labels = [label.get('name') for label in issue.get('labels')]
6969
# if the intersection of labels and category_list is not empty
7070
# then it's not part of untriaged

webcompat/static/js/lib/models/issue.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,15 @@
3232
this.set('stateClass', 'close');
3333
return 'Closed';
3434
}
35-
if (labelsNames.indexOf('sitewait') > -1) {
35+
if (labelsNames.indexOf('status-sitewait') > -1) {
3636
this.set('stateClass', 'sitewait');
3737
return 'Site Contacted';
3838
}
39-
if (labelsNames.indexOf('contactready') > -1) {
39+
if (labelsNames.indexOf('status-contactready') > -1) {
4040
this.set('stateClass', 'ready');
4141
return 'Ready for Outreach';
4242
}
43-
if (labelsNames.indexOf('needsdiagnosis') > -1) {
43+
if (labelsNames.indexOf('status-needsdiagnosis') > -1) {
4444
this.set('stateClass', 'need');
4545
return 'Needs Diagnosis';
4646
}

0 commit comments

Comments
 (0)