{"action":"created","comment":{"url":"https://api.github.com/repos/yonadev/yona-server/pulls/comments/46180736","id":46180736,"diff_hunk":"@@ -103,14 +105,21 @@ public void removeBuddy(UUID idOfRequestingUser, UUID buddyID, Optional<String>\n \t\tUser user = User.getRepository().findOne(idOfRequestingUser);\n \t\tBuddy buddy = getEntityByID(buddyID);\n \n-\t\tclearMessagesAndSendDropBuddyMessage(user, buddy, message, DropBuddyReason.USER_REMOVED_BUDDY);\n+\t\tremoveMessagesSentByBuddy(user, buddy);\n+\t\tremoveBuddyInfoFromBuddy(user, buddy, message, DropBuddyReason.USER_REMOVED_BUDDY);\n \n \t\tuser.removeBuddy(buddy);\n \t\tUser.getRepository().save(user);\n \t}\n \n+\tprivate void removeMessagesSentByBuddy(User user, Buddy buddy)\n+\t{\n+\t\tremoveNamedMessagesSentByUser(user, buddy.getVPNLoginID());\n+\t\tremoveAnonymousMessagesSentByUser(user.getAnonymized(), buddy.getVPNLoginID());\n+\t}\n+\n \t@Transactional\n-\tvoid clearMessagesAndSendDropBuddyMessage(User requestingUser, Buddy requestingUserBuddy, Optional<String> message,\n+\tvoid removeBuddyInfoFromBuddy(User requestingUser, Buddy requestingUserBuddy, Optional<String> message,","path":"core/src/main/java/nu/yona/server/subscriptions/service/BuddyService.java","position":33,"original_position":33,"commit_id":"5c408732c29619fdfdf4783493829439c1a17dea","original_commit_id":"5c408732c29619fdfdf4783493829439c1a17dea","user":{"login":"Bert-R","id":7149792,"avatar_url":"https://avatars.githubusercontent.com/u/7149792?v=3","gravatar_id":"","url":"https://api.github.com/users/Bert-R","html_url":"https://github.com/Bert-R","followers_url":"https://api.github.com/users/Bert-R/followers","following_url":"https://api.github.com/users/Bert-R/following{/other_user}","gists_url":"https://api.github.com/users/Bert-R/gists{/gist_id}","starred_url":"https://api.github.com/users/Bert-R/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Bert-R/subscriptions","organizations_url":"https://api.github.com/users/Bert-R/orgs","repos_url":"https://api.github.com/users/Bert-R/repos","events_url":"https://api.github.com/users/Bert-R/events{/privacy}","received_events_url":"https://api.github.com/users/Bert-R/received_events","type":"User","site_admin":false},"body":"You're not removing the buddy from the buddy but for the given buddy. Renaming this into ``removeBuddyInfoForBuddy``.","created_at":"2015-11-30T18:20:01Z","updated_at":"2015-11-30T18:20:01Z","html_url":"https://github.com/yonadev/yona-server/pull/42#discussion_r46180736","pull_request_url":"https://api.github.com/repos/yonadev/yona-server/pulls/42","_links":{"self":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/comments/46180736"},"html":{"href":"https://github.com/yonadev/yona-server/pull/42#discussion_r46180736"},"pull_request":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/42"}}},"pull_request":{"url":"https://api.github.com/repos/yonadev/yona-server/pulls/42","id":52118054,"html_url":"https://github.com/yonadev/yona-server/pull/42","diff_url":"https://github.com/yonadev/yona-server/pull/42.diff","patch_url":"https://github.com/yonadev/yona-server/pull/42.patch","issue_url":"https://api.github.com/repos/yonadev/yona-server/issues/42","number":42,"state":"open","locked":false,"title":"YD-121 Disconnecting remote Buddy on remove, removing anonymous messages","user":{"login":"aristotelos","id":2814758,"avatar_url":"https://avatars.githubusercontent.com/u/2814758?v=3","gravatar_id":"","url":"https://api.github.com/users/aristotelos","html_url":"https://github.com/aristotelos","followers_url":"https://api.github.com/users/aristotelos/followers","following_url":"https://api.github.com/users/aristotelos/following{/other_user}","gists_url":"https://api.github.com/users/aristotelos/gists{/gist_id}","starred_url":"https://api.github.com/users/aristotelos/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/aristotelos/subscriptions","organizations_url":"https://api.github.com/users/aristotelos/orgs","repos_url":"https://api.github.com/users/aristotelos/repos","events_url":"https://api.github.com/users/aristotelos/events{/privacy}","received_events_url":"https://api.github.com/users/aristotelos/received_events","type":"User","site_admin":false},"body":"Also checking for the case that the buddy connect request was not yet\r\naccepted","created_at":"2015-11-30T12:29:24Z","updated_at":"2015-11-30T18:20:01Z","closed_at":null,"merged_at":null,"merge_commit_sha":"3a1fa035e3417f3ab548d3112cd208693d597041","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/yonadev/yona-server/pulls/42/commits","review_comments_url":"https://api.github.com/repos/yonadev/yona-server/pulls/42/comments","review_comment_url":"https://api.github.com/repos/yonadev/yona-server/pulls/comments{/number}","comments_url":"https://api.github.com/repos/yonadev/yona-server/issues/42/comments","statuses_url":"https://api.github.com/repos/yonadev/yona-server/statuses/5c408732c29619fdfdf4783493829439c1a17dea","head":{"label":"yonadev:yd-121-remove-buddy-fix","ref":"yd-121-remove-buddy-fix","sha":"5c408732c29619fdfdf4783493829439c1a17dea","user":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"repo":{"id":43589108,"name":"yona-server","full_name":"yonadev/yona-server","owner":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yonadev/yona-server","description":"Yona Server","fork":false,"url":"https://api.github.com/repos/yonadev/yona-server","forks_url":"https://api.github.com/repos/yonadev/yona-server/forks","keys_url":"https://api.github.com/repos/yonadev/yona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yonadev/yona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yonadev/yona-server/teams","hooks_url":"https://api.github.com/repos/yonadev/yona-server/hooks","issue_events_url":"https://api.github.com/repos/yonadev/yona-server/issues/events{/number}","events_url":"https://api.github.com/repos/yonadev/yona-server/events","assignees_url":"https://api.github.com/repos/yonadev/yona-server/assignees{/user}","branches_url":"https://api.github.com/repos/yonadev/yona-server/branches{/branch}","tags_url":"https://api.github.com/repos/yonadev/yona-server/tags","blobs_url":"https://api.github.com/repos/yonadev/yona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yonadev/yona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yonadev/yona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/yonadev/yona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yonadev/yona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/yonadev/yona-server/languages","stargazers_url":"https://api.github.com/repos/yonadev/yona-server/stargazers","contributors_url":"https://api.github.com/repos/yonadev/yona-server/contributors","subscribers_url":"https://api.github.com/repos/yonadev/yona-server/subscribers","subscription_url":"https://api.github.com/repos/yonadev/yona-server/subscription","commits_url":"https://api.github.com/repos/yonadev/yona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/yonadev/yona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/yonadev/yona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/yonadev/yona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/yonadev/yona-server/contents/{+path}","compare_url":"https://api.github.com/repos/yonadev/yona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yonadev/yona-server/merges","archive_url":"https://api.github.com/repos/yonadev/yona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yonadev/yona-server/downloads","issues_url":"https://api.github.com/repos/yonadev/yona-server/issues{/number}","pulls_url":"https://api.github.com/repos/yonadev/yona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/yonadev/yona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/yonadev/yona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yonadev/yona-server/labels{/name}","releases_url":"https://api.github.com/repos/yonadev/yona-server/releases{/id}","created_at":"2015-10-03T05:33:54Z","updated_at":"2015-11-16T11:29:28Z","pushed_at":"2015-11-30T18:09:25Z","git_url":"git://github.com/yonadev/yona-server.git","ssh_url":"git@github.com:yonadev/yona-server.git","clone_url":"https://github.com/yonadev/yona-server.git","svn_url":"https://github.com/yonadev/yona-server","homepage":null,"size":895,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"base":{"label":"yonadev:master","ref":"master","sha":"cda1d4096ba7febac6225a686ddb84868d4109b4","user":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"repo":{"id":43589108,"name":"yona-server","full_name":"yonadev/yona-server","owner":{"login":"yonadev","id":14901571,"avatar_url":"https://avatars.githubusercontent.com/u/14901571?v=3","gravatar_id":"","url":"https://api.github.com/users/yonadev","html_url":"https://github.com/yonadev","followers_url":"https://api.github.com/users/yonadev/followers","following_url":"https://api.github.com/users/yonadev/following{/other_user}","gists_url":"https://api.github.com/users/yonadev/gists{/gist_id}","starred_url":"https://api.github.com/users/yonadev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yonadev/subscriptions","organizations_url":"https://api.github.com/users/yonadev/orgs","repos_url":"https://api.github.com/users/yonadev/repos","events_url":"https://api.github.com/users/yonadev/events{/privacy}","received_events_url":"https://api.github.com/users/yonadev/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/yonadev/yona-server","description":"Yona Server","fork":false,"url":"https://api.github.com/repos/yonadev/yona-server","forks_url":"https://api.github.com/repos/yonadev/yona-server/forks","keys_url":"https://api.github.com/repos/yonadev/yona-server/keys{/key_id}","collaborators_url":"https://api.github.com/repos/yonadev/yona-server/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/yonadev/yona-server/teams","hooks_url":"https://api.github.com/repos/yonadev/yona-server/hooks","issue_events_url":"https://api.github.com/repos/yonadev/yona-server/issues/events{/number}","events_url":"https://api.github.com/repos/yonadev/yona-server/events","assignees_url":"https://api.github.com/repos/yonadev/yona-server/assignees{/user}","branches_url":"https://api.github.com/repos/yonadev/yona-server/branches{/branch}","tags_url":"https://api.github.com/repos/yonadev/yona-server/tags","blobs_url":"https://api.github.com/repos/yonadev/yona-server/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/yonadev/yona-server/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/yonadev/yona-server/git/refs{/sha}","trees_url":"https://api.github.com/repos/yonadev/yona-server/git/trees{/sha}","statuses_url":"https://api.github.com/repos/yonadev/yona-server/statuses/{sha}","languages_url":"https://api.github.com/repos/yonadev/yona-server/languages","stargazers_url":"https://api.github.com/repos/yonadev/yona-server/stargazers","contributors_url":"https://api.github.com/repos/yonadev/yona-server/contributors","subscribers_url":"https://api.github.com/repos/yonadev/yona-server/subscribers","subscription_url":"https://api.github.com/repos/yonadev/yona-server/subscription","commits_url":"https://api.github.com/repos/yonadev/yona-server/commits{/sha}","git_commits_url":"https://api.github.com/repos/yonadev/yona-server/git/commits{/sha}","comments_url":"https://api.github.com/repos/yonadev/yona-server/comments{/number}","issue_comment_url":"https://api.github.com/repos/yonadev/yona-server/issues/comments{/number}","contents_url":"https://api.github.com/repos/yonadev/yona-server/contents/{+path}","compare_url":"https://api.github.com/repos/yonadev/yona-server/compare/{base}...{head}","merges_url":"https://api.github.com/repos/yonadev/yona-server/merges","archive_url":"https://api.github.com/repos/yonadev/yona-server/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/yonadev/yona-server/downloads","issues_url":"https://api.github.com/repos/yonadev/yona-server/issues{/number}","pulls_url":"https://api.github.com/repos/yonadev/yona-server/pulls{/number}","milestones_url":"https://api.github.com/repos/yonadev/yona-server/milestones{/number}","notifications_url":"https://api.github.com/repos/yonadev/yona-server/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/yonadev/yona-server/labels{/name}","releases_url":"https://api.github.com/repos/yonadev/yona-server/releases{/id}","created_at":"2015-10-03T05:33:54Z","updated_at":"2015-11-16T11:29:28Z","pushed_at":"2015-11-30T18:09:25Z","git_url":"git://github.com/yonadev/yona-server.git","ssh_url":"git@github.com:yonadev/yona-server.git","clone_url":"https://github.com/yonadev/yona-server.git","svn_url":"https://github.com/yonadev/yona-server","homepage":null,"size":895,"stargazers_count":1,"watchers_count":1,"language":"Java","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":2,"mirror_url":null,"open_issues_count":5,"forks":2,"open_issues":5,"watchers":1,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/42"},"html":{"href":"https://github.com/yonadev/yona-server/pull/42"},"issue":{"href":"https://api.github.com/repos/yonadev/yona-server/issues/42"},"comments":{"href":"https://api.github.com/repos/yonadev/yona-server/issues/42/comments"},"review_comments":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/42/comments"},"review_comment":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/yonadev/yona-server/pulls/42/commits"},"statuses":{"href":"https://api.github.com/repos/yonadev/yona-server/statuses/5c408732c29619fdfdf4783493829439c1a17dea"}}}}