{"action":"created","comment":{"url":"https://api.github.com/repos/systers/portal/pulls/comments/174362568","pull_request_review_id":103702523,"id":174362568,"diff_hunk":"@@ -1168,3 +1168,56 @@ def check_permissions(self, request):\n         self.comment = get_object_or_404(Comment, pk=self.kwargs['comment_pk'])\n         systersuser = get_object_or_404(SystersUser, user=request.user)\n         return systersuser == self.comment.author\n+\n+\n+class CancelMeetupLocationJoinRequestView(LoginRequiredMixin, SingleObjectMixin,\n+                                          RedirectView):\n+    \"\"\"Cancel a join request to a meetup location view\"\"\"\n+    model = MeetupLocation\n+    permanent = False\n+    raise_exception = True\n+\n+    # TODO: add `redirect_unauthenticated_users = True` when django-braces will\n+    # reach version 1.5\n+\n+    def get_redirect_url(self, *args, **kwargs):\n+        \"\"\"Redirect to the page the user was previously on\"\"\"\n+        return self.request.GET.get('current_url')\n+\n+    def get(self, request, *args, **kwargs):\n+        \"\"\"Attempt to cancel user join request towards a meetup location\"\"\"\n+        user = get_object_or_404(User, username=self.kwargs.get('username'))\n+        systersuser = get_object_or_404(SystersUser, user=user)\n+\n+        join_requests = self.get_object().join_requests.all()\n+        members = self.get_object().members.all()\n+\n+        # for OK case\n+        if systersuser not in members and systersuser in join_requests:\n+            self.get_object().join_requests.remove(systersuser)\n+            messages.add_message(\n+                request,\n+                messages.SUCCESS,\n+                \"Your request to join {0} meetup location was canceled.\".format(self.get_object())\n+            )\n+        # for ALREADY_MEMBER case","path":"systers_portal/meetup/views.py","position":45,"original_position":45,"commit_id":"bed0a570c947cd848a6129402155b5212afa95a6","original_commit_id":"bed0a570c947cd848a6129402155b5212afa95a6","user":{"login":"sa7i","id":13400691,"avatar_url":"https://avatars2.githubusercontent.com/u/13400691?v=4","gravatar_id":"","url":"https://api.github.com/users/sa7i","html_url":"https://github.com/sa7i","followers_url":"https://api.github.com/users/sa7i/followers","following_url":"https://api.github.com/users/sa7i/following{/other_user}","gists_url":"https://api.github.com/users/sa7i/gists{/gist_id}","starred_url":"https://api.github.com/users/sa7i/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sa7i/subscriptions","organizations_url":"https://api.github.com/users/sa7i/orgs","repos_url":"https://api.github.com/users/sa7i/repos","events_url":"https://api.github.com/users/sa7i/events{/privacy}","received_events_url":"https://api.github.com/users/sa7i/received_events","type":"User","site_admin":false},"body":"Instead of \"# for ALREADY_MEMBER case\" you can rewrite comments like in this method.  https://github.com/systers/portal/blob/3d870165ad0b93e55c084a2e463bede642ec6ff3/systers_portal/community/views.py#L227 \r\n","created_at":"2018-03-14T06:26:51Z","updated_at":"2018-03-14T06:26:51Z","html_url":"https://github.com/systers/portal/pull/336#discussion_r174362568","pull_request_url":"https://api.github.com/repos/systers/portal/pulls/336","author_association":"COLLABORATOR","_links":{"self":{"href":"https://api.github.com/repos/systers/portal/pulls/comments/174362568"},"html":{"href":"https://github.com/systers/portal/pull/336#discussion_r174362568"},"pull_request":{"href":"https://api.github.com/repos/systers/portal/pulls/336"}}},"pull_request":{"url":"https://api.github.com/repos/systers/portal/pulls/336","id":172239989,"html_url":"https://github.com/systers/portal/pull/336","diff_url":"https://github.com/systers/portal/pull/336.diff","patch_url":"https://github.com/systers/portal/pull/336.patch","issue_url":"https://api.github.com/repos/systers/portal/issues/336","number":336,"state":"open","locked":false,"title":"fixes #333: add cancel button for non-approved join request","user":{"login":"ajatprabha","id":11836668,"avatar_url":"https://avatars3.githubusercontent.com/u/11836668?v=4","gravatar_id":"","url":"https://api.github.com/users/ajatprabha","html_url":"https://github.com/ajatprabha","followers_url":"https://api.github.com/users/ajatprabha/followers","following_url":"https://api.github.com/users/ajatprabha/following{/other_user}","gists_url":"https://api.github.com/users/ajatprabha/gists{/gist_id}","starred_url":"https://api.github.com/users/ajatprabha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajatprabha/subscriptions","organizations_url":"https://api.github.com/users/ajatprabha/orgs","repos_url":"https://api.github.com/users/ajatprabha/repos","events_url":"https://api.github.com/users/ajatprabha/events{/privacy}","received_events_url":"https://api.github.com/users/ajatprabha/received_events","type":"User","site_admin":false},"body":"### Description\r\nA cancel button is shown when the user has created a join request but the request is not accepted.\r\n\r\nFixes #333\r\n\r\n### Type of Change:\r\n- Code\r\n- Quality Assurance\r\n- New feature (non-breaking change which adds functionality pre-approved by mentors)\r\n\r\n### How Has This Been Tested?\r\nCoverage is at 99%. \r\nFollowing lines were not covered `141-142, 400, 451, 479, 531, 569, 594, 1026, 1051` of `systers_portal.meetup.views`, however, this commit affects `L1171-1223` only.\r\n\r\n### Checklist:\r\n\r\n- [x] My PR follows the style guidelines for this project\r\n- [x] I have performed a self-review of my own code or materials\r\n- [x] I have commented my code or provided relevant documentation, particularly in hard-to-understand areas\r\n\r\n**Code/Quality Assurance Only**\r\n- [x] My changes generate no new warnings \r\n- [x] I have added tests that prove my fix is effective or that my feature works\r\n- [x] New and existing unit tests pass locally with my changes\r\n","created_at":"2018-03-01T13:43:52Z","updated_at":"2018-03-14T06:26:51Z","closed_at":null,"merged_at":null,"merge_commit_sha":"ca24519d9150c6cb98bcbd210b6fc5972bba6f91","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/systers/portal/pulls/336/commits","review_comments_url":"https://api.github.com/repos/systers/portal/pulls/336/comments","review_comment_url":"https://api.github.com/repos/systers/portal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/systers/portal/issues/336/comments","statuses_url":"https://api.github.com/repos/systers/portal/statuses/bed0a570c947cd848a6129402155b5212afa95a6","head":{"label":"ajatprabha:ticket_333","ref":"ticket_333","sha":"bed0a570c947cd848a6129402155b5212afa95a6","user":{"login":"ajatprabha","id":11836668,"avatar_url":"https://avatars3.githubusercontent.com/u/11836668?v=4","gravatar_id":"","url":"https://api.github.com/users/ajatprabha","html_url":"https://github.com/ajatprabha","followers_url":"https://api.github.com/users/ajatprabha/followers","following_url":"https://api.github.com/users/ajatprabha/following{/other_user}","gists_url":"https://api.github.com/users/ajatprabha/gists{/gist_id}","starred_url":"https://api.github.com/users/ajatprabha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajatprabha/subscriptions","organizations_url":"https://api.github.com/users/ajatprabha/orgs","repos_url":"https://api.github.com/users/ajatprabha/repos","events_url":"https://api.github.com/users/ajatprabha/events{/privacy}","received_events_url":"https://api.github.com/users/ajatprabha/received_events","type":"User","site_admin":false},"repo":{"id":123407729,"name":"portal","full_name":"ajatprabha/portal","owner":{"login":"ajatprabha","id":11836668,"avatar_url":"https://avatars3.githubusercontent.com/u/11836668?v=4","gravatar_id":"","url":"https://api.github.com/users/ajatprabha","html_url":"https://github.com/ajatprabha","followers_url":"https://api.github.com/users/ajatprabha/followers","following_url":"https://api.github.com/users/ajatprabha/following{/other_user}","gists_url":"https://api.github.com/users/ajatprabha/gists{/gist_id}","starred_url":"https://api.github.com/users/ajatprabha/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ajatprabha/subscriptions","organizations_url":"https://api.github.com/users/ajatprabha/orgs","repos_url":"https://api.github.com/users/ajatprabha/repos","events_url":"https://api.github.com/users/ajatprabha/events{/privacy}","received_events_url":"https://api.github.com/users/ajatprabha/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ajatprabha/portal","description":"Systers Portal for communities","fork":true,"url":"https://api.github.com/repos/ajatprabha/portal","forks_url":"https://api.github.com/repos/ajatprabha/portal/forks","keys_url":"https://api.github.com/repos/ajatprabha/portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ajatprabha/portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ajatprabha/portal/teams","hooks_url":"https://api.github.com/repos/ajatprabha/portal/hooks","issue_events_url":"https://api.github.com/repos/ajatprabha/portal/issues/events{/number}","events_url":"https://api.github.com/repos/ajatprabha/portal/events","assignees_url":"https://api.github.com/repos/ajatprabha/portal/assignees{/user}","branches_url":"https://api.github.com/repos/ajatprabha/portal/branches{/branch}","tags_url":"https://api.github.com/repos/ajatprabha/portal/tags","blobs_url":"https://api.github.com/repos/ajatprabha/portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ajatprabha/portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ajatprabha/portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/ajatprabha/portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ajatprabha/portal/statuses/{sha}","languages_url":"https://api.github.com/repos/ajatprabha/portal/languages","stargazers_url":"https://api.github.com/repos/ajatprabha/portal/stargazers","contributors_url":"https://api.github.com/repos/ajatprabha/portal/contributors","subscribers_url":"https://api.github.com/repos/ajatprabha/portal/subscribers","subscription_url":"https://api.github.com/repos/ajatprabha/portal/subscription","commits_url":"https://api.github.com/repos/ajatprabha/portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/ajatprabha/portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/ajatprabha/portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/ajatprabha/portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/ajatprabha/portal/contents/{+path}","compare_url":"https://api.github.com/repos/ajatprabha/portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ajatprabha/portal/merges","archive_url":"https://api.github.com/repos/ajatprabha/portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ajatprabha/portal/downloads","issues_url":"https://api.github.com/repos/ajatprabha/portal/issues{/number}","pulls_url":"https://api.github.com/repos/ajatprabha/portal/pulls{/number}","milestones_url":"https://api.github.com/repos/ajatprabha/portal/milestones{/number}","notifications_url":"https://api.github.com/repos/ajatprabha/portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ajatprabha/portal/labels{/name}","releases_url":"https://api.github.com/repos/ajatprabha/portal/releases{/id}","deployments_url":"https://api.github.com/repos/ajatprabha/portal/deployments","created_at":"2018-03-01T08:48:26Z","updated_at":"2018-03-01T08:48:28Z","pushed_at":"2018-03-11T10:57:17Z","git_url":"git://github.com/ajatprabha/portal.git","ssh_url":"git@github.com:ajatprabha/portal.git","clone_url":"https://github.com/ajatprabha/portal.git","svn_url":"https://github.com/ajatprabha/portal","homepage":null,"size":5934,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"archived":false,"open_issues_count":0,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":0,"open_issues":0,"watchers":0,"default_branch":"develop"}},"base":{"label":"systers:develop","ref":"develop","sha":"2db1ffc1854b5627423e1b76f35e0424249d078c","user":{"login":"systers","id":6520415,"avatar_url":"https://avatars0.githubusercontent.com/u/6520415?v=4","gravatar_id":"","url":"https://api.github.com/users/systers","html_url":"https://github.com/systers","followers_url":"https://api.github.com/users/systers/followers","following_url":"https://api.github.com/users/systers/following{/other_user}","gists_url":"https://api.github.com/users/systers/gists{/gist_id}","starred_url":"https://api.github.com/users/systers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systers/subscriptions","organizations_url":"https://api.github.com/users/systers/orgs","repos_url":"https://api.github.com/users/systers/repos","events_url":"https://api.github.com/users/systers/events{/privacy}","received_events_url":"https://api.github.com/users/systers/received_events","type":"Organization","site_admin":false},"repo":{"id":19014376,"name":"portal","full_name":"systers/portal","owner":{"login":"systers","id":6520415,"avatar_url":"https://avatars0.githubusercontent.com/u/6520415?v=4","gravatar_id":"","url":"https://api.github.com/users/systers","html_url":"https://github.com/systers","followers_url":"https://api.github.com/users/systers/followers","following_url":"https://api.github.com/users/systers/following{/other_user}","gists_url":"https://api.github.com/users/systers/gists{/gist_id}","starred_url":"https://api.github.com/users/systers/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/systers/subscriptions","organizations_url":"https://api.github.com/users/systers/orgs","repos_url":"https://api.github.com/users/systers/repos","events_url":"https://api.github.com/users/systers/events{/privacy}","received_events_url":"https://api.github.com/users/systers/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/systers/portal","description":"Systers Portal for communities","fork":false,"url":"https://api.github.com/repos/systers/portal","forks_url":"https://api.github.com/repos/systers/portal/forks","keys_url":"https://api.github.com/repos/systers/portal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/systers/portal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/systers/portal/teams","hooks_url":"https://api.github.com/repos/systers/portal/hooks","issue_events_url":"https://api.github.com/repos/systers/portal/issues/events{/number}","events_url":"https://api.github.com/repos/systers/portal/events","assignees_url":"https://api.github.com/repos/systers/portal/assignees{/user}","branches_url":"https://api.github.com/repos/systers/portal/branches{/branch}","tags_url":"https://api.github.com/repos/systers/portal/tags","blobs_url":"https://api.github.com/repos/systers/portal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/systers/portal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/systers/portal/git/refs{/sha}","trees_url":"https://api.github.com/repos/systers/portal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/systers/portal/statuses/{sha}","languages_url":"https://api.github.com/repos/systers/portal/languages","stargazers_url":"https://api.github.com/repos/systers/portal/stargazers","contributors_url":"https://api.github.com/repos/systers/portal/contributors","subscribers_url":"https://api.github.com/repos/systers/portal/subscribers","subscription_url":"https://api.github.com/repos/systers/portal/subscription","commits_url":"https://api.github.com/repos/systers/portal/commits{/sha}","git_commits_url":"https://api.github.com/repos/systers/portal/git/commits{/sha}","comments_url":"https://api.github.com/repos/systers/portal/comments{/number}","issue_comment_url":"https://api.github.com/repos/systers/portal/issues/comments{/number}","contents_url":"https://api.github.com/repos/systers/portal/contents/{+path}","compare_url":"https://api.github.com/repos/systers/portal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/systers/portal/merges","archive_url":"https://api.github.com/repos/systers/portal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/systers/portal/downloads","issues_url":"https://api.github.com/repos/systers/portal/issues{/number}","pulls_url":"https://api.github.com/repos/systers/portal/pulls{/number}","milestones_url":"https://api.github.com/repos/systers/portal/milestones{/number}","notifications_url":"https://api.github.com/repos/systers/portal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/systers/portal/labels{/name}","releases_url":"https://api.github.com/repos/systers/portal/releases{/id}","deployments_url":"https://api.github.com/repos/systers/portal/deployments","created_at":"2014-04-22T02:29:14Z","updated_at":"2018-03-07T14:07:39Z","pushed_at":"2018-03-11T15:00:06Z","git_url":"git://github.com/systers/portal.git","ssh_url":"git@github.com:systers/portal.git","clone_url":"https://github.com/systers/portal.git","svn_url":"https://github.com/systers/portal","homepage":null,"size":5938,"stargazers_count":38,"watchers_count":38,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":126,"mirror_url":null,"archived":false,"open_issues_count":45,"license":{"key":"gpl-2.0","name":"GNU General Public License v2.0","spdx_id":"GPL-2.0","url":"https://api.github.com/licenses/gpl-2.0"},"forks":126,"open_issues":45,"watchers":38,"default_branch":"develop"}},"_links":{"self":{"href":"https://api.github.com/repos/systers/portal/pulls/336"},"html":{"href":"https://github.com/systers/portal/pull/336"},"issue":{"href":"https://api.github.com/repos/systers/portal/issues/336"},"comments":{"href":"https://api.github.com/repos/systers/portal/issues/336/comments"},"review_comments":{"href":"https://api.github.com/repos/systers/portal/pulls/336/comments"},"review_comment":{"href":"https://api.github.com/repos/systers/portal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/systers/portal/pulls/336/commits"},"statuses":{"href":"https://api.github.com/repos/systers/portal/statuses/bed0a570c947cd848a6129402155b5212afa95a6"}},"author_association":"NONE"}}
{"actor":{"display_login":"sa7i"}}