{"action":"created","comment":{"url":"https://api.github.com/repos/osuosl/timesync-node/pulls/comments/36476864","id":36476864,"diff_hunk":"@@ -1,57 +1,58 @@\n-var app = require('./app');\n-var knex = app.get('knex');\n-\n-module.exports = {\n-    validateSlug: function(slug) {\n-        /* matches:\n-          1. at least one letter\n-          2. any number of alphanumeric\n-          3. hyphen-separated sets of alphanumeric\n-\n-          Valid:\n-            test\n-            a1b2-c3\n-            1a2b\n-\n-          Invalid:\n-            a1b2--c3\n-        */\n-        if (slug === undefined || slug === null) {\n-            // Javascript will cast these to \"undefined\" and \"null\",\n-            // which then pass the test\n-            return false;\n-        }\n \n-        // if slug is only one character long, shortcut and finish\n-        // rolling this into the alphanumeric test would conflict with\n-        // getting rid of beginning/ending hyphens\n-        if (RegExp('^[a-z]$').test(slug)) {\n-            return true;\n-        }\n+module.exports = function(app) {\n+    var knex = app.get('knex');\n+    return {\n+        validateSlug: function(slug) {\n+            /* matches:\n+              1. at least one letter\n+              2. any number of alphanumeric\n+              3. hyphen-separated sets of alphanumeric\n+\n+              Valid:\n+                test\n+                a1b2-c3\n+                1a2b\n+\n+              Invalid:\n+                a1b2--c3\n+            */\n+            if (slug === undefined || slug === null) {\n+                // Javascript will cast these to \"undefined\" and \"null\",\n+                // which then pass the test\n+                return false;\n+            }\n \n-        var hasDoubleHyphens = new RegExp('--');\n-        var containsLetter = new RegExp('[a-z]+');\n-\n-        // alphanumeric plus hyphens, but with no external hyphens\n-        var alphanumeric = new RegExp('^[a-z0-9]+[a-z0-9-]*[a-z0-9]+$');\n-\n-        return (containsLetter.test(slug) &&\n-                alphanumeric.test(slug) &&\n-                !hasDoubleHyphens.test(slug));\n-    },\n-\n-    checkUser: function(username, authUser) {\n-        return new Promise(function(resolve, reject) {\n-            if (username === authUser) {\n-                // .first('id') retrieves and resolves the first record\n-                // from the query - http://knexjs.org/#Builder-first\n-                knex('users').first('id')\n-                .where('username', username).then(function(user) {\n-                    return resolve(user.id);\n-                });\n-            }else {\n-                return reject();\n+            // if slug is only one character long, shortcut and finish\n+            // rolling this into the alphanumeric test would conflict with\n+            // getting rid of beginning/ending hyphens\n+            if (RegExp('^[a-z]$').test(slug)) {\n+                return true;\n             }\n-        });\n-    }\n+\n+            var hasDoubleHyphens = new RegExp('--');\n+            var containsLetter = new RegExp('[a-z]+');\n+\n+            // alphanumeric plus hyphens, but with no external hyphens\n+            var alphanumeric = new RegExp('^[a-z0-9]+[a-z0-9-]*[a-z0-9]+$');","path":"src/helpers.js","position":89,"original_position":89,"commit_id":"b5e2c09ef5ffea34b6d03549dd5bef53e4e11070","original_commit_id":"07fbfdd24fa15182668a14b59c893d1d1211e092","user":{"login":"Kennric","id":1696096,"avatar_url":"https://avatars.githubusercontent.com/u/1696096?v=3","gravatar_id":"","url":"https://api.github.com/users/Kennric","html_url":"https://github.com/Kennric","followers_url":"https://api.github.com/users/Kennric/followers","following_url":"https://api.github.com/users/Kennric/following{/other_user}","gists_url":"https://api.github.com/users/Kennric/gists{/gist_id}","starred_url":"https://api.github.com/users/Kennric/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Kennric/subscriptions","organizations_url":"https://api.github.com/users/Kennric/orgs","repos_url":"https://api.github.com/users/Kennric/repos","events_url":"https://api.github.com/users/Kennric/events{/privacy}","received_events_url":"https://api.github.com/users/Kennric/received_events","type":"User","site_admin":false},"body":"One fewer axis for typos. lowercase the lot and we don't have to worry about PgD, gWM, etc","created_at":"2015-08-06T23:07:21Z","updated_at":"2015-08-06T23:07:21Z","html_url":"https://github.com/osuosl/timesync-node/pull/97#discussion_r36476864","pull_request_url":"https://api.github.com/repos/osuosl/timesync-node/pulls/97","_links":{"self":{"href":"https://api.github.com/repos/osuosl/timesync-node/pulls/comments/36476864"},"html":{"href":"https://github.com/osuosl/timesync-node/pull/97#discussion_r36476864"},"pull_request":{"href":"https://api.github.com/repos/osuosl/timesync-node/pulls/97"}}},"pull_request":{"url":"https://api.github.com/repos/osuosl/timesync-node/pulls/97","id":41611561,"html_url":"https://github.com/osuosl/timesync-node/pull/97","diff_url":"https://github.com/osuosl/timesync-node/pull/97.diff","patch_url":"https://github.com/osuosl/timesync-node/pull/97.patch","issue_url":"https://api.github.com/repos/osuosl/timesync-node/issues/97","number":97,"state":"open","locked":false,"title":"POST /projects","user":{"login":"tschuy","id":6532435,"avatar_url":"https://avatars.githubusercontent.com/u/6532435?v=3","gravatar_id":"","url":"https://api.github.com/users/tschuy","html_url":"https://github.com/tschuy","followers_url":"https://api.github.com/users/tschuy/followers","following_url":"https://api.github.com/users/tschuy/following{/other_user}","gists_url":"https://api.github.com/users/tschuy/gists{/gist_id}","starred_url":"https://api.github.com/users/tschuy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tschuy/subscriptions","organizations_url":"https://api.github.com/users/tschuy/orgs","repos_url":"https://api.github.com/users/tschuy/repos","events_url":"https://api.github.com/users/tschuy/events{/privacy}","received_events_url":"https://api.github.com/users/tschuy/received_events","type":"User","site_admin":false},"body":"Fixes https://github.com/osuosl/timesync-node/issues/29.\r\n\r\nThese tests are a work in progress -- I have the \"success\" tests written, and the \"it doesn't add things\" written, but not the error message tests.","created_at":"2015-08-04T20:08:18Z","updated_at":"2015-08-06T23:07:21Z","closed_at":null,"merged_at":null,"merge_commit_sha":"4ac21b09014ce56464c47f4b8aee2f710b0b2009","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/osuosl/timesync-node/pulls/97/commits","review_comments_url":"https://api.github.com/repos/osuosl/timesync-node/pulls/97/comments","review_comment_url":"https://api.github.com/repos/osuosl/timesync-node/pulls/comments{/number}","comments_url":"https://api.github.com/repos/osuosl/timesync-node/issues/97/comments","statuses_url":"https://api.github.com/repos/osuosl/timesync-node/statuses/b5e2c09ef5ffea34b6d03549dd5bef53e4e11070","head":{"label":"osuosl:tschuy/post_new_project","ref":"tschuy/post_new_project","sha":"b5e2c09ef5ffea34b6d03549dd5bef53e4e11070","user":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"repo":{"id":33685026,"name":"timesync-node","full_name":"osuosl/timesync-node","owner":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/osuosl/timesync-node","description":"Time Tracking API","fork":false,"url":"https://api.github.com/repos/osuosl/timesync-node","forks_url":"https://api.github.com/repos/osuosl/timesync-node/forks","keys_url":"https://api.github.com/repos/osuosl/timesync-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/osuosl/timesync-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/osuosl/timesync-node/teams","hooks_url":"https://api.github.com/repos/osuosl/timesync-node/hooks","issue_events_url":"https://api.github.com/repos/osuosl/timesync-node/issues/events{/number}","events_url":"https://api.github.com/repos/osuosl/timesync-node/events","assignees_url":"https://api.github.com/repos/osuosl/timesync-node/assignees{/user}","branches_url":"https://api.github.com/repos/osuosl/timesync-node/branches{/branch}","tags_url":"https://api.github.com/repos/osuosl/timesync-node/tags","blobs_url":"https://api.github.com/repos/osuosl/timesync-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/osuosl/timesync-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/osuosl/timesync-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/osuosl/timesync-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/osuosl/timesync-node/statuses/{sha}","languages_url":"https://api.github.com/repos/osuosl/timesync-node/languages","stargazers_url":"https://api.github.com/repos/osuosl/timesync-node/stargazers","contributors_url":"https://api.github.com/repos/osuosl/timesync-node/contributors","subscribers_url":"https://api.github.com/repos/osuosl/timesync-node/subscribers","subscription_url":"https://api.github.com/repos/osuosl/timesync-node/subscription","commits_url":"https://api.github.com/repos/osuosl/timesync-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/osuosl/timesync-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/osuosl/timesync-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/osuosl/timesync-node/issues/comments{/number}","contents_url":"https://api.github.com/repos/osuosl/timesync-node/contents/{+path}","compare_url":"https://api.github.com/repos/osuosl/timesync-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/osuosl/timesync-node/merges","archive_url":"https://api.github.com/repos/osuosl/timesync-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/osuosl/timesync-node/downloads","issues_url":"https://api.github.com/repos/osuosl/timesync-node/issues{/number}","pulls_url":"https://api.github.com/repos/osuosl/timesync-node/pulls{/number}","milestones_url":"https://api.github.com/repos/osuosl/timesync-node/milestones{/number}","notifications_url":"https://api.github.com/repos/osuosl/timesync-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/osuosl/timesync-node/labels{/name}","releases_url":"https://api.github.com/repos/osuosl/timesync-node/releases{/id}","created_at":"2015-04-09T18:20:54Z","updated_at":"2015-08-04T19:51:26Z","pushed_at":"2015-08-06T23:05:30Z","git_url":"git://github.com/osuosl/timesync-node.git","ssh_url":"git@github.com:osuosl/timesync-node.git","clone_url":"https://github.com/osuosl/timesync-node.git","svn_url":"https://github.com/osuosl/timesync-node","homepage":null,"size":1393,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":39,"forks":2,"open_issues":39,"watchers":1,"default_branch":"develop"}},"base":{"label":"osuosl:develop","ref":"develop","sha":"d79064f1252348589c4acfb38e6ad95c2985b937","user":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"repo":{"id":33685026,"name":"timesync-node","full_name":"osuosl/timesync-node","owner":{"login":"osuosl","id":1380625,"avatar_url":"https://avatars.githubusercontent.com/u/1380625?v=3","gravatar_id":"","url":"https://api.github.com/users/osuosl","html_url":"https://github.com/osuosl","followers_url":"https://api.github.com/users/osuosl/followers","following_url":"https://api.github.com/users/osuosl/following{/other_user}","gists_url":"https://api.github.com/users/osuosl/gists{/gist_id}","starred_url":"https://api.github.com/users/osuosl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/osuosl/subscriptions","organizations_url":"https://api.github.com/users/osuosl/orgs","repos_url":"https://api.github.com/users/osuosl/repos","events_url":"https://api.github.com/users/osuosl/events{/privacy}","received_events_url":"https://api.github.com/users/osuosl/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/osuosl/timesync-node","description":"Time Tracking API","fork":false,"url":"https://api.github.com/repos/osuosl/timesync-node","forks_url":"https://api.github.com/repos/osuosl/timesync-node/forks","keys_url":"https://api.github.com/repos/osuosl/timesync-node/keys{/key_id}","collaborators_url":"https://api.github.com/repos/osuosl/timesync-node/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/osuosl/timesync-node/teams","hooks_url":"https://api.github.com/repos/osuosl/timesync-node/hooks","issue_events_url":"https://api.github.com/repos/osuosl/timesync-node/issues/events{/number}","events_url":"https://api.github.com/repos/osuosl/timesync-node/events","assignees_url":"https://api.github.com/repos/osuosl/timesync-node/assignees{/user}","branches_url":"https://api.github.com/repos/osuosl/timesync-node/branches{/branch}","tags_url":"https://api.github.com/repos/osuosl/timesync-node/tags","blobs_url":"https://api.github.com/repos/osuosl/timesync-node/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/osuosl/timesync-node/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/osuosl/timesync-node/git/refs{/sha}","trees_url":"https://api.github.com/repos/osuosl/timesync-node/git/trees{/sha}","statuses_url":"https://api.github.com/repos/osuosl/timesync-node/statuses/{sha}","languages_url":"https://api.github.com/repos/osuosl/timesync-node/languages","stargazers_url":"https://api.github.com/repos/osuosl/timesync-node/stargazers","contributors_url":"https://api.github.com/repos/osuosl/timesync-node/contributors","subscribers_url":"https://api.github.com/repos/osuosl/timesync-node/subscribers","subscription_url":"https://api.github.com/repos/osuosl/timesync-node/subscription","commits_url":"https://api.github.com/repos/osuosl/timesync-node/commits{/sha}","git_commits_url":"https://api.github.com/repos/osuosl/timesync-node/git/commits{/sha}","comments_url":"https://api.github.com/repos/osuosl/timesync-node/comments{/number}","issue_comment_url":"https://api.github.com/repos/osuosl/timesync-node/issues/comments{/number}","contents_url":"https://api.github.com/repos/osuosl/timesync-node/contents/{+path}","compare_url":"https://api.github.com/repos/osuosl/timesync-node/compare/{base}...{head}","merges_url":"https://api.github.com/repos/osuosl/timesync-node/merges","archive_url":"https://api.github.com/repos/osuosl/timesync-node/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/osuosl/timesync-node/downloads","issues_url":"https://api.github.com/repos/osuosl/timesync-node/issues{/number}","pulls_url":"https://api.github.com/repos/osuosl/timesync-node/pulls{/number}","milestones_url":"https://api.github.com/repos/osuosl/timesync-node/milestones{/number}","notifications_url":"https://api.github.com/repos/osuosl/timesync-node/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/osuosl/timesync-node/labels{/name}","releases_url":"https://api.github.com/repos/osuosl/timesync-node/releases{/id}","created_at":"2015-04-09T18:20:54Z","updated_at":"2015-08-04T19:51:26Z","pushed_at":"2015-08-06T23:05:30Z","git_url":"git://github.com/osuosl/timesync-node.git","ssh_url":"git@github.com:osuosl/timesync-node.git","clone_url":"https://github.com/osuosl/timesync-node.git","svn_url":"https://github.com/osuosl/timesync-node","homepage":null,"size":1393,"stargazers_count":1,"watchers_count":1,"language":"JavaScript","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":39,"forks":2,"open_issues":39,"watchers":1,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/osuosl/timesync-node/pulls/97"},"html":{"href":"https://github.com/osuosl/timesync-node/pull/97"},"issue":{"href":"https://api.github.com/repos/osuosl/timesync-node/issues/97"},"comments":{"href":"https://api.github.com/repos/osuosl/timesync-node/issues/97/comments"},"review_comments":{"href":"https://api.github.com/repos/osuosl/timesync-node/pulls/97/comments"},"review_comment":{"href":"https://api.github.com/repos/osuosl/timesync-node/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/osuosl/timesync-node/pulls/97/commits"},"statuses":{"href":"https://api.github.com/repos/osuosl/timesync-node/statuses/b5e2c09ef5ffea34b6d03549dd5bef53e4e11070"}}}}