{"action":"created","comment":{"url":"https://api.github.com/repos/decred/politeia/pulls/comments/204202321","pull_request_review_id":139248910,"id":204202321,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIwNDIwMjMyMQ==","diff_hunk":"@@ -147,6 +150,15 @@ const (\n \tPropVoteStatusStarted     PropVoteStatusT = 2 // Proposal vote has been started\n \tPropVoteStatusFinished    PropVoteStatusT = 3 // Proposal vote has been finished\n \tPropVoteStatusDoesntExist PropVoteStatusT = 4 // Proposal doesn't exist\n+\n+\t// Notification indentifiers\n+\tNotTypeSignupPaywallPaymentConfirmed NotificationType = 0","path":"politeiawww/api/v1/v1.go","position":23,"original_position":23,"commit_id":"bc29e61e3af92b4f614ed0fc17f2eab250398900","original_commit_id":"bc29e61e3af92b4f614ed0fc17f2eab250398900","user":{"login":"sndurkin","id":1452379,"node_id":"MDQ6VXNlcjE0NTIzNzk=","avatar_url":"https://avatars3.githubusercontent.com/u/1452379?v=4","gravatar_id":"","url":"https://api.github.com/users/sndurkin","html_url":"https://github.com/sndurkin","followers_url":"https://api.github.com/users/sndurkin/followers","following_url":"https://api.github.com/users/sndurkin/following{/other_user}","gists_url":"https://api.github.com/users/sndurkin/gists{/gist_id}","starred_url":"https://api.github.com/users/sndurkin/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sndurkin/subscriptions","organizations_url":"https://api.github.com/users/sndurkin/orgs","repos_url":"https://api.github.com/users/sndurkin/repos","events_url":"https://api.github.com/users/sndurkin/events{/privacy}","received_events_url":"https://api.github.com/users/sndurkin/received_events","type":"User","site_admin":false},"body":"I would prefer to prefix these with `Notification` instead of `NotType`, since `NotType` is a little confusing out of context. Also, can you rename the type to `NotificationT` to be consistent with the others?","created_at":"2018-07-21T04:52:55Z","updated_at":"2018-07-21T05:02:32Z","html_url":"https://github.com/decred/politeia/pull/393#discussion_r204202321","pull_request_url":"https://api.github.com/repos/decred/politeia/pulls/393","author_association":"MEMBER","_links":{"self":{"href":"https://api.github.com/repos/decred/politeia/pulls/comments/204202321"},"html":{"href":"https://github.com/decred/politeia/pull/393#discussion_r204202321"},"pull_request":{"href":"https://api.github.com/repos/decred/politeia/pulls/393"}}},"pull_request":{"url":"https://api.github.com/repos/decred/politeia/pulls/393","id":202388810,"node_id":"MDExOlB1bGxSZXF1ZXN0MjAyMzg4ODEw","html_url":"https://github.com/decred/politeia/pull/393","diff_url":"https://github.com/decred/politeia/pull/393.diff","patch_url":"https://github.com/decred/politeia/pull/393.patch","issue_url":"https://api.github.com/repos/decred/politeia/issues/393","number":393,"state":"open","locked":false,"title":"[WIP][www] Add notification mechanism","user":{"login":"fernandoabolafio","id":14864439,"node_id":"MDQ6VXNlcjE0ODY0NDM5","avatar_url":"https://avatars1.githubusercontent.com/u/14864439?v=4","gravatar_id":"","url":"https://api.github.com/users/fernandoabolafio","html_url":"https://github.com/fernandoabolafio","followers_url":"https://api.github.com/users/fernandoabolafio/followers","following_url":"https://api.github.com/users/fernandoabolafio/following{/other_user}","gists_url":"https://api.github.com/users/fernandoabolafio/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandoabolafio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandoabolafio/subscriptions","organizations_url":"https://api.github.com/users/fernandoabolafio/orgs","repos_url":"https://api.github.com/users/fernandoabolafio/repos","events_url":"https://api.github.com/users/fernandoabolafio/events{/privacy}","received_events_url":"https://api.github.com/users/fernandoabolafio/received_events","type":"User","site_admin":false},"body":"This PR implements a notification mechanism for www. So, every relevant action generates a new notification into the user's mailbox.\r\ncloses #372 \r\n**note:** This PR refers to the stage 1 mentioned on the issue #372.\r\n- [x] Handle store notifications on localdb\r\n- [x] Add route to fetch user mailbox\r\n- [x] add handlers to create notifications for the following actions: \r\n   - [x] Paywall payment confirmed\r\n   - [x] Proposal censored\r\n   - [x] Proposal published\r\n   - [x] Proposal voting started\r\n- [x] Add route to set notification as viewed \r\n- [ ] Add unit testing\r\n- [ ] Add corresponding CLI commands\r\n- [ ] Add docs\r\n\r\n\r\n**Update 1: New Routes specs**\r\n- `user/notifications` -> Return all users notifications (user is infered from the session)\r\nExample of response:\r\n\r\n```json\r\n{\r\n   \"Notifications\":[\r\n      {\r\n         \"notificationid\":7,\r\n         \"notificationtype\":2,\r\n         \"timestamp\":1532108311,\r\n         \"url\":\"/proposals/0bf073f338ed4a1e4ad8864319307622a10b58f5b694d99426fc3679da72aaaa\",\r\n         \"viewed\":false\r\n      },\r\n      {\r\n         \"notificationid\":8,\r\n         \"notificationtype\":2,\r\n         \"timestamp\":1532108317,\r\n         \"url\":\"/proposals/8aaba2d85aa47faaef9886a6fee32ae34b12852f80c930443ce878f1ef27388b\",\r\n         \"viewed\":false\r\n      },\r\n      {\r\n         \"notificationid\":9,\r\n         \"notificationtype\":3,\r\n         \"timestamp\":1532109439,\r\n         \"url\":\"/proposals/e51a397605e35f36876bc0af16e7bb4f12b031aba74af96c5e3feb3331628a61\",\r\n         \"viewed\":false\r\n      },\r\n      {\r\n         \"notificationid\":10,\r\n         \"notificationtype\":3,\r\n         \"timestamp\":1532111468,\r\n         \"url\":\"/proposals/1fea24ae9b09ead19d0c4f4fd20742b83331cb48fead42ee7aee006c18d67c14\",\r\n         \"viewed\":false\r\n      }\r\n   ]\r\n}\r\n```\r\n\r\n- `user/notifications/check`: set one or multiple notifications as viewed\r\nExample of request: \r\n```json\r\n{\r\n\t\"notificationids\": [7, 8]\r\n}\r\n```\r\nExample of response:\r\n\r\n```json\r\n{\r\n   \"Notifications\":[\r\n      {\r\n         \"notificationid\":7,\r\n         \"notificationtype\":2,\r\n         \"timestamp\":1532108311,\r\n         \"url\":\"/proposals/0bf073f338ed4a1e4ad8864319307622a10b58f5b694d99426fc3679da72aaaa\",\r\n         \"viewed\":true\r\n      },\r\n      {\r\n         \"notificationid\":8,\r\n         \"notificationtype\":2,\r\n         \"timestamp\":1532108317,\r\n         \"url\":\"/proposals/8aaba2d85aa47faaef9886a6fee32ae34b12852f80c930443ce878f1ef27388b\",\r\n         \"viewed\":true\r\n      },\r\n      {\r\n         \"notificationid\":9,\r\n         \"notificationtype\":3,\r\n         \"timestamp\":1532109439,\r\n         \"url\":\"/proposals/e51a397605e35f36876bc0af16e7bb4f12b031aba74af96c5e3feb3331628a61\",\r\n         \"viewed\":false\r\n      },\r\n      {\r\n         \"notificationid\":10,\r\n         \"notificationtype\":3,\r\n         \"timestamp\":1532111468,\r\n         \"url\":\"/proposals/1fea24ae9b09ead19d0c4f4fd20742b83331cb48fead42ee7aee006c18d67c14\",\r\n         \"viewed\":false\r\n      }\r\n   ]\r\n}\r\n```\r\n\r\n","created_at":"2018-07-18T21:43:30Z","updated_at":"2018-07-21T05:02:32Z","closed_at":null,"merged_at":null,"merge_commit_sha":"450cd3ee48cde66ab75a829550bce28cbc1916a8","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/decred/politeia/pulls/393/commits","review_comments_url":"https://api.github.com/repos/decred/politeia/pulls/393/comments","review_comment_url":"https://api.github.com/repos/decred/politeia/pulls/comments{/number}","comments_url":"https://api.github.com/repos/decred/politeia/issues/393/comments","statuses_url":"https://api.github.com/repos/decred/politeia/statuses/bc29e61e3af92b4f614ed0fc17f2eab250398900","head":{"label":"fernandoabolafio:notifications","ref":"notifications","sha":"bc29e61e3af92b4f614ed0fc17f2eab250398900","user":{"login":"fernandoabolafio","id":14864439,"node_id":"MDQ6VXNlcjE0ODY0NDM5","avatar_url":"https://avatars1.githubusercontent.com/u/14864439?v=4","gravatar_id":"","url":"https://api.github.com/users/fernandoabolafio","html_url":"https://github.com/fernandoabolafio","followers_url":"https://api.github.com/users/fernandoabolafio/followers","following_url":"https://api.github.com/users/fernandoabolafio/following{/other_user}","gists_url":"https://api.github.com/users/fernandoabolafio/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandoabolafio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandoabolafio/subscriptions","organizations_url":"https://api.github.com/users/fernandoabolafio/orgs","repos_url":"https://api.github.com/users/fernandoabolafio/repos","events_url":"https://api.github.com/users/fernandoabolafio/events{/privacy}","received_events_url":"https://api.github.com/users/fernandoabolafio/received_events","type":"User","site_admin":false},"repo":{"id":117990373,"node_id":"MDEwOlJlcG9zaXRvcnkxMTc5OTAzNzM=","name":"politeia","full_name":"fernandoabolafio/politeia","owner":{"login":"fernandoabolafio","id":14864439,"node_id":"MDQ6VXNlcjE0ODY0NDM5","avatar_url":"https://avatars1.githubusercontent.com/u/14864439?v=4","gravatar_id":"","url":"https://api.github.com/users/fernandoabolafio","html_url":"https://github.com/fernandoabolafio","followers_url":"https://api.github.com/users/fernandoabolafio/followers","following_url":"https://api.github.com/users/fernandoabolafio/following{/other_user}","gists_url":"https://api.github.com/users/fernandoabolafio/gists{/gist_id}","starred_url":"https://api.github.com/users/fernandoabolafio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fernandoabolafio/subscriptions","organizations_url":"https://api.github.com/users/fernandoabolafio/orgs","repos_url":"https://api.github.com/users/fernandoabolafio/repos","events_url":"https://api.github.com/users/fernandoabolafio/events{/privacy}","received_events_url":"https://api.github.com/users/fernandoabolafio/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/fernandoabolafio/politeia","description":null,"fork":true,"url":"https://api.github.com/repos/fernandoabolafio/politeia","forks_url":"https://api.github.com/repos/fernandoabolafio/politeia/forks","keys_url":"https://api.github.com/repos/fernandoabolafio/politeia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fernandoabolafio/politeia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fernandoabolafio/politeia/teams","hooks_url":"https://api.github.com/repos/fernandoabolafio/politeia/hooks","issue_events_url":"https://api.github.com/repos/fernandoabolafio/politeia/issues/events{/number}","events_url":"https://api.github.com/repos/fernandoabolafio/politeia/events","assignees_url":"https://api.github.com/repos/fernandoabolafio/politeia/assignees{/user}","branches_url":"https://api.github.com/repos/fernandoabolafio/politeia/branches{/branch}","tags_url":"https://api.github.com/repos/fernandoabolafio/politeia/tags","blobs_url":"https://api.github.com/repos/fernandoabolafio/politeia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fernandoabolafio/politeia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fernandoabolafio/politeia/git/refs{/sha}","trees_url":"https://api.github.com/repos/fernandoabolafio/politeia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fernandoabolafio/politeia/statuses/{sha}","languages_url":"https://api.github.com/repos/fernandoabolafio/politeia/languages","stargazers_url":"https://api.github.com/repos/fernandoabolafio/politeia/stargazers","contributors_url":"https://api.github.com/repos/fernandoabolafio/politeia/contributors","subscribers_url":"https://api.github.com/repos/fernandoabolafio/politeia/subscribers","subscription_url":"https://api.github.com/repos/fernandoabolafio/politeia/subscription","commits_url":"https://api.github.com/repos/fernandoabolafio/politeia/commits{/sha}","git_commits_url":"https://api.github.com/repos/fernandoabolafio/politeia/git/commits{/sha}","comments_url":"https://api.github.com/repos/fernandoabolafio/politeia/comments{/number}","issue_comment_url":"https://api.github.com/repos/fernandoabolafio/politeia/issues/comments{/number}","contents_url":"https://api.github.com/repos/fernandoabolafio/politeia/contents/{+path}","compare_url":"https://api.github.com/repos/fernandoabolafio/politeia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fernandoabolafio/politeia/merges","archive_url":"https://api.github.com/repos/fernandoabolafio/politeia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fernandoabolafio/politeia/downloads","issues_url":"https://api.github.com/repos/fernandoabolafio/politeia/issues{/number}","pulls_url":"https://api.github.com/repos/fernandoabolafio/politeia/pulls{/number}","milestones_url":"https://api.github.com/repos/fernandoabolafio/politeia/milestones{/number}","notifications_url":"https://api.github.com/repos/fernandoabolafio/politeia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fernandoabolafio/politeia/labels{/name}","releases_url":"https://api.github.com/repos/fernandoabolafio/politeia/releases{/id}","deployments_url":"https://api.github.com/repos/fernandoabolafio/politeia/deployments","created_at":"2018-01-18T14:02:19Z","updated_at":"2018-06-28T12:11:33Z","pushed_at":"2018-07-20T21:04:07Z","git_url":"git://github.com/fernandoabolafio/politeia.git","ssh_url":"git@github.com:fernandoabolafio/politeia.git","clone_url":"https://github.com/fernandoabolafio/politeia.git","svn_url":"https://github.com/fernandoabolafio/politeia","homepage":null,"size":1108,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"decred:master","ref":"master","sha":"63410369153a9705acb33a1385cb3925958db04a","user":{"login":"decred","id":16297194,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2Mjk3MTk0","avatar_url":"https://avatars3.githubusercontent.com/u/16297194?v=4","gravatar_id":"","url":"https://api.github.com/users/decred","html_url":"https://github.com/decred","followers_url":"https://api.github.com/users/decred/followers","following_url":"https://api.github.com/users/decred/following{/other_user}","gists_url":"https://api.github.com/users/decred/gists{/gist_id}","starred_url":"https://api.github.com/users/decred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decred/subscriptions","organizations_url":"https://api.github.com/users/decred/orgs","repos_url":"https://api.github.com/users/decred/repos","events_url":"https://api.github.com/users/decred/events{/privacy}","received_events_url":"https://api.github.com/users/decred/received_events","type":"Organization","site_admin":false},"repo":{"id":101333624,"node_id":"MDEwOlJlcG9zaXRvcnkxMDEzMzM2MjQ=","name":"politeia","full_name":"decred/politeia","owner":{"login":"decred","id":16297194,"node_id":"MDEyOk9yZ2FuaXphdGlvbjE2Mjk3MTk0","avatar_url":"https://avatars3.githubusercontent.com/u/16297194?v=4","gravatar_id":"","url":"https://api.github.com/users/decred","html_url":"https://github.com/decred","followers_url":"https://api.github.com/users/decred/followers","following_url":"https://api.github.com/users/decred/following{/other_user}","gists_url":"https://api.github.com/users/decred/gists{/gist_id}","starred_url":"https://api.github.com/users/decred/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/decred/subscriptions","organizations_url":"https://api.github.com/users/decred/orgs","repos_url":"https://api.github.com/users/decred/repos","events_url":"https://api.github.com/users/decred/events{/privacy}","received_events_url":"https://api.github.com/users/decred/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/decred/politeia","description":null,"fork":false,"url":"https://api.github.com/repos/decred/politeia","forks_url":"https://api.github.com/repos/decred/politeia/forks","keys_url":"https://api.github.com/repos/decred/politeia/keys{/key_id}","collaborators_url":"https://api.github.com/repos/decred/politeia/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/decred/politeia/teams","hooks_url":"https://api.github.com/repos/decred/politeia/hooks","issue_events_url":"https://api.github.com/repos/decred/politeia/issues/events{/number}","events_url":"https://api.github.com/repos/decred/politeia/events","assignees_url":"https://api.github.com/repos/decred/politeia/assignees{/user}","branches_url":"https://api.github.com/repos/decred/politeia/branches{/branch}","tags_url":"https://api.github.com/repos/decred/politeia/tags","blobs_url":"https://api.github.com/repos/decred/politeia/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/decred/politeia/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/decred/politeia/git/refs{/sha}","trees_url":"https://api.github.com/repos/decred/politeia/git/trees{/sha}","statuses_url":"https://api.github.com/repos/decred/politeia/statuses/{sha}","languages_url":"https://api.github.com/repos/decred/politeia/languages","stargazers_url":"https://api.github.com/repos/decred/politeia/stargazers","contributors_url":"https://api.github.com/repos/decred/politeia/contributors","subscribers_url":"https://api.github.com/repos/decred/politeia/subscribers","subscription_url":"https://api.github.com/repos/decred/politeia/subscription","commits_url":"https://api.github.com/repos/decred/politeia/commits{/sha}","git_commits_url":"https://api.github.com/repos/decred/politeia/git/commits{/sha}","comments_url":"https://api.github.com/repos/decred/politeia/comments{/number}","issue_comment_url":"https://api.github.com/repos/decred/politeia/issues/comments{/number}","contents_url":"https://api.github.com/repos/decred/politeia/contents/{+path}","compare_url":"https://api.github.com/repos/decred/politeia/compare/{base}...{head}","merges_url":"https://api.github.com/repos/decred/politeia/merges","archive_url":"https://api.github.com/repos/decred/politeia/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/decred/politeia/downloads","issues_url":"https://api.github.com/repos/decred/politeia/issues{/number}","pulls_url":"https://api.github.com/repos/decred/politeia/pulls{/number}","milestones_url":"https://api.github.com/repos/decred/politeia/milestones{/number}","notifications_url":"https://api.github.com/repos/decred/politeia/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/decred/politeia/labels{/name}","releases_url":"https://api.github.com/repos/decred/politeia/releases{/id}","deployments_url":"https://api.github.com/repos/decred/politeia/deployments","created_at":"2017-08-24T20:07:43Z","updated_at":"2018-07-20T20:40:50Z","pushed_at":"2018-07-20T21:04:09Z","git_url":"git://github.com/decred/politeia.git","ssh_url":"git@github.com:decred/politeia.git","clone_url":"https://github.com/decred/politeia.git","svn_url":"https://github.com/decred/politeia","homepage":null,"size":990,"stargazers_count":56,"watchers_count":56,"language":"Go","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":30,"mirror_url":null,"archived":false,"open_issues_count":46,"license":{"key":"isc","name":"ISC License","spdx_id":"ISC","url":"https://api.github.com/licenses/isc","node_id":"MDc6TGljZW5zZTEw"},"forks":30,"open_issues":46,"watchers":56,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/decred/politeia/pulls/393"},"html":{"href":"https://github.com/decred/politeia/pull/393"},"issue":{"href":"https://api.github.com/repos/decred/politeia/issues/393"},"comments":{"href":"https://api.github.com/repos/decred/politeia/issues/393/comments"},"review_comments":{"href":"https://api.github.com/repos/decred/politeia/pulls/393/comments"},"review_comment":{"href":"https://api.github.com/repos/decred/politeia/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/decred/politeia/pulls/393/commits"},"statuses":{"href":"https://api.github.com/repos/decred/politeia/statuses/bc29e61e3af92b4f614ed0fc17f2eab250398900"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"sndurkin"}}