{"action":"created","comment":{"url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/comments/89691067","pull_request_review_id":10231498,"id":89691067,"diff_hunk":"@@ -182,8 +184,47 @@ def in_trial?\n     !!subscription.try(:trial?)\n   end\n \n+  def delete_account\n+    ActiveRecord::Base.transaction do\n+      unsubscribe_users_from_newsletter\n+      subscription.cancel_plan! if subscription.present?\n+      destroy\n+    end\n+  end\n+\n+  def unsubscribe_users_from_newsletter\n+    users.each do |user|\n+      user.update!(email_subscription: false) if user.email_subscription\n+    end\n+  end\n+\n+  def restore_brand\n+    ActiveRecord::Base.transaction do\n+      restore\n+      restore_users\n+      restore_subscription\n+    end\n+  end\n+\n   private\n \n+  def restore_users","path":"app/models/brand.rb","position":54,"original_position":54,"commit_id":"a702142964817cc20041a1be53a23db4e18ff767","original_commit_id":"a702142964817cc20041a1be53a23db4e18ff767","user":{"login":"signalplus-dev","id":15848772,"avatar_url":"https://avatars.githubusercontent.com/u/15848772?v=3","gravatar_id":"","url":"https://api.github.com/users/signalplus-dev","html_url":"https://github.com/signalplus-dev","followers_url":"https://api.github.com/users/signalplus-dev/followers","following_url":"https://api.github.com/users/signalplus-dev/following{/other_user}","gists_url":"https://api.github.com/users/signalplus-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/signalplus-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/signalplus-dev/subscriptions","organizations_url":"https://api.github.com/users/signalplus-dev/orgs","repos_url":"https://api.github.com/users/signalplus-dev/repos","events_url":"https://api.github.com/users/signalplus-dev/events{/privacy}","received_events_url":"https://api.github.com/users/signalplus-dev/received_events","type":"User","site_admin":false},"body":"From my above comment, I think moving away from restoring accounts is the way to go. It makes our lives easier.","created_at":"2016-11-27T14:23:44Z","updated_at":"2016-11-27T14:23:44Z","html_url":"https://github.com/signalplus-dev/signalplus/pull/81#discussion_r89691067","pull_request_url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81","_links":{"self":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/comments/89691067"},"html":{"href":"https://github.com/signalplus-dev/signalplus/pull/81#discussion_r89691067"},"pull_request":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81"}}},"pull_request":{"url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81","id":94739878,"html_url":"https://github.com/signalplus-dev/signalplus/pull/81","diff_url":"https://github.com/signalplus-dev/signalplus/pull/81.diff","patch_url":"https://github.com/signalplus-dev/signalplus/pull/81.patch","issue_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues/81","number":81,"state":"open","locked":false,"title":"Close account","user":{"login":"weagleweagle","id":17052014,"avatar_url":"https://avatars.githubusercontent.com/u/17052014?v=3","gravatar_id":"","url":"https://api.github.com/users/weagleweagle","html_url":"https://github.com/weagleweagle","followers_url":"https://api.github.com/users/weagleweagle/followers","following_url":"https://api.github.com/users/weagleweagle/following{/other_user}","gists_url":"https://api.github.com/users/weagleweagle/gists{/gist_id}","starred_url":"https://api.github.com/users/weagleweagle/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/weagleweagle/subscriptions","organizations_url":"https://api.github.com/users/weagleweagle/orgs","repos_url":"https://api.github.com/users/weagleweagle/repos","events_url":"https://api.github.com/users/weagleweagle/events{/privacy}","received_events_url":"https://api.github.com/users/weagleweagle/received_events","type":"User","site_admin":false},"body":"@ricardo-quinones \r\n\r\n- [ ] cancel stripe subscription\r\n- [ ] cancel email subscription if they are currently subscribed\r\n- [ ] soft delete any user's associated with the brand\r\n- [ ] soft delete listen signals\r\n- [ ] cancel stripe subscription\r\n- [ ] make sure any unique compound indices are not affected if the user wants to rejoin at some later time\r\n\r\n### TODO\r\n- [ ] log the user out with messaging","created_at":"2016-11-22T03:01:14Z","updated_at":"2016-11-27T14:23:44Z","closed_at":null,"merged_at":null,"merge_commit_sha":"c953c5730000b5a4854b1c79c28bce2c7d8cc107","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81/commits","review_comments_url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81/comments","review_comment_url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/comments{/number}","comments_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues/81/comments","statuses_url":"https://api.github.com/repos/signalplus-dev/signalplus/statuses/a702142964817cc20041a1be53a23db4e18ff767","head":{"label":"signalplus-dev:close-account","ref":"close-account","sha":"a702142964817cc20041a1be53a23db4e18ff767","user":{"login":"signalplus-dev","id":15848772,"avatar_url":"https://avatars.githubusercontent.com/u/15848772?v=3","gravatar_id":"","url":"https://api.github.com/users/signalplus-dev","html_url":"https://github.com/signalplus-dev","followers_url":"https://api.github.com/users/signalplus-dev/followers","following_url":"https://api.github.com/users/signalplus-dev/following{/other_user}","gists_url":"https://api.github.com/users/signalplus-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/signalplus-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/signalplus-dev/subscriptions","organizations_url":"https://api.github.com/users/signalplus-dev/orgs","repos_url":"https://api.github.com/users/signalplus-dev/repos","events_url":"https://api.github.com/users/signalplus-dev/events{/privacy}","received_events_url":"https://api.github.com/users/signalplus-dev/received_events","type":"User","site_admin":false},"repo":{"id":46185991,"name":"signalplus","full_name":"signalplus-dev/signalplus","owner":{"login":"signalplus-dev","id":15848772,"avatar_url":"https://avatars.githubusercontent.com/u/15848772?v=3","gravatar_id":"","url":"https://api.github.com/users/signalplus-dev","html_url":"https://github.com/signalplus-dev","followers_url":"https://api.github.com/users/signalplus-dev/followers","following_url":"https://api.github.com/users/signalplus-dev/following{/other_user}","gists_url":"https://api.github.com/users/signalplus-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/signalplus-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/signalplus-dev/subscriptions","organizations_url":"https://api.github.com/users/signalplus-dev/orgs","repos_url":"https://api.github.com/users/signalplus-dev/repos","events_url":"https://api.github.com/users/signalplus-dev/events{/privacy}","received_events_url":"https://api.github.com/users/signalplus-dev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/signalplus-dev/signalplus","description":"Proof of concept for signal project","fork":false,"url":"https://api.github.com/repos/signalplus-dev/signalplus","forks_url":"https://api.github.com/repos/signalplus-dev/signalplus/forks","keys_url":"https://api.github.com/repos/signalplus-dev/signalplus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/signalplus-dev/signalplus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/signalplus-dev/signalplus/teams","hooks_url":"https://api.github.com/repos/signalplus-dev/signalplus/hooks","issue_events_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues/events{/number}","events_url":"https://api.github.com/repos/signalplus-dev/signalplus/events","assignees_url":"https://api.github.com/repos/signalplus-dev/signalplus/assignees{/user}","branches_url":"https://api.github.com/repos/signalplus-dev/signalplus/branches{/branch}","tags_url":"https://api.github.com/repos/signalplus-dev/signalplus/tags","blobs_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/refs{/sha}","trees_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/signalplus-dev/signalplus/statuses/{sha}","languages_url":"https://api.github.com/repos/signalplus-dev/signalplus/languages","stargazers_url":"https://api.github.com/repos/signalplus-dev/signalplus/stargazers","contributors_url":"https://api.github.com/repos/signalplus-dev/signalplus/contributors","subscribers_url":"https://api.github.com/repos/signalplus-dev/signalplus/subscribers","subscription_url":"https://api.github.com/repos/signalplus-dev/signalplus/subscription","commits_url":"https://api.github.com/repos/signalplus-dev/signalplus/commits{/sha}","git_commits_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/commits{/sha}","comments_url":"https://api.github.com/repos/signalplus-dev/signalplus/comments{/number}","issue_comment_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues/comments{/number}","contents_url":"https://api.github.com/repos/signalplus-dev/signalplus/contents/{+path}","compare_url":"https://api.github.com/repos/signalplus-dev/signalplus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/signalplus-dev/signalplus/merges","archive_url":"https://api.github.com/repos/signalplus-dev/signalplus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/signalplus-dev/signalplus/downloads","issues_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues{/number}","pulls_url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls{/number}","milestones_url":"https://api.github.com/repos/signalplus-dev/signalplus/milestones{/number}","notifications_url":"https://api.github.com/repos/signalplus-dev/signalplus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/signalplus-dev/signalplus/labels{/name}","releases_url":"https://api.github.com/repos/signalplus-dev/signalplus/releases{/id}","deployments_url":"https://api.github.com/repos/signalplus-dev/signalplus/deployments","created_at":"2015-11-14T18:09:48Z","updated_at":"2016-11-19T14:59:36Z","pushed_at":"2016-11-26T00:09:47Z","git_url":"git://github.com/signalplus-dev/signalplus.git","ssh_url":"git@github.com:signalplus-dev/signalplus.git","clone_url":"https://github.com/signalplus-dev/signalplus.git","svn_url":"https://github.com/signalplus-dev/signalplus","homepage":null,"size":1427,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"base":{"label":"signalplus-dev:master","ref":"master","sha":"6f6d1a7cf60bc13bf72e31dec12c79ed14196a64","user":{"login":"signalplus-dev","id":15848772,"avatar_url":"https://avatars.githubusercontent.com/u/15848772?v=3","gravatar_id":"","url":"https://api.github.com/users/signalplus-dev","html_url":"https://github.com/signalplus-dev","followers_url":"https://api.github.com/users/signalplus-dev/followers","following_url":"https://api.github.com/users/signalplus-dev/following{/other_user}","gists_url":"https://api.github.com/users/signalplus-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/signalplus-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/signalplus-dev/subscriptions","organizations_url":"https://api.github.com/users/signalplus-dev/orgs","repos_url":"https://api.github.com/users/signalplus-dev/repos","events_url":"https://api.github.com/users/signalplus-dev/events{/privacy}","received_events_url":"https://api.github.com/users/signalplus-dev/received_events","type":"User","site_admin":false},"repo":{"id":46185991,"name":"signalplus","full_name":"signalplus-dev/signalplus","owner":{"login":"signalplus-dev","id":15848772,"avatar_url":"https://avatars.githubusercontent.com/u/15848772?v=3","gravatar_id":"","url":"https://api.github.com/users/signalplus-dev","html_url":"https://github.com/signalplus-dev","followers_url":"https://api.github.com/users/signalplus-dev/followers","following_url":"https://api.github.com/users/signalplus-dev/following{/other_user}","gists_url":"https://api.github.com/users/signalplus-dev/gists{/gist_id}","starred_url":"https://api.github.com/users/signalplus-dev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/signalplus-dev/subscriptions","organizations_url":"https://api.github.com/users/signalplus-dev/orgs","repos_url":"https://api.github.com/users/signalplus-dev/repos","events_url":"https://api.github.com/users/signalplus-dev/events{/privacy}","received_events_url":"https://api.github.com/users/signalplus-dev/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/signalplus-dev/signalplus","description":"Proof of concept for signal project","fork":false,"url":"https://api.github.com/repos/signalplus-dev/signalplus","forks_url":"https://api.github.com/repos/signalplus-dev/signalplus/forks","keys_url":"https://api.github.com/repos/signalplus-dev/signalplus/keys{/key_id}","collaborators_url":"https://api.github.com/repos/signalplus-dev/signalplus/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/signalplus-dev/signalplus/teams","hooks_url":"https://api.github.com/repos/signalplus-dev/signalplus/hooks","issue_events_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues/events{/number}","events_url":"https://api.github.com/repos/signalplus-dev/signalplus/events","assignees_url":"https://api.github.com/repos/signalplus-dev/signalplus/assignees{/user}","branches_url":"https://api.github.com/repos/signalplus-dev/signalplus/branches{/branch}","tags_url":"https://api.github.com/repos/signalplus-dev/signalplus/tags","blobs_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/refs{/sha}","trees_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/trees{/sha}","statuses_url":"https://api.github.com/repos/signalplus-dev/signalplus/statuses/{sha}","languages_url":"https://api.github.com/repos/signalplus-dev/signalplus/languages","stargazers_url":"https://api.github.com/repos/signalplus-dev/signalplus/stargazers","contributors_url":"https://api.github.com/repos/signalplus-dev/signalplus/contributors","subscribers_url":"https://api.github.com/repos/signalplus-dev/signalplus/subscribers","subscription_url":"https://api.github.com/repos/signalplus-dev/signalplus/subscription","commits_url":"https://api.github.com/repos/signalplus-dev/signalplus/commits{/sha}","git_commits_url":"https://api.github.com/repos/signalplus-dev/signalplus/git/commits{/sha}","comments_url":"https://api.github.com/repos/signalplus-dev/signalplus/comments{/number}","issue_comment_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues/comments{/number}","contents_url":"https://api.github.com/repos/signalplus-dev/signalplus/contents/{+path}","compare_url":"https://api.github.com/repos/signalplus-dev/signalplus/compare/{base}...{head}","merges_url":"https://api.github.com/repos/signalplus-dev/signalplus/merges","archive_url":"https://api.github.com/repos/signalplus-dev/signalplus/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/signalplus-dev/signalplus/downloads","issues_url":"https://api.github.com/repos/signalplus-dev/signalplus/issues{/number}","pulls_url":"https://api.github.com/repos/signalplus-dev/signalplus/pulls{/number}","milestones_url":"https://api.github.com/repos/signalplus-dev/signalplus/milestones{/number}","notifications_url":"https://api.github.com/repos/signalplus-dev/signalplus/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/signalplus-dev/signalplus/labels{/name}","releases_url":"https://api.github.com/repos/signalplus-dev/signalplus/releases{/id}","deployments_url":"https://api.github.com/repos/signalplus-dev/signalplus/deployments","created_at":"2015-11-14T18:09:48Z","updated_at":"2016-11-19T14:59:36Z","pushed_at":"2016-11-26T00:09:47Z","git_url":"git://github.com/signalplus-dev/signalplus.git","ssh_url":"git@github.com:signalplus-dev/signalplus.git","clone_url":"https://github.com/signalplus-dev/signalplus.git","svn_url":"https://github.com/signalplus-dev/signalplus","homepage":null,"size":1427,"stargazers_count":1,"watchers_count":1,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81"},"html":{"href":"https://github.com/signalplus-dev/signalplus/pull/81"},"issue":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/issues/81"},"comments":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/issues/81/comments"},"review_comments":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81/comments"},"review_comment":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/pulls/81/commits"},"statuses":{"href":"https://api.github.com/repos/signalplus-dev/signalplus/statuses/a702142964817cc20041a1be53a23db4e18ff767"}}}}
{"actor":{"display_login":"signalplus-dev"}}