Skip to content

Fixes #2729 - Remove labels request when they're unnused #2745

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

Merged
merged 1 commit into from
Dec 18, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions webcompat/static/js/lib/labels.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,11 @@ var issues = issues || {}; // eslint-disable-line no-use-before-define
// unseen namespaces are added in their local name form.
// Hence, we set up a single, globally accessible "all labels" model
// This is set up as early as possible to avoid timing issues
if (!issues.allLabels) {
issues.allLabels = new issues.LabelList();

if ($("body").data("username")) {
if (!issues.allLabels) {
issues.allLabels = new issues.LabelList();
}
}

issues.LabelsView = issues.CategoryView.extend({
Expand All @@ -29,11 +32,11 @@ issues.LabelsView = issues.CategoryView.extend({
},
fetchItems: function() {
this.editorButton = $(".js-LabelEditorLauncher");
this.labelEditor = new issues.LabelEditorView({
model: issues.allLabels,
issueView: this
});
if (this._isLoggedIn) {
this.labelEditor = new issues.LabelEditorView({
model: issues.allLabels,
issueView: this
});
this.issueLabels = this.getIssueLabels();
this.editorButton.show();
}
Expand Down