{"action":"created","comment":{"url":"https://api.github.com/repos/flavour/eden/pulls/comments/43626930","id":43626930,"diff_hunk":"@@ -736,6 +949,136 @@ def _update_subscription(self, subscription):\n         return subscription\n \n     # -------------------------------------------------------------------------\n+    def _update_admin_subscription(self,\n+                                   subscription,\n+                                   pe_id,\n+                                   filter_id=None,\n+                                   subscription_id=None,\n+                                   ):\n+        \"\"\" Update Admin subscription \"\"\"\n+\n+        db = current.db\n+        s3db = current.s3db\n+        # Save filters\n+        filters = subscription.get(\"filters\")\n+        recipient_filter = None\n+        if filters:\n+            stable = s3db.pr_subscription\n+            ftable = s3db.pr_filter\n+            filters_ = json.loads(filters)\n+            for filter_ in filters_:\n+                if filter_[0] == \"id__belongs\" and filter_[1] is not None:\n+                    recipient_filter = [filter_]\n+                    filters_.remove(filter_)\n+                    break\n+            filters_ = json.dumps(filters_)\n+            if filter_id is None:\n+                success = ftable.insert(pe_id=pe_id, query=filters_)\n+                filter_id = success\n+            else:\n+                success = db(ftable.id == filter_id).update(query=filters_)\n+            if not success:\n+                return None\n+\n+        # Save subscription settings\n+        stable = s3db.pr_subscription\n+        frequency = subscription[\"frequency\"]\n+        if subscription_id is None:\n+            if recipient_filter is not None:\n+                recipient_filter = json.dumps(recipient_filter)\n+                success = stable.insert(pe_id=pe_id,\n+                                    filter_id=filter_id,\n+                                    notify_on=subscription[\"notify_on\"],\n+                                    frequency=frequency,\n+                                    method=subscription[\"method\"],\n+                                    comments=recipient_filter,\n+                                    )\n+            else:\n+                success = stable.insert(pe_id=pe_id,\n+                                    filter_id=filter_id,","path":"modules/templates/SAMBRO/controllers.py","position":553,"original_position":553,"commit_id":"bbe62a023d7024ea5cbdea620e791c6448d7e481","original_commit_id":"bbe62a023d7024ea5cbdea620e791c6448d7e481","user":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"body":"indent","created_at":"2015-11-02T13:22:05Z","updated_at":"2015-11-02T13:22:05Z","html_url":"https://github.com/flavour/eden/pull/1201#discussion_r43626930","pull_request_url":"https://api.github.com/repos/flavour/eden/pulls/1201","_links":{"self":{"href":"https://api.github.com/repos/flavour/eden/pulls/comments/43626930"},"html":{"href":"https://github.com/flavour/eden/pull/1201#discussion_r43626930"},"pull_request":{"href":"https://api.github.com/repos/flavour/eden/pulls/1201"}}},"pull_request":{"url":"https://api.github.com/repos/flavour/eden/pulls/1201","id":49100111,"html_url":"https://github.com/flavour/eden/pull/1201","diff_url":"https://github.com/flavour/eden/pull/1201.diff","patch_url":"https://github.com/flavour/eden/pull/1201.patch","issue_url":"https://api.github.com/repos/flavour/eden/issues/1201","number":1201,"state":"open","locked":false,"title":"SAMBRO: admin subscriptions","user":{"login":"biplovbhandari","id":4207677,"avatar_url":"https://avatars.githubusercontent.com/u/4207677?v=3","gravatar_id":"","url":"https://api.github.com/users/biplovbhandari","html_url":"https://github.com/biplovbhandari","followers_url":"https://api.github.com/users/biplovbhandari/followers","following_url":"https://api.github.com/users/biplovbhandari/following{/other_user}","gists_url":"https://api.github.com/users/biplovbhandari/gists{/gist_id}","starred_url":"https://api.github.com/users/biplovbhandari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biplovbhandari/subscriptions","organizations_url":"https://api.github.com/users/biplovbhandari/orgs","repos_url":"https://api.github.com/users/biplovbhandari/repos","events_url":"https://api.github.com/users/biplovbhandari/events{/privacy}","received_events_url":"https://api.github.com/users/biplovbhandari/received_events","type":"User","site_admin":false},"body":"@flavour @nursix Please review...","created_at":"2015-10-29T05:23:56Z","updated_at":"2015-11-02T13:22:05Z","closed_at":null,"merged_at":null,"merge_commit_sha":"6b0b92b3a9457243a779cfe57da70a528799a254","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/flavour/eden/pulls/1201/commits","review_comments_url":"https://api.github.com/repos/flavour/eden/pulls/1201/comments","review_comment_url":"https://api.github.com/repos/flavour/eden/pulls/comments{/number}","comments_url":"https://api.github.com/repos/flavour/eden/issues/1201/comments","statuses_url":"https://api.github.com/repos/flavour/eden/statuses/bbe62a023d7024ea5cbdea620e791c6448d7e481","head":{"label":"biplovbhandari:master","ref":"master","sha":"bbe62a023d7024ea5cbdea620e791c6448d7e481","user":{"login":"biplovbhandari","id":4207677,"avatar_url":"https://avatars.githubusercontent.com/u/4207677?v=3","gravatar_id":"","url":"https://api.github.com/users/biplovbhandari","html_url":"https://github.com/biplovbhandari","followers_url":"https://api.github.com/users/biplovbhandari/followers","following_url":"https://api.github.com/users/biplovbhandari/following{/other_user}","gists_url":"https://api.github.com/users/biplovbhandari/gists{/gist_id}","starred_url":"https://api.github.com/users/biplovbhandari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biplovbhandari/subscriptions","organizations_url":"https://api.github.com/users/biplovbhandari/orgs","repos_url":"https://api.github.com/users/biplovbhandari/repos","events_url":"https://api.github.com/users/biplovbhandari/events{/privacy}","received_events_url":"https://api.github.com/users/biplovbhandari/received_events","type":"User","site_admin":false},"repo":{"id":37774689,"name":"eden","full_name":"biplovbhandari/eden","owner":{"login":"biplovbhandari","id":4207677,"avatar_url":"https://avatars.githubusercontent.com/u/4207677?v=3","gravatar_id":"","url":"https://api.github.com/users/biplovbhandari","html_url":"https://github.com/biplovbhandari","followers_url":"https://api.github.com/users/biplovbhandari/followers","following_url":"https://api.github.com/users/biplovbhandari/following{/other_user}","gists_url":"https://api.github.com/users/biplovbhandari/gists{/gist_id}","starred_url":"https://api.github.com/users/biplovbhandari/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/biplovbhandari/subscriptions","organizations_url":"https://api.github.com/users/biplovbhandari/orgs","repos_url":"https://api.github.com/users/biplovbhandari/repos","events_url":"https://api.github.com/users/biplovbhandari/events{/privacy}","received_events_url":"https://api.github.com/users/biplovbhandari/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/biplovbhandari/eden","description":"Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.. Please sign CLA when submitting pull requests: http://bit.ly/SSF-eCLA","fork":true,"url":"https://api.github.com/repos/biplovbhandari/eden","forks_url":"https://api.github.com/repos/biplovbhandari/eden/forks","keys_url":"https://api.github.com/repos/biplovbhandari/eden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/biplovbhandari/eden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/biplovbhandari/eden/teams","hooks_url":"https://api.github.com/repos/biplovbhandari/eden/hooks","issue_events_url":"https://api.github.com/repos/biplovbhandari/eden/issues/events{/number}","events_url":"https://api.github.com/repos/biplovbhandari/eden/events","assignees_url":"https://api.github.com/repos/biplovbhandari/eden/assignees{/user}","branches_url":"https://api.github.com/repos/biplovbhandari/eden/branches{/branch}","tags_url":"https://api.github.com/repos/biplovbhandari/eden/tags","blobs_url":"https://api.github.com/repos/biplovbhandari/eden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/biplovbhandari/eden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/biplovbhandari/eden/git/refs{/sha}","trees_url":"https://api.github.com/repos/biplovbhandari/eden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/biplovbhandari/eden/statuses/{sha}","languages_url":"https://api.github.com/repos/biplovbhandari/eden/languages","stargazers_url":"https://api.github.com/repos/biplovbhandari/eden/stargazers","contributors_url":"https://api.github.com/repos/biplovbhandari/eden/contributors","subscribers_url":"https://api.github.com/repos/biplovbhandari/eden/subscribers","subscription_url":"https://api.github.com/repos/biplovbhandari/eden/subscription","commits_url":"https://api.github.com/repos/biplovbhandari/eden/commits{/sha}","git_commits_url":"https://api.github.com/repos/biplovbhandari/eden/git/commits{/sha}","comments_url":"https://api.github.com/repos/biplovbhandari/eden/comments{/number}","issue_comment_url":"https://api.github.com/repos/biplovbhandari/eden/issues/comments{/number}","contents_url":"https://api.github.com/repos/biplovbhandari/eden/contents/{+path}","compare_url":"https://api.github.com/repos/biplovbhandari/eden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/biplovbhandari/eden/merges","archive_url":"https://api.github.com/repos/biplovbhandari/eden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/biplovbhandari/eden/downloads","issues_url":"https://api.github.com/repos/biplovbhandari/eden/issues{/number}","pulls_url":"https://api.github.com/repos/biplovbhandari/eden/pulls{/number}","milestones_url":"https://api.github.com/repos/biplovbhandari/eden/milestones{/number}","notifications_url":"https://api.github.com/repos/biplovbhandari/eden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/biplovbhandari/eden/labels{/name}","releases_url":"https://api.github.com/repos/biplovbhandari/eden/releases{/id}","created_at":"2015-06-20T15:32:51Z","updated_at":"2015-06-20T15:33:04Z","pushed_at":"2015-10-30T03:26:09Z","git_url":"git://github.com/biplovbhandari/eden.git","ssh_url":"git@github.com:biplovbhandari/eden.git","clone_url":"https://github.com/biplovbhandari/eden.git","svn_url":"https://github.com/biplovbhandari/eden","homepage":"http://eden.sahanafoundation.org","size":164082,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"flavour:master","ref":"master","sha":"a9cdb00f11adf9e71bfdcbec8865a67ed3ff3654","user":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"repo":{"id":3021325,"name":"eden","full_name":"flavour/eden","owner":{"login":"flavour","id":389592,"avatar_url":"https://avatars.githubusercontent.com/u/389592?v=3","gravatar_id":"","url":"https://api.github.com/users/flavour","html_url":"https://github.com/flavour","followers_url":"https://api.github.com/users/flavour/followers","following_url":"https://api.github.com/users/flavour/following{/other_user}","gists_url":"https://api.github.com/users/flavour/gists{/gist_id}","starred_url":"https://api.github.com/users/flavour/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/flavour/subscriptions","organizations_url":"https://api.github.com/users/flavour/orgs","repos_url":"https://api.github.com/users/flavour/repos","events_url":"https://api.github.com/users/flavour/events{/privacy}","received_events_url":"https://api.github.com/users/flavour/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/flavour/eden","description":"Sahana Eden is an Open Source Humanitarian Platform which can be used to provide solutions for Disaster Management, Development, and Environmental Management sectors.. Please sign CLA when submitting pull requests: http://bit.ly/SSF-eCLA","fork":false,"url":"https://api.github.com/repos/flavour/eden","forks_url":"https://api.github.com/repos/flavour/eden/forks","keys_url":"https://api.github.com/repos/flavour/eden/keys{/key_id}","collaborators_url":"https://api.github.com/repos/flavour/eden/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/flavour/eden/teams","hooks_url":"https://api.github.com/repos/flavour/eden/hooks","issue_events_url":"https://api.github.com/repos/flavour/eden/issues/events{/number}","events_url":"https://api.github.com/repos/flavour/eden/events","assignees_url":"https://api.github.com/repos/flavour/eden/assignees{/user}","branches_url":"https://api.github.com/repos/flavour/eden/branches{/branch}","tags_url":"https://api.github.com/repos/flavour/eden/tags","blobs_url":"https://api.github.com/repos/flavour/eden/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/flavour/eden/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/flavour/eden/git/refs{/sha}","trees_url":"https://api.github.com/repos/flavour/eden/git/trees{/sha}","statuses_url":"https://api.github.com/repos/flavour/eden/statuses/{sha}","languages_url":"https://api.github.com/repos/flavour/eden/languages","stargazers_url":"https://api.github.com/repos/flavour/eden/stargazers","contributors_url":"https://api.github.com/repos/flavour/eden/contributors","subscribers_url":"https://api.github.com/repos/flavour/eden/subscribers","subscription_url":"https://api.github.com/repos/flavour/eden/subscription","commits_url":"https://api.github.com/repos/flavour/eden/commits{/sha}","git_commits_url":"https://api.github.com/repos/flavour/eden/git/commits{/sha}","comments_url":"https://api.github.com/repos/flavour/eden/comments{/number}","issue_comment_url":"https://api.github.com/repos/flavour/eden/issues/comments{/number}","contents_url":"https://api.github.com/repos/flavour/eden/contents/{+path}","compare_url":"https://api.github.com/repos/flavour/eden/compare/{base}...{head}","merges_url":"https://api.github.com/repos/flavour/eden/merges","archive_url":"https://api.github.com/repos/flavour/eden/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/flavour/eden/downloads","issues_url":"https://api.github.com/repos/flavour/eden/issues{/number}","pulls_url":"https://api.github.com/repos/flavour/eden/pulls{/number}","milestones_url":"https://api.github.com/repos/flavour/eden/milestones{/number}","notifications_url":"https://api.github.com/repos/flavour/eden/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/flavour/eden/labels{/name}","releases_url":"https://api.github.com/repos/flavour/eden/releases{/id}","created_at":"2011-12-20T17:49:16Z","updated_at":"2015-10-20T01:51:08Z","pushed_at":"2015-11-02T12:56:14Z","git_url":"git://github.com/flavour/eden.git","ssh_url":"git@github.com:flavour/eden.git","clone_url":"https://github.com/flavour/eden.git","svn_url":"https://github.com/flavour/eden","homepage":"http://eden.sahanafoundation.org","size":206087,"stargazers_count":172,"watchers_count":172,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":428,"mirror_url":null,"open_issues_count":59,"forks":428,"open_issues":59,"watchers":172,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/flavour/eden/pulls/1201"},"html":{"href":"https://github.com/flavour/eden/pull/1201"},"issue":{"href":"https://api.github.com/repos/flavour/eden/issues/1201"},"comments":{"href":"https://api.github.com/repos/flavour/eden/issues/1201/comments"},"review_comments":{"href":"https://api.github.com/repos/flavour/eden/pulls/1201/comments"},"review_comment":{"href":"https://api.github.com/repos/flavour/eden/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/flavour/eden/pulls/1201/commits"},"statuses":{"href":"https://api.github.com/repos/flavour/eden/statuses/bbe62a023d7024ea5cbdea620e791c6448d7e481"}}}}