Skip to content

Commit e67322e

Browse files
author
Mike Taylor
committed
Issue #660. Keep a set of original labels, as well as labels w/ namespace removed.
1 parent 1c5eaca commit e67322e

File tree

2 files changed

+11
-3
lines changed

2 files changed

+11
-3
lines changed

webcompat/static/js/lib/labels.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ issues.AllLabels = Backbone.Model.extend({
2020
});
2121
},
2222
parse: function(response) {
23-
this.set({labels: response});
23+
this.set({
24+
// Store a copy of the original response, so we can reconstruct
25+
// the labels before talking back to the API.
26+
namespacedLabels: response,
27+
labels: this.removeNamespaces(response)
28+
});
2429
}
2530
});
2631

@@ -63,6 +68,8 @@ issues.LabelsView = Backbone.View.extend({
6368
model: this.allLabels,
6469
issueView: this,
6570
});
71+
// Stash the allLabels model so we can get it from Issue model later
72+
this.model.set('repoLabels', this.allLabels);
6673
if (this._isLoggedIn) {
6774
this.allLabels.fetch(headersBag).success(_.bind(function(){
6875
this.issueLabels = this.getIssueLabels();

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

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,13 @@
5959
});
6060
},
6161
parse: function(response) {
62+
var labels = this.removeNamespaces(response.labels);
6263
this.set({
6364
body: md.render(response.body),
6465
commentNumber: response.comments,
6566
createdAt: response.created_at.slice(0, 10),
66-
issueState: this.getState(response.state, response.labels),
67-
labels: response.labels,
67+
issueState: this.getState(response.state, labels),
68+
labels: labels,
6869
number: response.number,
6970
reporter: response.user.login,
7071
reporterAvatar: response.user.avatar_url,

0 commit comments

Comments
 (0)