Skip to content

Commit

Permalink
Merge pull request #2544 from /issues/2507/1
Browse files Browse the repository at this point in the history
Fixes #2507 - Display needsinfo requests in user activity page
  • Loading branch information
magsout committed Aug 16, 2018
2 parents f57cd09 + 80c0c7c commit 5bdff18
Show file tree
Hide file tree
Showing 11 changed files with 269 additions and 132 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{
"_fixture": true,
"url": "https://api.github.com/repos/webcompat/web-bugs/issues/279",
"repository_url": "https://api.github.com/repos/webcompat/web-bugs",
"labels_url": "https://api.github.com/repos/webcompat/web-bugs/issues/279/labels{/name}",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
[
{
"_fixture": true,
"url": "https://api.github.com/repos/webcompat/web-bugs/issues/227",
"repository_url": "https://api.github.com/repos/webcompat/web-bugs",
"labels_url": "https://api.github.com/repos/webcompat/web-bugs/issues/227/labels{/name}",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
[
{
"_fixture": true,
"url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/1585",
"repository_url": "https://api.github.com/repos/webcompat/webcompat-tests",
"labels_url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/1585/labels{/name}",
"comments_url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/1585/comments",
"events_url": "https://api.github.com/repos/webcompat/webcompat-tests/issues/1585/events",
"html_url": "https://github.com/webcompat/webcompat-tests/issues/1585",
"id": 338093783,
"node_id": "MDU6SXNzdWUzMzgwOTM3ODM=",
"number": 1585,
"title": "2479.example.com - desktop site instead of mobile site",
"user": {
"login": "karlcow",
"id": 505230,
"node_id": "MDQ6VXNlcjUwNTIzMA==",
"avatar_url": "https://avatars0.githubusercontent.com/u/505230?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/karlcow",
"html_url": "https://github.com/karlcow",
"followers_url": "https://api.github.com/users/karlcow/followers",
"following_url": "https://api.github.com/users/karlcow/following{/other_user}",
"gists_url": "https://api.github.com/users/karlcow/gists{/gist_id}",
"starred_url": "https://api.github.com/users/karlcow/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/karlcow/subscriptions",
"organizations_url": "https://api.github.com/users/karlcow/orgs",
"repos_url": "https://api.github.com/users/karlcow/repos",
"events_url": "https://api.github.com/users/karlcow/events{/privacy}",
"received_events_url": "https://api.github.com/users/karlcow/received_events",
"type": "User",
"site_admin": false
},
"labels": [
{
"id": 182807004,
"node_id": "MDU6TGFiZWwxODI4MDcwMDQ=",
"url": "https://api.github.com/repos/webcompat/webcompat-tests/labels/browser-firefox",
"name": "browser-firefox",
"color": "d4c5f9",
"default": false
},
{
"id": 985385411,
"node_id": "MDU6TGFiZWw5ODUzODU0MTE=",
"url": "https://api.github.com/repos/webcompat/webcompat-tests/labels/status-needsinfo-karlcow",
"name": "status-needsinfo-karlcow",
"color": "5319e7",
"default": false
},
{
"id": 985333885,
"node_id": "MDU6TGFiZWw5ODUzMzM4ODU=",
"url": "https://api.github.com/repos/webcompat/webcompat-tests/labels/status-needsinfo-testuser",
"name": "status-needsinfo-testuser",
"color": "d93f0b",
"default": false
}
],
"state": "open",
"locked": false,
"assignee": null,
"assignees": [

],
"milestone": {
"url": "https://api.github.com/repos/webcompat/webcompat-tests/milestones/1",
"html_url": "https://github.com/webcompat/webcompat-tests/milestone/1",
"labels_url": "https://api.github.com/repos/webcompat/webcompat-tests/milestones/1/labels",
"id": 2744172,
"node_id": "MDk6TWlsZXN0b25lMjc0NDE3Mg==",
"number": 1,
"title": "needstriage",
"description": "Issues which needs to be triaged",
"creator": {
"login": "karlcow",
"id": 505230,
"node_id": "MDQ6VXNlcjUwNTIzMA==",
"avatar_url": "https://avatars0.githubusercontent.com/u/505230?v=4",
"gravatar_id": "",
"url": "https://api.github.com/users/karlcow",
"html_url": "https://github.com/karlcow",
"followers_url": "https://api.github.com/users/karlcow/followers",
"following_url": "https://api.github.com/users/karlcow/following{/other_user}",
"gists_url": "https://api.github.com/users/karlcow/gists{/gist_id}",
"starred_url": "https://api.github.com/users/karlcow/starred{/owner}{/repo}",
"subscriptions_url": "https://api.github.com/users/karlcow/subscriptions",
"organizations_url": "https://api.github.com/users/karlcow/orgs",
"repos_url": "https://api.github.com/users/karlcow/repos",
"events_url": "https://api.github.com/users/karlcow/events{/privacy}",
"received_events_url": "https://api.github.com/users/karlcow/received_events",
"type": "User",
"site_admin": false
},
"open_issues": 49,
"closed_issues": 0,
"state": "open",
"created_at": "2017-09-05T03:39:06Z",
"updated_at": "2018-07-06T11:54:49Z",
"due_on": null,
"closed_at": null
},
"comments": 0,
"created_at": "2018-07-04T00:29:52Z",
"updated_at": "2018-07-06T01:47:58Z",
"closed_at": null,
"author_association": "MEMBER",
"body": "<!-- @browser: Firefox 63.0 -->\n<!-- @ua_header: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:63.0) Gecko/20100101 Firefox/63.0 -->\n<!-- @reported_with: web -->\n\n**URL**: http://2479.example.com\n\n**Browser / Version**: Firefox 63.0\n**Operating System**: Mac OS X 10.13\n**Tested Another Browser**: Unknown\n\n**Problem type**: Desktop site instead of mobile site\n**Description**: testing the response data (anonymously)\n**Steps to Reproduce**:\n\r\n[![Screenshot Description](http://localhost:5000/uploads/2018/7/ccc14fad-099b-4a1a-8dd5-165d8fe1a5b6-thumb.jpg)](http://localhost:5000/uploads/2018/7/ccc14fad-099b-4a1a-8dd5-165d8fe1a5b6.jpg)\n\n\n\n_From [webcompat.com](https://webcompat.com/) with ❤️_"
}
]
31 changes: 30 additions & 1 deletion tests/functional/user-activity-auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,11 @@ registerSuite("User Activity (auth)", {
},

"IssueListView renders"() {
return FunctionalHelpers.openPage(this, url("/issues"), ".js-IssueList")
return FunctionalHelpers.openPage(
this,
url("/activity/testuser"),
".js-IssueList"
)
.findByCssSelector(".js-IssueList")
.isDisplayed()
.then(function(isDisplayed) {
Expand Down Expand Up @@ -90,6 +94,31 @@ registerSuite("User Activity (auth)", {
.end();
},

"needsinfo section renders"() {
return FunctionalHelpers.openPage(
this,
url("/activity/testuser"),
".js-IssueList"
)
.findByCssSelector("#needsinfo-issues")
.isDisplayed()
.then(function(isDisplayed) {
assert.equal(
isDisplayed,
true,
"needsinfo IssueList container is visible"
);
})
.sleep(1000)
.end()
.findByCssSelector(".label-status-needsinfo-testuser")
.isDisplayed()
.then(function(isDisplayed) {
assert.equal(isDisplayed, true, "A needsinfo label is visible");
})
.end();
},

"Trying to view someone else's activity fails (logged in)"() {
return FunctionalHelpers.openPage(
this,
Expand Down
10 changes: 8 additions & 2 deletions webcompat/api/endpoints.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,10 @@ def get_user_activity_issues(username, parameter):
"""Return issues related to a user at the API endpoint.
cf. https://developer.github.com/v3/issues/#list-issues-for-a-repository
This is only used for "creator" and "mentioned" right now.
This is used for "creator" and "mentioned". A special "needsinfo" parameter
value is converted into a request for labels of the format:
`status-needsinfo-username`
Any logged in user can see details for any other logged in user. We can
extend this to non-logged in users in the future if we want.
Expand All @@ -105,7 +108,10 @@ def get_user_activity_issues(username, parameter):
# copy the params so we can add to the dict.
params = request.args.copy()
params['state'] = 'all'
params['{0}'.format(parameter)] = '{0}'.format(username)
if parameter == 'needsinfo':
params['labels'] = 'status-needsinfo-{0}'.format(username)
else:
params[parameter] = username
path = 'repos/{path}'.format(path=ISSUES_PATH)
return api_request('get', path, params=params)

Expand Down
4 changes: 2 additions & 2 deletions webcompat/static/js/lib/mixins/pagination.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ function PaginationMixin() {
pageNum = this.getPageNumberFromURL(nextPage);
this.view.updateModelParams(pageNum);
// we pass along the entire URL from the Link header
this.view.fetchAndRenderIssues({ url: nextPage });
this.view.fetchAndRenderIssues({ url: nextPage, instance: this });
}
};

Expand All @@ -156,7 +156,7 @@ function PaginationMixin() {
pageNum = this.getPageNumberFromURL(prevPage);
this.view.updateModelParams(pageNum);
// we pass along the entire URL from the Link header
this.view.fetchAndRenderIssues({ url: prevPage });
this.view.fetchAndRenderIssues({ url: prevPage, instance: this });
}
};

Expand Down
Loading

0 comments on commit 5bdff18

Please sign in to comment.