Skip to content

Commit

Permalink
Issue #286 - rename Untriaged label to New
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Taylor committed Jan 7, 2015
1 parent 6505ade commit a3413e1
Show file tree
Hide file tree
Showing 18 changed files with 69 additions and 73 deletions.
8 changes: 4 additions & 4 deletions tests/functional/comments.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ define([
return this.remote
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(101)))
.sleep(500)
.sleep(2000)
.findByCssSelector('.js-issue-state-button').getVisibleText()
.then(function(text){
assert.equal('Reopen Issue', text);
Expand All @@ -89,7 +89,7 @@ define([
.findByCssSelector('textarea.Comment-text')
.type('test comment')
.end()
.sleep(500)
.sleep(2000)
.findByCssSelector('.js-issue-state-button').getVisibleText()
.then(function(text){
assert.equal('Reopen and comment', text);
Expand All @@ -110,11 +110,11 @@ define([
.findByCssSelector('textarea.Comment-text')
.type('Today\'s date is ' + new Date().toDateString())
.end()
.sleep(500)
.sleep(2000)
// click the comment button
.findByCssSelector('.js-issue-comment-button').click()
.end()
.sleep(500)
.sleep(2000)
.findAllByCssSelector('.Comment:not(.Comment--form)')
.then(function(elms){
allCommentsLength = elms.length;
Expand Down
16 changes: 8 additions & 8 deletions tests/functional/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,35 +116,35 @@ define([
.end();
},

'browse issues (untriaged)': function() {
'browse issues (new)': function() {
return this.remote
.get(require.toUrl(url))
.findByCssSelector('#untriaged h3').getVisibleText()
.findByCssSelector('#new h3').getVisibleText()
.then(function (text) {
assert.equal(text, 'Untriaged Issues');
assert.equal(text, 'New Issues');
})
.end()
.findAllByCssSelector('#untriaged .IssueItem.IssueItem--untriaged')
.findAllByCssSelector('#new .IssueItem.IssueItem--new')
.then(function (elms) {
assert.equal(elms.length, 4, '4 issues should be displayed');
})
.end()
.findByCssSelector('.IssueItem--untriaged .IssueItem-count').getVisibleText()
.findByCssSelector('.IssueItem--new .IssueItem-count').getVisibleText()
.then(function (text) {
assert.match(text, /^Issue\s(\d+)$/, 'Issue should have a number');
})
.end()
.findByCssSelector('.IssueItem--untriaged .IssueItem-header a').getAttribute('href')
.findByCssSelector('.IssueItem--new .IssueItem-header a').getAttribute('href')
.then(function (text) {
assert.match(text, /^\/issues\/\d+$/, 'Link should have a number');
})
.end()
.findByCssSelector('.IssueItem--untriaged .IssueItem-header').getVisibleText()
.findByCssSelector('.IssueItem--new .IssueItem-header').getVisibleText()
.then(function (text) {
assert.match(text, /^Issue\s\d+:\s.+$/, 'Issue should have a non-empty title');
})
.end()
.findByCssSelector('.IssueItem--untriaged .IssueItem-metadata').getVisibleText()
.findByCssSelector('.IssueItem--new .IssueItem-metadata').getVisibleText()
.then(function (text) {
assert.match(text, /comments:\s\d+$/, 'Issue should display number of comments');
assert.match(text, /^Opened:\s\d{4}\-\d{2}\-\d{2}.+/, 'Issue should display creation date');
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/issue-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,19 +152,19 @@ define([
.findByCssSelector('.IssueList-search-form').click()
.type('taco')
.end()
.findAllByCssSelector('button.wc-Filter--untriaged').click()
.findAllByCssSelector('button.wc-Filter--new').click()
.end()
.findByCssSelector('.IssueList-search-form').getVisibleText()
.then(function (text) {
assert.equal(text, '', 'Clicking filter should empty search text');
})
.end()
.findAllByCssSelector('button.wc-Filter--untriaged').click()
.findAllByCssSelector('button.wc-Filter--new').click()
.end()
.findByCssSelector('.IssueList-search-form').click()
.type('taco')
.end()
.findAllByCssSelector('button.wc-Filter--untriaged').getAttribute('class')
.findAllByCssSelector('button.wc-Filter--new').getAttribute('class')
.then(function (className) {
assert.notInclude(className, 'is-active', 'Searching should clear all filters');
});
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/issues.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ define([
.setFindTimeout(intern.config.wc.pageLoadTimeout)
.get(require.toUrl(url(69)))
.findByCssSelector('.js-issue-state-button').click()
.sleep(1000)
.sleep(2000)
.end()
.findByCssSelector('.Issue-state').getVisibleText()
.then(function (text) {
Expand All @@ -56,7 +56,7 @@ define([
})
.end()
.findByCssSelector('.js-issue-state-button').click()
.sleep(1000)
.sleep(2000)
.end()
.findByCssSelector('.Issue-state').getVisibleText()
.then(function (text) {
Expand Down
16 changes: 8 additions & 8 deletions webcompat/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
from webcompat.helpers import get_request_headers
from webcompat.helpers import get_user_info
from webcompat.helpers import normalize_api_params
from webcompat.issues import filter_untriaged
from webcompat.issues import filter_new
from webcompat.issues import proxy_request


Expand Down Expand Up @@ -98,7 +98,7 @@ def get_issue_category(issue_category):
'''Return all issues for a specific category.
issue_category can be of x types:
* untriaged (We take care in case there’s no bug)
* new
* contactready
* needsdiagnosis
* sitewait
Expand All @@ -119,16 +119,16 @@ def get_issue_category(issue_category):
issues = github.raw_request('GET', issues_path, params=params)
else:
issues = proxy_request('get', params=params)
# Note that 'untriaged' here is primarily used on the hompage.
# For paginated results on the /issues page, see /issues/search/untriaged.
elif issue_category == 'untriaged':
# Note that 'new' here is primarily used on the hompage.
# For paginated results on the /issues page, see /issues/search/new.
elif issue_category == 'new':
if g.user:
issues = github.raw_request('GET', issues_path, params=params)
else:
issues = proxy_request('get', params=params)
# Do not send random JSON to filter_untriaged
# Do not send random JSON to filter_new
if issues.status_code == 200:
return (filter_untriaged(json.loads(issues.content)),
return (filter_new(json.loads(issues.content)),
issues.status_code, get_headers(issues))
else:
return ({}, issues.status_code, get_headers(issues))
Expand Down Expand Up @@ -193,7 +193,7 @@ def get_category_from_search(issue_category):

if issue_category in category_list:
query_string = 'label:{0}'.format(issue_category)
elif issue_category == 'untriaged':
elif issue_category == 'new':
query_string = ('state:open -label:contactready '
'-label:sitewait -label:needsdiagnosis')
return get_search_results(query_string, params)
Expand Down
10 changes: 5 additions & 5 deletions webcompat/issues.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,13 @@ def report_issue(form, proxy=False):
return github.post('repos/{0}'.format(REPO_URI), build_formdata(form))


def filter_untriaged(issues):
'''Return the list of untriaged issues, encoded as JSON.
def filter_new(issues):
'''Return the list of new issues, encoded as JSON.
"untriaged" means anything that isn't an issue with a "contactready",
"new" means anything that isn't an issue with a "contactready",
"sitewait", or "needsdiagnosis" label.
'''
def is_untriaged(issue):
def is_new(issue):
'''Filter function.'''
match = True
if issue.get('labels') == []:
Expand All @@ -71,4 +71,4 @@ def is_untriaged(issue):
match = False
return match

return json.dumps([issue for issue in issues if is_untriaged(issue)])
return json.dumps([issue for issue in issues if is_new(issue)])
2 changes: 1 addition & 1 deletion webcompat/static/css/development/base/variable.css
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
--wc-background-light: var(--wc-background-dark); /* #FBC55F Light Yellow */
--wc-variant-background-dark: #404040; /* Dark Gray */
--wc-variant-background-light: #c2c2c2; /* Dark Light */
--wc-state-untriaged: #6fc7fa; /* Light blue */
--wc-state-new: #6fc7fa; /* Light blue */
--wc-state-need: #ff8364; /* Light red */
--wc-state-ready: #a1ebbf; /* Light green */
--wc-state-sitewait: #006B75; /* Dark green */
Expand Down
10 changes: 5 additions & 5 deletions webcompat/static/css/development/components/filter.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
.wc-Filter.is-active {
color:#fff;
}
.wc-Filter--untriaged {
border-color:var(--wc-state-untriaged);
.wc-Filter--new {
border-color:var(--wc-state-new);
}
.wc-Filter--untriaged:hover,
.wc-Filter--untriaged.is-active {
background-color:var(--wc-state-untriaged);
.wc-Filter--new:hover,
.wc-Filter--new.is-active {
background-color:var(--wc-state-new);
}
.wc-Filter--need {
border-color:var(--wc-state-need);
Expand Down
4 changes: 2 additions & 2 deletions webcompat/static/css/development/components/issue-item.css
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
margin:0;
background-color: transparent;
}
.IssueItem--untriaged {
border-left: 5px solid var(--wc-state-untriaged);
.IssueItem--new {
border-left: 5px solid var(--wc-state-new);
}
.IssueItem--need {
border-left: 5px solid var(--wc-state-need);
Expand Down
4 changes: 2 additions & 2 deletions webcompat/static/css/development/page/about.css
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
margin:3em 0;
}
.about_bug--reporting {
border-color: var(--wc-state-untriaged);
border-color: var(--wc-state-new);
}
.about_bug--reporting .about_bug_label {
color: var(--wc-state-untriaged)
color: var(--wc-state-new)
}
.about_bug--analysis {
border-color: var(--wc-state-need);
Expand Down
6 changes: 3 additions & 3 deletions webcompat/static/css/development/page/issues.css
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,9 @@
font-size:.8em;
}
}
/*Untriaged*/
.Issue-state--untriaged {
background-color: var(--wc-state-untriaged);
/*New*/
.Issue-state--new {
background-color: var(--wc-state-new);
}
/*Needs Diagnosis*/
.Issue-state--need {
Expand Down
20 changes: 8 additions & 12 deletions webcompat/static/js/lib/diagnose.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ diagnose.ContactReadyCollection = Backbone.Collection.extend({
url: '/api/issues/category/contactready'
});

diagnose.UntriagedCollection = Backbone.Collection.extend({
diagnose.NewCollection = Backbone.Collection.extend({
model: issues.Issue,
url: '/api/issues/category/untriaged'
url: '/api/issues/category/new'
});

diagnose.SiteWaitCollection = Backbone.Collection.extend({
Expand Down Expand Up @@ -65,29 +65,27 @@ diagnose.NeedsDiagnosisView = Backbone.View.extend({
render: function() {
this.$el.html(this.template({
// manually slice out the latest 4.
// in the future we'll allow the user to "scroll" these.
needsDiagnosis: this.issues.toJSON().slice(0,4)
}));
return this;
}
});

diagnose.UntriagedView = Backbone.View.extend({
el: $('#untriaged'),
diagnose.NewView = Backbone.View.extend({
el: $('#new'),
initialize: function() {
var self = this;
var headersBag = {headers: {'Accept': 'application/json'}};
this.issues = new diagnose.UntriagedCollection();
this.issues = new diagnose.NewCollection();
this.issues.fetch(headersBag).success(function() {
self.render();
}).error(function(){});
},
template: _.template($('#untriaged-tmpl').html()),
template: _.template($('#new-tmpl').html()),
render: function() {
this.$el.html(this.template({
// manually slice out the latest 4.
// in the future we'll allow the user to "scroll" these.
untriaged: this.issues.toJSON().slice(0,4)
newIssues: this.issues.toJSON().slice(0,4)
}));
return this;
}
Expand All @@ -107,7 +105,6 @@ diagnose.SiteWaitView = Backbone.View.extend({
render: function() {
this.$el.html(this.template({
// manually slice out the latest 4.
// in the future we'll allow the user to "scroll" these.
sitewait: this.issues.toJSON().slice(0,4)
}));
return this;
Expand All @@ -128,7 +125,6 @@ diagnose.ContactReadyView = Backbone.View.extend({
render: function() {
this.$el.html(this.template({
// manually slice out the latest 4.
// in the future we'll allow the user to "scroll" these.
contactReady: this.issues.toJSON().slice(0,4)
}));
return this;
Expand All @@ -138,6 +134,6 @@ diagnose.ContactReadyView = Backbone.View.extend({
$(function(){
new diagnose.NeedsDiagnosisView();
new diagnose.ContactReadyView();
new diagnose.UntriagedView();
new diagnose.NewView();
new diagnose.SiteWaitView();
});
6 changes: 3 additions & 3 deletions webcompat/static/js/lib/issue-list.js
Original file line number Diff line number Diff line change
Expand Up @@ -276,10 +276,10 @@ issueList.IssueView = Backbone.View.extend({
},
template: _.template($('#issuelist-issue-tmpl').html()),
loadIssues: function() {
// First checks URL params, e.g., /?untriaged=1 and activates the untriaged filter,
// First checks URL params, e.g., /?new=1 and activates the new filter,
// or loads default unsorted/unfiltered issues
var category;
var filterRegex = /\?(untriaged|needsdiagnosis|contactready|sitewait|closed)=1/;
var filterRegex = /\?(new|needsdiagnosis|contactready|sitewait|closed)=1/;
if (category = window.location.search.match(filterRegex)) {
// If there was a match, load the relevant results and fire an event
// to notify the button to activate.
Expand Down Expand Up @@ -386,7 +386,7 @@ issueList.IssueView = Backbone.View.extend({

// note: until GitHub fixes a bug where requesting issues filtered by labels
// doesn't return pagination via Link, we get those results via the Search API.
var searchCategories = ['untriaged', 'contactready', 'needsdiagnosis', 'sitewait'];
var searchCategories = ['new', 'contactready', 'needsdiagnosis', 'sitewait'];
var params = $.extend(this.issues.params, this.getPageLimit());

// note: if query is the empty string, it will load all issues from the
Expand Down
6 changes: 3 additions & 3 deletions webcompat/static/js/lib/models/issue.js
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,9 @@
this.set('stateClass', 'need');
return 'Needs Diagnosis';
}
//Untriaged is the default value.
this.set('stateClass', 'untriaged');
return 'Untriaged Issue';
//New is the default value.
this.set('stateClass', 'new');
return 'New Issue';
},
parse: function(response) {
this.set({
Expand Down
6 changes: 3 additions & 3 deletions webcompat/templates/browse-issues.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
<div class="wc-content" id="browse-issues">
<h2 class="wc-Title--l">Browse Issues</h2>
<ul class="r-ResetList u-inlineBlock">
<li class="IssueItem IssueItem--list IssueItem--untriaged">
<a href="{{ url_for('show_issues') }}?untriaged=1">Untriaged</a>
<li class="IssueItem IssueItem--list IssueItem--new">
<a href="{{ url_for('show_issues') }}?new=1">New</a>
</li>
<li class="IssueItem IssueItem--list IssueItem--need">
<a href="{{ url_for('show_issues') }}?needsdiagnosis=1">Needs&nbsp;Diagnosis</a>
Expand All @@ -20,7 +20,7 @@ <h2 class="wc-Title--l">Browse Issues</h2>
</ul>
{% include "browse-issues/my-issues.html" %}
<div class="r-Grid r-Grid--withGutter">
{% include "browse-issues/untriaged.html" %}
{% include "browse-issues/new.html" %}
{% include "browse-issues/needs-diagnosis.html" %}
</div>
<div class="r-Grid r-Grid--withGutter">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<div id="untriaged" class="r-Grid-cell r-all--1of2 r-maxM--2of2">
<script type="text/template" id="untriaged-tmpl">
<div id="new" class="r-Grid-cell r-all--1of2 r-maxM--2of2">
<script type="text/template" id="new-tmpl">
<h3 class="wc-titleIssue">
<a class="wc-titleIssue-link" href="{{ url_for('show_issues') }}?untriaged=1">Untriaged Issues</a>
<a class="wc-titleIssue-link" href="{{ url_for('show_issues') }}?new=1">New Issues</a>
</h3>
<% if (untriaged.length) { %>
<% _.each(untriaged, function(issue) { %>
<div class="IssueItem IssueItem--untriaged">
<% if (newIssues.length) { %>
<% _.each(newIssues, function(issue) { %>
<div class="IssueItem IssueItem--new">
<p class="IssueItem-header">
<a href="/issues/<%= issue.number %>"><span class="IssueItem-count">Issue <%= issue.number %></span>: <%- issue.title %></a>
</p>
Expand Down
Loading

0 comments on commit a3413e1

Please sign in to comment.