From 9ccb7a3566f851115e4ee0c9986a8762bfcc8ff8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 9 Oct 2016 08:55:22 +0200 Subject: [PATCH 1/3] Add cross-env dependency so that `npm start' works --- package.json | 1 + 1 file changed, 1 insertion(+) diff --git a/package.json b/package.json index 60c0a88..ece48bb 100644 --- a/package.json +++ b/package.json @@ -23,6 +23,7 @@ "homepage": "https://github.com/debugger22/github-audio#readme", "dependencies": { "chalk": "^1.1.3", + "cross-env": "^3.1.2", "express": "^4.14.0", "helmet": "^2.2.0", "ip": "^1.1.3", From 53014198ceaacf44fa34cfa18adefb8f9a73a037 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 9 Oct 2016 09:04:56 +0200 Subject: [PATCH 2/3] Set `merged' action if `merged' key is true The GitHub API doesn't actually return `action = merged' when a PR is merged; it just sets `pull_request.merged = true'. From the Description field for the Action key: https://developer.github.com/v3/activity/events/types/#pullrequestevent --- server/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/server/index.js b/server/index.js index a6316f1..d11108c 100755 --- a/server/index.js +++ b/server/index.js @@ -133,6 +133,7 @@ function stripData(data){ 'created': data.created_at }); }else if(data.type == 'PullRequestEvent'){ + if (data.payload.pull_request.merged) data.payload.action = 'merged'; stripedData.push({ 'id': data.id, 'type': data.type, From c5a04f34de368dcfd4e881d11cd7c397721d457f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Cornell=C3=A0?= Date: Sun, 9 Oct 2016 10:06:36 +0200 Subject: [PATCH 3/3] Add URL field for each event With this commit each event has a proper link directing to the actual event, except PushEvents which direct to the repo since there isn't any available link to the commits. --- app/public/js/main.js | 2 +- server/index.js | 12 ++++++++---- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/public/js/main.js b/app/public/js/main.js index 5c874e8..0f11bce 100644 --- a/app/public/js/main.js +++ b/app/public/js/main.js @@ -338,7 +338,7 @@ function drawEvent(data, svg_area) { .remove(); var circle_container = circle_group.append('a'); - circle_container.attr('xlink:href', 'https://github.com/' + data.repo_name); + circle_container.attr('xlink:href', data.url); circle_container.attr('target', '_blank'); circle_container.attr('fill', svg_text_color); diff --git a/server/index.js b/server/index.js index d11108c..caa879e 100755 --- a/server/index.js +++ b/server/index.js @@ -116,7 +116,8 @@ function stripData(data){ 'repo_name': data.repo.name, 'payload_size': data.payload.size, 'message': data.payload.commits[0].message, - 'created': data.created_at + 'created': data.created_at, + 'url': data.repo.url }); pushEventCounter++; } @@ -130,7 +131,8 @@ function stripData(data){ 'repo_name': data.repo.name, 'payload_size': 0, 'message': data.body, - 'created': data.created_at + 'created': data.created_at, + 'url': data.payload.comment.html_url }); }else if(data.type == 'PullRequestEvent'){ if (data.payload.pull_request.merged) data.payload.action = 'merged'; @@ -143,7 +145,8 @@ function stripData(data){ 'repo_name': data.repo.name, 'action': data.payload.action, // opened, reopened, closed, merged 'message': data.payload.pull_request.title, - 'created': data.created_at + 'created': data.created_at, + 'url': data.payload.pull_request.html_url }); }else if(data.type == 'IssuesEvent'){ stripedData.push({ @@ -155,7 +158,8 @@ function stripData(data){ 'repo_name': data.repo.name, 'action': data.payload.action, // opened, reopened, closed 'message': data.payload.issue.title, - 'created': data.created_at + 'created': data.created_at, + 'url': data.payload.issue.html_url }); } });