{"action":"created","comment":{"url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/comments/230709596","pull_request_review_id":171504272,"id":230709596,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDIzMDcwOTU5Ng==","diff_hunk":"@@ -147,6 +147,9 @@ def start_app(args, qt_args) -> None:\n     configure_logging(args.sdc_home)\n     logging.info('Starting SecureDrop Client {}'.format(__version__))\n \n+    # init data singleton\n+    Data(args.sdc_home)","path":"securedrop_client/app.py","position":14,"original_position":14,"commit_id":"9d9173bf5b62b8d81f86d7da59910511e8c4c26c","original_commit_id":"f877e51ef397ad884c118112bd522fd085025055","user":{"login":"ntoll","id":37602,"node_id":"MDQ6VXNlcjM3NjAy","avatar_url":"https://avatars0.githubusercontent.com/u/37602?v=4","gravatar_id":"","url":"https://api.github.com/users/ntoll","html_url":"https://github.com/ntoll","followers_url":"https://api.github.com/users/ntoll/followers","following_url":"https://api.github.com/users/ntoll/following{/other_user}","gists_url":"https://api.github.com/users/ntoll/gists{/gist_id}","starred_url":"https://api.github.com/users/ntoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntoll/subscriptions","organizations_url":"https://api.github.com/users/ntoll/orgs","repos_url":"https://api.github.com/users/ntoll/repos","events_url":"https://api.github.com/users/ntoll/events{/privacy}","received_events_url":"https://api.github.com/users/ntoll/received_events","type":"User","site_admin":false},"body":"Hey folks... this is a really interesting discussion. :-)\r\n\r\nI'm with @heartsucker in outlook about singletons.\r\n\r\nAlso, why the long-running thread rather than using a QTimer based fire-and-forget sync call (i.e. just re-using the code we already have)..? This \"feels\" (note the quotes) simpler to me, and I'm anxious to retain simplicity and re-use what we already have.\r\n\r\nI'd strongly recommend keeping the logic and UI separate. (For instance, the logic layer uses a QTimer to refresh on new message state and call the UI layer if there's a change.)\r\n\r\nAlso, I'm painfully aware that the above comments are based on my limited understanding of the aim of the ticket... it is *very* likely that I have the wrong end of the stick. ;-)","created_at":"2018-11-05T10:59:23Z","updated_at":"2018-11-05T10:59:23Z","html_url":"https://github.com/freedomofpress/securedrop-client/pull/99#discussion_r230709596","pull_request_url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/comments/230709596"},"html":{"href":"https://github.com/freedomofpress/securedrop-client/pull/99#discussion_r230709596"},"pull_request":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99"}},"in_reply_to_id":230363507},"pull_request":{"url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99","id":227849255,"node_id":"MDExOlB1bGxSZXF1ZXN0MjI3ODQ5MjU1","html_url":"https://github.com/freedomofpress/securedrop-client/pull/99","diff_url":"https://github.com/freedomofpress/securedrop-client/pull/99.diff","patch_url":"https://github.com/freedomofpress/securedrop-client/pull/99.patch","issue_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/99","number":99,"state":"open","locked":false,"title":"Download messages in the background, update DB, update UI","user":{"login":"joshuathayer","id":103802,"node_id":"MDQ6VXNlcjEwMzgwMg==","avatar_url":"https://avatars1.githubusercontent.com/u/103802?v=4","gravatar_id":"","url":"https://api.github.com/users/joshuathayer","html_url":"https://github.com/joshuathayer","followers_url":"https://api.github.com/users/joshuathayer/followers","following_url":"https://api.github.com/users/joshuathayer/following{/other_user}","gists_url":"https://api.github.com/users/joshuathayer/gists{/gist_id}","starred_url":"https://api.github.com/users/joshuathayer/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/joshuathayer/subscriptions","organizations_url":"https://api.github.com/users/joshuathayer/orgs","repos_url":"https://api.github.com/users/joshuathayer/repos","events_url":"https://api.github.com/users/joshuathayer/events{/privacy}","received_events_url":"https://api.github.com/users/joshuathayer/received_events","type":"User","site_admin":false},"body":"Adds a background thread to download messages from the SecureDrop server, decrypt those messages, store decrypted messages in the data directory, and indicate in the DB that the file was downloaded.\r\n\r\nAlso adds messages to the UI.\r\n\r\nThis also adds the beginnings of an abstraction for the data directory: it's represented by a singleton that's instantiated initially with the data directory's path. This class should be extended to include a `set` function, and if we like this abstraction we should use it elsewhere in the client code.\r\n\r\nThe message download thread runs in the background for as long as the client is running. It periodically queries the database for messages which have not yet been downloaded, serially downloads and processes those messages, then updates the database to indicate they've been downloaded.\r\n\r\nRequires this securedrop-sdk change, too: https://github.com/freedomofpress/securedrop-sdk/pull/39 (which requires some changes to get tests to pass, apparently. Also I don't seem to have write privs on that repo!)\r\n\r\nThere's still some cleanup to do in this code, but I wanted to get a PR up sooner rather than later. Feel free to pick it apart!\r\n\r\nCloses #40 \r\n\r\n","created_at":"2018-11-02T07:07:33Z","updated_at":"2018-11-05T10:59:23Z","closed_at":null,"merged_at":null,"merge_commit_sha":"e4b1da6da3c901fce36c31fd6ccc2340edaa0f70","assignee":null,"assignees":[],"requested_reviewers":[{"login":"ntoll","id":37602,"node_id":"MDQ6VXNlcjM3NjAy","avatar_url":"https://avatars0.githubusercontent.com/u/37602?v=4","gravatar_id":"","url":"https://api.github.com/users/ntoll","html_url":"https://github.com/ntoll","followers_url":"https://api.github.com/users/ntoll/followers","following_url":"https://api.github.com/users/ntoll/following{/other_user}","gists_url":"https://api.github.com/users/ntoll/gists{/gist_id}","starred_url":"https://api.github.com/users/ntoll/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ntoll/subscriptions","organizations_url":"https://api.github.com/users/ntoll/orgs","repos_url":"https://api.github.com/users/ntoll/repos","events_url":"https://api.github.com/users/ntoll/events{/privacy}","received_events_url":"https://api.github.com/users/ntoll/received_events","type":"User","site_admin":false},{"login":"redshiftzero","id":7832803,"node_id":"MDQ6VXNlcjc4MzI4MDM=","avatar_url":"https://avatars3.githubusercontent.com/u/7832803?v=4","gravatar_id":"","url":"https://api.github.com/users/redshiftzero","html_url":"https://github.com/redshiftzero","followers_url":"https://api.github.com/users/redshiftzero/followers","following_url":"https://api.github.com/users/redshiftzero/following{/other_user}","gists_url":"https://api.github.com/users/redshiftzero/gists{/gist_id}","starred_url":"https://api.github.com/users/redshiftzero/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/redshiftzero/subscriptions","organizations_url":"https://api.github.com/users/redshiftzero/orgs","repos_url":"https://api.github.com/users/redshiftzero/repos","events_url":"https://api.github.com/users/redshiftzero/events{/privacy}","received_events_url":"https://api.github.com/users/redshiftzero/received_events","type":"User","site_admin":false}],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99/commits","review_comments_url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99/comments","review_comment_url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/comments{/number}","comments_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/99/comments","statuses_url":"https://api.github.com/repos/freedomofpress/securedrop-client/statuses/9d9173bf5b62b8d81f86d7da59910511e8c4c26c","head":{"label":"freedomofpress:download-messages","ref":"download-messages","sha":"9d9173bf5b62b8d81f86d7da59910511e8c4c26c","user":{"login":"freedomofpress","id":5388147,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODgxNDc=","avatar_url":"https://avatars1.githubusercontent.com/u/5388147?v=4","gravatar_id":"","url":"https://api.github.com/users/freedomofpress","html_url":"https://github.com/freedomofpress","followers_url":"https://api.github.com/users/freedomofpress/followers","following_url":"https://api.github.com/users/freedomofpress/following{/other_user}","gists_url":"https://api.github.com/users/freedomofpress/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomofpress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomofpress/subscriptions","organizations_url":"https://api.github.com/users/freedomofpress/orgs","repos_url":"https://api.github.com/users/freedomofpress/repos","events_url":"https://api.github.com/users/freedomofpress/events{/privacy}","received_events_url":"https://api.github.com/users/freedomofpress/received_events","type":"Organization","site_admin":false},"repo":{"id":141504341,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE1MDQzNDE=","name":"securedrop-client","full_name":"freedomofpress/securedrop-client","private":false,"owner":{"login":"freedomofpress","id":5388147,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODgxNDc=","avatar_url":"https://avatars1.githubusercontent.com/u/5388147?v=4","gravatar_id":"","url":"https://api.github.com/users/freedomofpress","html_url":"https://github.com/freedomofpress","followers_url":"https://api.github.com/users/freedomofpress/followers","following_url":"https://api.github.com/users/freedomofpress/following{/other_user}","gists_url":"https://api.github.com/users/freedomofpress/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomofpress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomofpress/subscriptions","organizations_url":"https://api.github.com/users/freedomofpress/orgs","repos_url":"https://api.github.com/users/freedomofpress/repos","events_url":"https://api.github.com/users/freedomofpress/events{/privacy}","received_events_url":"https://api.github.com/users/freedomofpress/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/freedomofpress/securedrop-client","description":"a Qt-based GUI for SecureDrop journalists 📰🗞️","fork":false,"url":"https://api.github.com/repos/freedomofpress/securedrop-client","forks_url":"https://api.github.com/repos/freedomofpress/securedrop-client/forks","keys_url":"https://api.github.com/repos/freedomofpress/securedrop-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freedomofpress/securedrop-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freedomofpress/securedrop-client/teams","hooks_url":"https://api.github.com/repos/freedomofpress/securedrop-client/hooks","issue_events_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/events{/number}","events_url":"https://api.github.com/repos/freedomofpress/securedrop-client/events","assignees_url":"https://api.github.com/repos/freedomofpress/securedrop-client/assignees{/user}","branches_url":"https://api.github.com/repos/freedomofpress/securedrop-client/branches{/branch}","tags_url":"https://api.github.com/repos/freedomofpress/securedrop-client/tags","blobs_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freedomofpress/securedrop-client/statuses/{sha}","languages_url":"https://api.github.com/repos/freedomofpress/securedrop-client/languages","stargazers_url":"https://api.github.com/repos/freedomofpress/securedrop-client/stargazers","contributors_url":"https://api.github.com/repos/freedomofpress/securedrop-client/contributors","subscribers_url":"https://api.github.com/repos/freedomofpress/securedrop-client/subscribers","subscription_url":"https://api.github.com/repos/freedomofpress/securedrop-client/subscription","commits_url":"https://api.github.com/repos/freedomofpress/securedrop-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/freedomofpress/securedrop-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/freedomofpress/securedrop-client/contents/{+path}","compare_url":"https://api.github.com/repos/freedomofpress/securedrop-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freedomofpress/securedrop-client/merges","archive_url":"https://api.github.com/repos/freedomofpress/securedrop-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freedomofpress/securedrop-client/downloads","issues_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues{/number}","pulls_url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls{/number}","milestones_url":"https://api.github.com/repos/freedomofpress/securedrop-client/milestones{/number}","notifications_url":"https://api.github.com/repos/freedomofpress/securedrop-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freedomofpress/securedrop-client/labels{/name}","releases_url":"https://api.github.com/repos/freedomofpress/securedrop-client/releases{/id}","deployments_url":"https://api.github.com/repos/freedomofpress/securedrop-client/deployments","created_at":"2018-07-19T00:31:37Z","updated_at":"2018-11-02T21:34:47Z","pushed_at":"2018-11-02T21:34:48Z","git_url":"git://github.com/freedomofpress/securedrop-client.git","ssh_url":"git@github.com:freedomofpress/securedrop-client.git","clone_url":"https://github.com/freedomofpress/securedrop-client.git","svn_url":"https://github.com/freedomofpress/securedrop-client","homepage":"","size":407,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":4,"open_issues":38,"watchers":2,"default_branch":"master"}},"base":{"label":"freedomofpress:master","ref":"master","sha":"a24e93a1451f59268007b19729598eb35ef544c3","user":{"login":"freedomofpress","id":5388147,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODgxNDc=","avatar_url":"https://avatars1.githubusercontent.com/u/5388147?v=4","gravatar_id":"","url":"https://api.github.com/users/freedomofpress","html_url":"https://github.com/freedomofpress","followers_url":"https://api.github.com/users/freedomofpress/followers","following_url":"https://api.github.com/users/freedomofpress/following{/other_user}","gists_url":"https://api.github.com/users/freedomofpress/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomofpress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomofpress/subscriptions","organizations_url":"https://api.github.com/users/freedomofpress/orgs","repos_url":"https://api.github.com/users/freedomofpress/repos","events_url":"https://api.github.com/users/freedomofpress/events{/privacy}","received_events_url":"https://api.github.com/users/freedomofpress/received_events","type":"Organization","site_admin":false},"repo":{"id":141504341,"node_id":"MDEwOlJlcG9zaXRvcnkxNDE1MDQzNDE=","name":"securedrop-client","full_name":"freedomofpress/securedrop-client","private":false,"owner":{"login":"freedomofpress","id":5388147,"node_id":"MDEyOk9yZ2FuaXphdGlvbjUzODgxNDc=","avatar_url":"https://avatars1.githubusercontent.com/u/5388147?v=4","gravatar_id":"","url":"https://api.github.com/users/freedomofpress","html_url":"https://github.com/freedomofpress","followers_url":"https://api.github.com/users/freedomofpress/followers","following_url":"https://api.github.com/users/freedomofpress/following{/other_user}","gists_url":"https://api.github.com/users/freedomofpress/gists{/gist_id}","starred_url":"https://api.github.com/users/freedomofpress/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/freedomofpress/subscriptions","organizations_url":"https://api.github.com/users/freedomofpress/orgs","repos_url":"https://api.github.com/users/freedomofpress/repos","events_url":"https://api.github.com/users/freedomofpress/events{/privacy}","received_events_url":"https://api.github.com/users/freedomofpress/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/freedomofpress/securedrop-client","description":"a Qt-based GUI for SecureDrop journalists 📰🗞️","fork":false,"url":"https://api.github.com/repos/freedomofpress/securedrop-client","forks_url":"https://api.github.com/repos/freedomofpress/securedrop-client/forks","keys_url":"https://api.github.com/repos/freedomofpress/securedrop-client/keys{/key_id}","collaborators_url":"https://api.github.com/repos/freedomofpress/securedrop-client/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/freedomofpress/securedrop-client/teams","hooks_url":"https://api.github.com/repos/freedomofpress/securedrop-client/hooks","issue_events_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/events{/number}","events_url":"https://api.github.com/repos/freedomofpress/securedrop-client/events","assignees_url":"https://api.github.com/repos/freedomofpress/securedrop-client/assignees{/user}","branches_url":"https://api.github.com/repos/freedomofpress/securedrop-client/branches{/branch}","tags_url":"https://api.github.com/repos/freedomofpress/securedrop-client/tags","blobs_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/refs{/sha}","trees_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/trees{/sha}","statuses_url":"https://api.github.com/repos/freedomofpress/securedrop-client/statuses/{sha}","languages_url":"https://api.github.com/repos/freedomofpress/securedrop-client/languages","stargazers_url":"https://api.github.com/repos/freedomofpress/securedrop-client/stargazers","contributors_url":"https://api.github.com/repos/freedomofpress/securedrop-client/contributors","subscribers_url":"https://api.github.com/repos/freedomofpress/securedrop-client/subscribers","subscription_url":"https://api.github.com/repos/freedomofpress/securedrop-client/subscription","commits_url":"https://api.github.com/repos/freedomofpress/securedrop-client/commits{/sha}","git_commits_url":"https://api.github.com/repos/freedomofpress/securedrop-client/git/commits{/sha}","comments_url":"https://api.github.com/repos/freedomofpress/securedrop-client/comments{/number}","issue_comment_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/comments{/number}","contents_url":"https://api.github.com/repos/freedomofpress/securedrop-client/contents/{+path}","compare_url":"https://api.github.com/repos/freedomofpress/securedrop-client/compare/{base}...{head}","merges_url":"https://api.github.com/repos/freedomofpress/securedrop-client/merges","archive_url":"https://api.github.com/repos/freedomofpress/securedrop-client/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/freedomofpress/securedrop-client/downloads","issues_url":"https://api.github.com/repos/freedomofpress/securedrop-client/issues{/number}","pulls_url":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls{/number}","milestones_url":"https://api.github.com/repos/freedomofpress/securedrop-client/milestones{/number}","notifications_url":"https://api.github.com/repos/freedomofpress/securedrop-client/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/freedomofpress/securedrop-client/labels{/name}","releases_url":"https://api.github.com/repos/freedomofpress/securedrop-client/releases{/id}","deployments_url":"https://api.github.com/repos/freedomofpress/securedrop-client/deployments","created_at":"2018-07-19T00:31:37Z","updated_at":"2018-11-02T21:34:47Z","pushed_at":"2018-11-02T21:34:48Z","git_url":"git://github.com/freedomofpress/securedrop-client.git","ssh_url":"git@github.com:freedomofpress/securedrop-client.git","clone_url":"https://github.com/freedomofpress/securedrop-client.git","svn_url":"https://github.com/freedomofpress/securedrop-client","homepage":"","size":407,"stargazers_count":2,"watchers_count":2,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":4,"mirror_url":null,"archived":false,"open_issues_count":38,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":4,"open_issues":38,"watchers":2,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99"},"html":{"href":"https://github.com/freedomofpress/securedrop-client/pull/99"},"issue":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/99"},"comments":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/issues/99/comments"},"review_comments":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99/comments"},"review_comment":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/pulls/99/commits"},"statuses":{"href":"https://api.github.com/repos/freedomofpress/securedrop-client/statuses/9d9173bf5b62b8d81f86d7da59910511e8c4c26c"}},"author_association":"COLLABORATOR"}}
{"actor":{"display_login":"ntoll"}}