payload: {"action":"created","comment":{"url":"https://api.github.com/repos/dart-lang/pub-dev/pulls/comments/329415396","pull_request_review_id":294759057,"id":329415396,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDMyOTQxNTM5Ng==","diff_hunk":"@@ -2,11 +2,51 @@\n // for details. All rights reserved. Use of this source code is governed by a\n // BSD-style license that can be found in the LICENSE file.\n \n+import 'dart:convert';\n+\n import 'package:json_annotation/json_annotation.dart';\n import 'package:meta/meta.dart';\n \n part 'account_api.g.dart';\n \n+/// Session data to be cached from the authenticated client.\n+@JsonSerializable()\n+class ClientSessionData {\n+  final String imageUrl;\n+\n+  ClientSessionData({\n+    @required this.imageUrl,\n+  });\n+\n+  factory ClientSessionData.fromJson(Map<String, dynamic> json) =>\n+      _$ClientSessionDataFromJson(json);\n+\n+  Map<String, dynamic> toJson() => _$ClientSessionDataToJson(this);\n+}\n+\n+/// The server-provided status of the current session.\n+@JsonSerializable()\n+class ClientSessionStatus {\n+  final bool changed;\n+  final DateTime expires;\n+\n+  ClientSessionStatus({\n+    @required this.changed,\n+    @required this.expires,","path":"pkg/client_data/lib/account_api.dart","position":36,"original_position":34,"commit_id":"4d4cea109ecaac6578bad516a11bc1686c47c7d7","original_commit_id":"42e5caf300f670c3910569a5bac4ee913341df90","user":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"body":"I don't mind `sessionChanged` (vs the current `changed`), although as the object is `*SessionStatus`, it feels like we are better off with the shorter name.\r\n\r\n`[session]IsValid` is a good question: there is not much value keeping it there, because I don't see a scenario where the `changed` doesn't trigger a page reload and the flag is useful (== we can meaningfully act on it, because it provides more information than we have already known). On the other hand, `expires` does have a useful scenario: we can trigger a popup before the session expires, preventing e.g. sessions where people would otherwise lose their status that they were about to send to the server.","created_at":"2019-09-30T05:45:23Z","updated_at":"2019-09-30T05:45:23Z","html_url":"https://github.com/dart-lang/pub-dev/pull/2817#discussion_r329415396","pull_request_url":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/dart-lang/pub-dev/pulls/comments/329415396"},"html":{"href":"https://github.com/dart-lang/pub-dev/pull/2817#discussion_r329415396"},"pull_request":{"href":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817"}},"in_reply_to_id":329137775},"pull_request":{"url":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817","id":321677351,"node_id":"MDExOlB1bGxSZXF1ZXN0MzIxNjc3MzUx","html_url":"https://github.com/dart-lang/pub-dev/pull/2817","diff_url":"https://github.com/dart-lang/pub-dev/pull/2817.diff","patch_url":"https://github.com/dart-lang/pub-dev/pull/2817.patch","issue_url":"https://api.github.com/repos/dart-lang/pub-dev/issues/2817","number":2817,"state":"open","locked":false,"title":"Set and clear session cookie on login/logout.","user":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"body":"- The set and clear action is on an API endpoint, which makes it simpler (single place, one operation to test for), but it requires a page reload if the cookie has changed (otherwise the background action is a no-op). The reload should happen only on explicit login and logout actions.\r\n- The javascript code does not have access to the cookie (it is http-only).\r\n- The endpoint result contains the flag whether the method call changed the cookie state, and reload happens based on that. It also contains the expiry, which we can use later for displaying a warning before automatic logout or something like that.\r\n- The auth initialization flow is not yet complete, (you can see it on staging, there is still a flicker of \"Login\" displayed), I'll fix that as a subsequent PR. ","created_at":"2019-09-26T11:40:36Z","updated_at":"2019-09-30T05:45:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"13ba63b533dc46f614dd3bb3ab3c83b49250d652","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[{"id":421017733,"node_id":"MDU6TGFiZWw0MjEwMTc3MzM=","url":"https://api.github.com/repos/dart-lang/pub-dev/labels/cla:%20yes","name":"cla: yes","color":"ffffff","default":false}],"milestone":null,"commits_url":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817/commits","review_comments_url":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817/comments","review_comment_url":"https://api.github.com/repos/dart-lang/pub-dev/pulls/comments{/number}","comments_url":"https://api.github.com/repos/dart-lang/pub-dev/issues/2817/comments","statuses_url":"https://api.github.com/repos/dart-lang/pub-dev/statuses/4d4cea109ecaac6578bad516a11bc1686c47c7d7","head":{"label":"isoos:cookie-setter","ref":"cookie-setter","sha":"4d4cea109ecaac6578bad516a11bc1686c47c7d7","user":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"repo":{"id":86555243,"node_id":"MDEwOlJlcG9zaXRvcnk4NjU1NTI0Mw==","name":"pub-dartlang-dart","full_name":"isoos/pub-dartlang-dart","private":false,"owner":{"login":"isoos","id":4778111,"node_id":"MDQ6VXNlcjQ3NzgxMTE=","avatar_url":"https://avatars1.githubusercontent.com/u/4778111?v=4","gravatar_id":"","url":"https://api.github.com/users/isoos","html_url":"https://github.com/isoos","followers_url":"https://api.github.com/users/isoos/followers","following_url":"https://api.github.com/users/isoos/following{/other_user}","gists_url":"https://api.github.com/users/isoos/gists{/gist_id}","starred_url":"https://api.github.com/users/isoos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/isoos/subscriptions","organizations_url":"https://api.github.com/users/isoos/orgs","repos_url":"https://api.github.com/users/isoos/repos","events_url":"https://api.github.com/users/isoos/events{/privacy}","received_events_url":"https://api.github.com/users/isoos/received_events","type":"User","site_admin":false},"html_url":"https://github.com/isoos/pub-dartlang-dart","description":"The pub.dartlang.org site in Dart","fork":true,"url":"https://api.github.com/repos/isoos/pub-dartlang-dart","forks_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/forks","keys_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/keys{/key_id}","collaborators_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/teams","hooks_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/hooks","issue_events_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues/events{/number}","events_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/events","assignees_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/assignees{/user}","branches_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/branches{/branch}","tags_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/tags","blobs_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/refs{/sha}","trees_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/trees{/sha}","statuses_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/statuses/{sha}","languages_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/languages","stargazers_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/stargazers","contributors_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/contributors","subscribers_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/subscribers","subscription_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/subscription","commits_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/commits{/sha}","git_commits_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/git/commits{/sha}","comments_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/comments{/number}","issue_comment_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues/comments{/number}","contents_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/contents/{+path}","compare_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/compare/{base}...{head}","merges_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/merges","archive_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/downloads","issues_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/issues{/number}","pulls_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/pulls{/number}","milestones_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/milestones{/number}","notifications_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/labels{/name}","releases_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/releases{/id}","deployments_url":"https://api.github.com/repos/isoos/pub-dartlang-dart/deployments","created_at":"2017-03-29T08:08:35Z","updated_at":"2019-09-27T14:12:03Z","pushed_at":"2019-09-30T05:37:33Z","git_url":"git://github.com/isoos/pub-dartlang-dart.git","ssh_url":"git@github.com:isoos/pub-dartlang-dart.git","clone_url":"https://github.com/isoos/pub-dartlang-dart.git","svn_url":"https://github.com/isoos/pub-dartlang-dart","homepage":"https://pub.dartlang.org/","size":8612,"stargazers_count":0,"watchers_count":0,"language":"Dart","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":0,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"dart-lang:master","ref":"master","sha":"42ca58cdcdc7bab5c38a712e60ab57a564375474","user":{"login":"dart-lang","id":1609975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDk5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1609975?v=4","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"repo":{"id":28035756,"node_id":"MDEwOlJlcG9zaXRvcnkyODAzNTc1Ng==","name":"pub-dev","full_name":"dart-lang/pub-dev","private":false,"owner":{"login":"dart-lang","id":1609975,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2MDk5NzU=","avatar_url":"https://avatars0.githubusercontent.com/u/1609975?v=4","gravatar_id":"","url":"https://api.github.com/users/dart-lang","html_url":"https://github.com/dart-lang","followers_url":"https://api.github.com/users/dart-lang/followers","following_url":"https://api.github.com/users/dart-lang/following{/other_user}","gists_url":"https://api.github.com/users/dart-lang/gists{/gist_id}","starred_url":"https://api.github.com/users/dart-lang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dart-lang/subscriptions","organizations_url":"https://api.github.com/users/dart-lang/orgs","repos_url":"https://api.github.com/users/dart-lang/repos","events_url":"https://api.github.com/users/dart-lang/events{/privacy}","received_events_url":"https://api.github.com/users/dart-lang/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/dart-lang/pub-dev","description":"Source for the Pub site, written in Dart","fork":false,"url":"https://api.github.com/repos/dart-lang/pub-dev","forks_url":"https://api.github.com/repos/dart-lang/pub-dev/forks","keys_url":"https://api.github.com/repos/dart-lang/pub-dev/keys{/key_id}","collaborators_url":"https://api.github.com/repos/dart-lang/pub-dev/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/dart-lang/pub-dev/teams","hooks_url":"https://api.github.com/repos/dart-lang/pub-dev/hooks","issue_events_url":"https://api.github.com/repos/dart-lang/pub-dev/issues/events{/number}","events_url":"https://api.github.com/repos/dart-lang/pub-dev/events","assignees_url":"https://api.github.com/repos/dart-lang/pub-dev/assignees{/user}","branches_url":"https://api.github.com/repos/dart-lang/pub-dev/branches{/branch}","tags_url":"https://api.github.com/repos/dart-lang/pub-dev/tags","blobs_url":"https://api.github.com/repos/dart-lang/pub-dev/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/dart-lang/pub-dev/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/dart-lang/pub-dev/git/refs{/sha}","trees_url":"https://api.github.com/repos/dart-lang/pub-dev/git/trees{/sha}","statuses_url":"https://api.github.com/repos/dart-lang/pub-dev/statuses/{sha}","languages_url":"https://api.github.com/repos/dart-lang/pub-dev/languages","stargazers_url":"https://api.github.com/repos/dart-lang/pub-dev/stargazers","contributors_url":"https://api.github.com/repos/dart-lang/pub-dev/contributors","subscribers_url":"https://api.github.com/repos/dart-lang/pub-dev/subscribers","subscription_url":"https://api.github.com/repos/dart-lang/pub-dev/subscription","commits_url":"https://api.github.com/repos/dart-lang/pub-dev/commits{/sha}","git_commits_url":"https://api.github.com/repos/dart-lang/pub-dev/git/commits{/sha}","comments_url":"https://api.github.com/repos/dart-lang/pub-dev/comments{/number}","issue_comment_url":"https://api.github.com/repos/dart-lang/pub-dev/issues/comments{/number}","contents_url":"https://api.github.com/repos/dart-lang/pub-dev/contents/{+path}","compare_url":"https://api.github.com/repos/dart-lang/pub-dev/compare/{base}...{head}","merges_url":"https://api.github.com/repos/dart-lang/pub-dev/merges","archive_url":"https://api.github.com/repos/dart-lang/pub-dev/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/dart-lang/pub-dev/downloads","issues_url":"https://api.github.com/repos/dart-lang/pub-dev/issues{/number}","pulls_url":"https://api.github.com/repos/dart-lang/pub-dev/pulls{/number}","milestones_url":"https://api.github.com/repos/dart-lang/pub-dev/milestones{/number}","notifications_url":"https://api.github.com/repos/dart-lang/pub-dev/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/dart-lang/pub-dev/labels{/name}","releases_url":"https://api.github.com/repos/dart-lang/pub-dev/releases{/id}","deployments_url":"https://api.github.com/repos/dart-lang/pub-dev/deployments","created_at":"2014-12-15T12:29:08Z","updated_at":"2019-09-27T15:48:50Z","pushed_at":"2019-09-30T05:37:34Z","git_url":"git://github.com/dart-lang/pub-dev.git","ssh_url":"git@github.com:dart-lang/pub-dev.git","clone_url":"https://github.com/dart-lang/pub-dev.git","svn_url":"https://github.com/dart-lang/pub-dev","homepage":"https://pub.dev","size":8642,"stargazers_count":129,"watchers_count":129,"language":"Dart","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":27,"mirror_url":null,"archived":false,"disabled":false,"open_issues_count":142,"license":{"key":"bsd-3-clause","name":"BSD 3-Clause \"New\" or \"Revised\" License","spdx_id":"BSD-3-Clause","url":"https://api.github.com/licenses/bsd-3-clause","node_id":"MDc6TGljZW5zZTU="},"forks":27,"open_issues":142,"watchers":129,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817"},"html":{"href":"https://github.com/dart-lang/pub-dev/pull/2817"},"issue":{"href":"https://api.github.com/repos/dart-lang/pub-dev/issues/2817"},"comments":{"href":"https://api.github.com/repos/dart-lang/pub-dev/issues/2817/comments"},"review_comments":{"href":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817/comments"},"review_comment":{"href":"https://api.github.com/repos/dart-lang/pub-dev/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/dart-lang/pub-dev/pulls/2817/commits"},"statuses":{"href":"https://api.github.com/repos/dart-lang/pub-dev/statuses/4d4cea109ecaac6578bad516a11bc1686c47c7d7"}},"author_association":"COLLABORATOR"}}
other: {"actor":{"display_login":"isoos"}}