{"action":"created","comment":{"url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/comments/221043653","pull_request_review_id":159598522,"id":221043653,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIyMTA0MzY1Mw==","diff_hunk":"@@ -0,0 +1,71 @@\n+import { first } from 'lodash'\n+import { Observable } from 'rxjs'\n+import { ajax } from 'rxjs/ajax'\n+import { map } from 'rxjs/operators'\n+\n+import { memoizeObservable } from '../../shared/util/memoize'\n+import { GitLabDiffInfo } from './scrape'\n+\n+/**\n+ * Significant revisions for a merge request.\n+ */\n+interface DiffRefs {\n+    base_sha: string\n+    head_sha: string\n+    start_sha: string\n+}\n+\n+/**\n+ * Response from the GitLab API for fetching a merge request. Note that there\n+ * is more information returned but we are not using it.\n+ */\n+interface MRResponse {\n+    diff_refs: DiffRefs\n+}\n+\n+/**\n+ * Response from the GitLab API for fetching a specific version(diff) of a merge\n+ * request. Note that there is more information returned but we are not using it.\n+ */\n+interface DiffVersionsResponse {\n+    base_commit_sha: string\n+}\n+\n+type GetBaseCommitIDInput = Pick<GitLabDiffInfo, 'owner' | 'repoName' | 'mergeRequestID' | 'diffID'>\n+\n+const buildURL = (owner: string, repoName: string, path: string) =>\n+    `${window.location.origin}/api/v4/projects/${owner}%2f${repoName}${path}`\n+\n+const get = <T>(url: string): Observable<T> => ajax.get(url).pipe(map(({ response }) => response as T))","path":"src/libs/gitlab/api.ts","position":39,"original_position":39,"commit_id":"b3db104a723accd49caa6fa7e5e4014674fb8a21","original_commit_id":"b3db104a723accd49caa6fa7e5e4014674fb8a21","user":{"login":"ijsnow","id":11557758,"node_id":"MDQ6VXNlcjExNTU3NzU4","avatar_url":"https://avatars1.githubusercontent.com/u/11557758?v=4","gravatar_id":"","url":"https://api.github.com/users/ijsnow","html_url":"https://github.com/ijsnow","followers_url":"https://api.github.com/users/ijsnow/followers","following_url":"https://api.github.com/users/ijsnow/following{/other_user}","gists_url":"https://api.github.com/users/ijsnow/gists{/gist_id}","starred_url":"https://api.github.com/users/ijsnow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijsnow/subscriptions","organizations_url":"https://api.github.com/users/ijsnow/orgs","repos_url":"https://api.github.com/users/ijsnow/repos","events_url":"https://api.github.com/users/ijsnow/events{/privacy}","received_events_url":"https://api.github.com/users/ijsnow/received_events","type":"User","site_admin":false},"body":"Casting is actually what I intended with that. I think it's easier to read at the call sights.","created_at":"2018-09-27T19:10:30Z","updated_at":"2018-09-27T19:10:30Z","html_url":"https://github.com/sourcegraph/browser-extensions/pull/197#discussion_r221043653","pull_request_url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/comments/221043653"},"html":{"href":"https://github.com/sourcegraph/browser-extensions/pull/197#discussion_r221043653"},"pull_request":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197"}},"in_reply_to_id":221022510},"pull_request":{"url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197","id":218477373,"node_id":"MDExOlB1bGxSZXF1ZXN0MjE4NDc3Mzcz","html_url":"https://github.com/sourcegraph/browser-extensions/pull/197","diff_url":"https://github.com/sourcegraph/browser-extensions/pull/197.diff","patch_url":"https://github.com/sourcegraph/browser-extensions/pull/197.patch","issue_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/197","number":197,"state":"open","locked":false,"title":"feat: Gitlab","user":{"login":"ijsnow","id":11557758,"node_id":"MDQ6VXNlcjExNTU3NzU4","avatar_url":"https://avatars1.githubusercontent.com/u/11557758?v=4","gravatar_id":"","url":"https://api.github.com/users/ijsnow","html_url":"https://github.com/ijsnow","followers_url":"https://api.github.com/users/ijsnow/followers","following_url":"https://api.github.com/users/ijsnow/following{/other_user}","gists_url":"https://api.github.com/users/ijsnow/gists{/gist_id}","starred_url":"https://api.github.com/users/ijsnow/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ijsnow/subscriptions","organizations_url":"https://api.github.com/users/ijsnow/orgs","repos_url":"https://api.github.com/users/ijsnow/repos","events_url":"https://api.github.com/users/ijsnow/events{/privacy}","received_events_url":"https://api.github.com/users/ijsnow/received_events","type":"User","site_admin":false},"body":"This PR brings support for GitLab.\r\n\r\n## Testing plan:\r\n\r\nRun the browser extension and visit the following and check to ensure it works\r\n\r\n### Code intelligence\r\n\r\n* [Diff view with different versions](https://gitlab.com/pantomath-io/panto/merge_requests/348/diffs?view=parallel)\r\n* [Changed file name](https://gitlab.com/ijsnow/hello-gitlab/merge_requests/1/diffs)\r\n* [Diff that’s good for testing misalignment](https://gitlab.com/pantomath-io/panto/merge_requests/348/diffs)\r\n* [Commit page](https://gitlab.com/pantomath-io/panto/commit/3b1dd7ca2039a925e9dba25b402240e1ab98310f)\r\n\r\n### Search\r\n\r\n*Action*: Enable search feature flag and [open this page](https://gitlab.com/search?utf8=%E2%9C%93&search=state&group_id=&project_id=3043340&search_code=true&repository_ref=). \r\n\r\n*Expected result*: A new tab should open on the sourcegraph search results page with the `repo:filter` and search query in the search bar\r\n\r\nI have tested on:\r\n\r\n- [x] Chrome\r\n- [x] Firefox\r\n","created_at":"2018-09-26T22:50:05Z","updated_at":"2018-09-27T19:10:30Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9f0964b0d35239bd37b75832ba136ef74e5c6012","assignee":null,"assignees":[],"requested_reviewers":[{"login":"chrismwendt","id":1387653,"node_id":"MDQ6VXNlcjEzODc2NTM=","avatar_url":"https://avatars0.githubusercontent.com/u/1387653?v=4","gravatar_id":"","url":"https://api.github.com/users/chrismwendt","html_url":"https://github.com/chrismwendt","followers_url":"https://api.github.com/users/chrismwendt/followers","following_url":"https://api.github.com/users/chrismwendt/following{/other_user}","gists_url":"https://api.github.com/users/chrismwendt/gists{/gist_id}","starred_url":"https://api.github.com/users/chrismwendt/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/chrismwendt/subscriptions","organizations_url":"https://api.github.com/users/chrismwendt/orgs","repos_url":"https://api.github.com/users/chrismwendt/repos","events_url":"https://api.github.com/users/chrismwendt/events{/privacy}","received_events_url":"https://api.github.com/users/chrismwendt/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197/commits","review_comments_url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197/comments","review_comment_url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/comments{/number}","comments_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/197/comments","statuses_url":"https://api.github.com/repos/sourcegraph/browser-extensions/statuses/b3db104a723accd49caa6fa7e5e4014674fb8a21","head":{"label":"sourcegraph:gitlab","ref":"gitlab","sha":"b3db104a723accd49caa6fa7e5e4014674fb8a21","user":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":143937990,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM5Mzc5OTA=","name":"browser-extensions","full_name":"sourcegraph/browser-extensions","private":false,"owner":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sourcegraph/browser-extensions","description":"Sourcegraph's browser extensions (Chrome/Firefox)","fork":false,"url":"https://api.github.com/repos/sourcegraph/browser-extensions","forks_url":"https://api.github.com/repos/sourcegraph/browser-extensions/forks","keys_url":"https://api.github.com/repos/sourcegraph/browser-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/browser-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/browser-extensions/teams","hooks_url":"https://api.github.com/repos/sourcegraph/browser-extensions/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/browser-extensions/events","assignees_url":"https://api.github.com/repos/sourcegraph/browser-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/browser-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/browser-extensions/tags","blobs_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/browser-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/browser-extensions/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/browser-extensions/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/browser-extensions/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/browser-extensions/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/browser-extensions/subscription","commits_url":"https://api.github.com/repos/sourcegraph/browser-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/browser-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/browser-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/browser-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/browser-extensions/merges","archive_url":"https://api.github.com/repos/sourcegraph/browser-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/browser-extensions/downloads","issues_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/browser-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/browser-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/browser-extensions/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/browser-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/sourcegraph/browser-extensions/deployments","created_at":"2018-08-07T23:46:16Z","updated_at":"2018-09-23T13:25:00Z","pushed_at":"2018-09-27T18:50:33Z","git_url":"git://github.com/sourcegraph/browser-extensions.git","ssh_url":"git@github.com:sourcegraph/browser-extensions.git","clone_url":"https://github.com/sourcegraph/browser-extensions.git","svn_url":"https://github.com/sourcegraph/browser-extensions","homepage":null,"size":2056,"stargazers_count":22,"watchers_count":22,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5,"open_issues":41,"watchers":22,"default_branch":"master"}},"base":{"label":"sourcegraph:master","ref":"master","sha":"71791ff24f6f87ff86b85008ea3405c0e49843ca","user":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"repo":{"id":143937990,"node_id":"MDEwOlJlcG9zaXRvcnkxNDM5Mzc5OTA=","name":"browser-extensions","full_name":"sourcegraph/browser-extensions","private":false,"owner":{"login":"sourcegraph","id":3979584,"node_id":"MDEyOk9yZ2FuaXphdGlvbjM5Nzk1ODQ=","avatar_url":"https://avatars0.githubusercontent.com/u/3979584?v=4","gravatar_id":"","url":"https://api.github.com/users/sourcegraph","html_url":"https://github.com/sourcegraph","followers_url":"https://api.github.com/users/sourcegraph/followers","following_url":"https://api.github.com/users/sourcegraph/following{/other_user}","gists_url":"https://api.github.com/users/sourcegraph/gists{/gist_id}","starred_url":"https://api.github.com/users/sourcegraph/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sourcegraph/subscriptions","organizations_url":"https://api.github.com/users/sourcegraph/orgs","repos_url":"https://api.github.com/users/sourcegraph/repos","events_url":"https://api.github.com/users/sourcegraph/events{/privacy}","received_events_url":"https://api.github.com/users/sourcegraph/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/sourcegraph/browser-extensions","description":"Sourcegraph's browser extensions (Chrome/Firefox)","fork":false,"url":"https://api.github.com/repos/sourcegraph/browser-extensions","forks_url":"https://api.github.com/repos/sourcegraph/browser-extensions/forks","keys_url":"https://api.github.com/repos/sourcegraph/browser-extensions/keys{/key_id}","collaborators_url":"https://api.github.com/repos/sourcegraph/browser-extensions/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/sourcegraph/browser-extensions/teams","hooks_url":"https://api.github.com/repos/sourcegraph/browser-extensions/hooks","issue_events_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/events{/number}","events_url":"https://api.github.com/repos/sourcegraph/browser-extensions/events","assignees_url":"https://api.github.com/repos/sourcegraph/browser-extensions/assignees{/user}","branches_url":"https://api.github.com/repos/sourcegraph/browser-extensions/branches{/branch}","tags_url":"https://api.github.com/repos/sourcegraph/browser-extensions/tags","blobs_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/refs{/sha}","trees_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/trees{/sha}","statuses_url":"https://api.github.com/repos/sourcegraph/browser-extensions/statuses/{sha}","languages_url":"https://api.github.com/repos/sourcegraph/browser-extensions/languages","stargazers_url":"https://api.github.com/repos/sourcegraph/browser-extensions/stargazers","contributors_url":"https://api.github.com/repos/sourcegraph/browser-extensions/contributors","subscribers_url":"https://api.github.com/repos/sourcegraph/browser-extensions/subscribers","subscription_url":"https://api.github.com/repos/sourcegraph/browser-extensions/subscription","commits_url":"https://api.github.com/repos/sourcegraph/browser-extensions/commits{/sha}","git_commits_url":"https://api.github.com/repos/sourcegraph/browser-extensions/git/commits{/sha}","comments_url":"https://api.github.com/repos/sourcegraph/browser-extensions/comments{/number}","issue_comment_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/comments{/number}","contents_url":"https://api.github.com/repos/sourcegraph/browser-extensions/contents/{+path}","compare_url":"https://api.github.com/repos/sourcegraph/browser-extensions/compare/{base}...{head}","merges_url":"https://api.github.com/repos/sourcegraph/browser-extensions/merges","archive_url":"https://api.github.com/repos/sourcegraph/browser-extensions/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/sourcegraph/browser-extensions/downloads","issues_url":"https://api.github.com/repos/sourcegraph/browser-extensions/issues{/number}","pulls_url":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls{/number}","milestones_url":"https://api.github.com/repos/sourcegraph/browser-extensions/milestones{/number}","notifications_url":"https://api.github.com/repos/sourcegraph/browser-extensions/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/sourcegraph/browser-extensions/labels{/name}","releases_url":"https://api.github.com/repos/sourcegraph/browser-extensions/releases{/id}","deployments_url":"https://api.github.com/repos/sourcegraph/browser-extensions/deployments","created_at":"2018-08-07T23:46:16Z","updated_at":"2018-09-23T13:25:00Z","pushed_at":"2018-09-27T18:50:33Z","git_url":"git://github.com/sourcegraph/browser-extensions.git","ssh_url":"git@github.com:sourcegraph/browser-extensions.git","clone_url":"https://github.com/sourcegraph/browser-extensions.git","svn_url":"https://github.com/sourcegraph/browser-extensions","homepage":null,"size":2056,"stargazers_count":22,"watchers_count":22,"language":"TypeScript","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":5,"mirror_url":null,"archived":false,"open_issues_count":41,"license":{"key":"mit","name":"MIT License","spdx_id":"MIT","url":"https://api.github.com/licenses/mit","node_id":"MDc6TGljZW5zZTEz"},"forks":5,"open_issues":41,"watchers":22,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197"},"html":{"href":"https://github.com/sourcegraph/browser-extensions/pull/197"},"issue":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/197"},"comments":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/issues/197/comments"},"review_comments":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197/comments"},"review_comment":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/pulls/197/commits"},"statuses":{"href":"https://api.github.com/repos/sourcegraph/browser-extensions/statuses/b3db104a723accd49caa6fa7e5e4014674fb8a21"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ijsnow"}}