{"action":"created","comment":{"url":"https://api.github.com/repos/fedora-infra/fedocal/pulls/comments/31232950","id":31232950,"diff_hunk":"@@ -428,3 +428,47 @@ def callback(response):\n         status=status,\n         mimetype='application/json'\n     )\n+\n+\n+@APP.route('/api/<username>/shield/<calendar_name>/')\n+@APP.route('/api/<username>/shield/<calendar_name>')\n+def api_user_shield(username, calendar_name):\n+    \"\"\"\n+User shield\n+===========\n+\n+Provides a small image (a shield) displaying the status of the specified\n+user on the specified calendar if the user is currently managing a meeting.\n+\n+If the user is not managing a meeting, this endpoint does not return\n+anything.\n+\n+    \"\"\"\n+    @flask.after_this_request\n+    def callback(response):\n+        \"\"\" Handle case the query was an JQuery ajax call. \"\"\"\n+        return check_callback(response)\n+\n+    calendarobj = Calendar.by_id(SESSION, calendar_name)\n+    if not calendarobj:\n+        flask.abort(400, 'Invalid calendar provided')\n+\n+    start_date = datetime.datetime.utcnow().date()\n+    end_date = start_date + datetime.timedelta(days=1)\n+\n+    meetings = fedocallib.get_by_date(\n+        SESSION, calendarobj, start_date, end_date, tzone='UTC')\n+\n+    output = {'status': ''}","path":"fedocal/api.py","position":35,"original_position":35,"commit_id":"310b054614c7412c0b9389da3abe9a1495b2e11b","original_commit_id":"310b054614c7412c0b9389da3abe9a1495b2e11b","user":{"login":"ralphbean","id":331338,"avatar_url":"https://avatars.githubusercontent.com/u/331338?v=3","gravatar_id":"","url":"https://api.github.com/users/ralphbean","html_url":"https://github.com/ralphbean","followers_url":"https://api.github.com/users/ralphbean/followers","following_url":"https://api.github.com/users/ralphbean/following{/other_user}","gists_url":"https://api.github.com/users/ralphbean/gists{/gist_id}","starred_url":"https://api.github.com/users/ralphbean/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ralphbean/subscriptions","organizations_url":"https://api.github.com/users/ralphbean/orgs","repos_url":"https://api.github.com/users/ralphbean/repos","events_url":"https://api.github.com/users/ralphbean/events{/privacy}","received_events_url":"https://api.github.com/users/ralphbean/received_events","type":"User","site_admin":false},"body":"> I thought green looks nicer :)\r\n\r\nOh, it does.  I meant red if you are *not* on vacation.\r\n\r\nNow that I look at the pkgdb2 screenshot though, having just one icon looks fine.\r\n\r\nPerhaps, return ``None`` instead of the empty string ``''`` when they're not on vacation.","created_at":"2015-05-28T13:35:20Z","updated_at":"2015-05-28T13:35:20Z","html_url":"https://github.com/fedora-infra/fedocal/pull/175#discussion_r31232950","pull_request_url":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175","_links":{"self":{"href":"https://api.github.com/repos/fedora-infra/fedocal/pulls/comments/31232950"},"html":{"href":"https://github.com/fedora-infra/fedocal/pull/175#discussion_r31232950"},"pull_request":{"href":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175"}}},"pull_request":{"url":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175","id":36380302,"html_url":"https://github.com/fedora-infra/fedocal/pull/175","diff_url":"https://github.com/fedora-infra/fedocal/pull/175.diff","patch_url":"https://github.com/fedora-infra/fedocal/pull/175.patch","issue_url":"https://api.github.com/repos/fedora-infra/fedocal/issues/175","number":175,"state":"open","locked":false,"title":"Add an API endpoint presenting a shield if the user is currently in a meeting","user":{"login":"pypingou","id":1240038,"avatar_url":"https://avatars.githubusercontent.com/u/1240038?v=3","gravatar_id":"","url":"https://api.github.com/users/pypingou","html_url":"https://github.com/pypingou","followers_url":"https://api.github.com/users/pypingou/followers","following_url":"https://api.github.com/users/pypingou/following{/other_user}","gists_url":"https://api.github.com/users/pypingou/gists{/gist_id}","starred_url":"https://api.github.com/users/pypingou/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/pypingou/subscriptions","organizations_url":"https://api.github.com/users/pypingou/orgs","repos_url":"https://api.github.com/users/pypingou/repos","events_url":"https://api.github.com/users/pypingou/events{/privacy}","received_events_url":"https://api.github.com/users/pypingou/received_events","type":"User","site_admin":false},"body":"This can be used to assess if the user is in vacation or in a meeting\r\nsomewhere.\r\n\r\nRelates to https://github.com/fedora-infra/pkgdb2/issues/199","created_at":"2015-05-28T07:54:05Z","updated_at":"2015-05-28T13:35:20Z","closed_at":null,"merged_at":null,"merge_commit_sha":"1ba56e1e68399fe46fbd3e8f304728442274ad65","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175/commits","review_comments_url":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175/comments","review_comment_url":"https://api.github.com/repos/fedora-infra/fedocal/pulls/comments{/number}","comments_url":"https://api.github.com/repos/fedora-infra/fedocal/issues/175/comments","statuses_url":"https://api.github.com/repos/fedora-infra/fedocal/statuses/310b054614c7412c0b9389da3abe9a1495b2e11b","head":{"label":"fedora-infra:api_shield","ref":"api_shield","sha":"310b054614c7412c0b9389da3abe9a1495b2e11b","user":{"login":"fedora-infra","id":3316637,"avatar_url":"https://avatars.githubusercontent.com/u/3316637?v=3","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"repo":{"id":8959394,"name":"fedocal","full_name":"fedora-infra/fedocal","owner":{"login":"fedora-infra","id":3316637,"avatar_url":"https://avatars.githubusercontent.com/u/3316637?v=3","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fedora-infra/fedocal","description":"A web based calendar application for Fedora","fork":false,"url":"https://api.github.com/repos/fedora-infra/fedocal","forks_url":"https://api.github.com/repos/fedora-infra/fedocal/forks","keys_url":"https://api.github.com/repos/fedora-infra/fedocal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fedora-infra/fedocal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fedora-infra/fedocal/teams","hooks_url":"https://api.github.com/repos/fedora-infra/fedocal/hooks","issue_events_url":"https://api.github.com/repos/fedora-infra/fedocal/issues/events{/number}","events_url":"https://api.github.com/repos/fedora-infra/fedocal/events","assignees_url":"https://api.github.com/repos/fedora-infra/fedocal/assignees{/user}","branches_url":"https://api.github.com/repos/fedora-infra/fedocal/branches{/branch}","tags_url":"https://api.github.com/repos/fedora-infra/fedocal/tags","blobs_url":"https://api.github.com/repos/fedora-infra/fedocal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fedora-infra/fedocal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fedora-infra/fedocal/git/refs{/sha}","trees_url":"https://api.github.com/repos/fedora-infra/fedocal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fedora-infra/fedocal/statuses/{sha}","languages_url":"https://api.github.com/repos/fedora-infra/fedocal/languages","stargazers_url":"https://api.github.com/repos/fedora-infra/fedocal/stargazers","contributors_url":"https://api.github.com/repos/fedora-infra/fedocal/contributors","subscribers_url":"https://api.github.com/repos/fedora-infra/fedocal/subscribers","subscription_url":"https://api.github.com/repos/fedora-infra/fedocal/subscription","commits_url":"https://api.github.com/repos/fedora-infra/fedocal/commits{/sha}","git_commits_url":"https://api.github.com/repos/fedora-infra/fedocal/git/commits{/sha}","comments_url":"https://api.github.com/repos/fedora-infra/fedocal/comments{/number}","issue_comment_url":"https://api.github.com/repos/fedora-infra/fedocal/issues/comments{/number}","contents_url":"https://api.github.com/repos/fedora-infra/fedocal/contents/{+path}","compare_url":"https://api.github.com/repos/fedora-infra/fedocal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fedora-infra/fedocal/merges","archive_url":"https://api.github.com/repos/fedora-infra/fedocal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fedora-infra/fedocal/downloads","issues_url":"https://api.github.com/repos/fedora-infra/fedocal/issues{/number}","pulls_url":"https://api.github.com/repos/fedora-infra/fedocal/pulls{/number}","milestones_url":"https://api.github.com/repos/fedora-infra/fedocal/milestones{/number}","notifications_url":"https://api.github.com/repos/fedora-infra/fedocal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fedora-infra/fedocal/labels{/name}","releases_url":"https://api.github.com/repos/fedora-infra/fedocal/releases{/id}","created_at":"2013-03-22T19:35:10Z","updated_at":"2015-04-29T11:14:38Z","pushed_at":"2015-05-28T08:33:45Z","git_url":"git://github.com/fedora-infra/fedocal.git","ssh_url":"git@github.com:fedora-infra/fedocal.git","clone_url":"https://github.com/fedora-infra/fedocal.git","svn_url":"https://github.com/fedora-infra/fedocal","homepage":"","size":4819,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":1,"forks":11,"open_issues":1,"watchers":7,"default_branch":"master"}},"base":{"label":"fedora-infra:master","ref":"master","sha":"741a951387dd9064d0e5f3f66d67f939b843951d","user":{"login":"fedora-infra","id":3316637,"avatar_url":"https://avatars.githubusercontent.com/u/3316637?v=3","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"repo":{"id":8959394,"name":"fedocal","full_name":"fedora-infra/fedocal","owner":{"login":"fedora-infra","id":3316637,"avatar_url":"https://avatars.githubusercontent.com/u/3316637?v=3","gravatar_id":"","url":"https://api.github.com/users/fedora-infra","html_url":"https://github.com/fedora-infra","followers_url":"https://api.github.com/users/fedora-infra/followers","following_url":"https://api.github.com/users/fedora-infra/following{/other_user}","gists_url":"https://api.github.com/users/fedora-infra/gists{/gist_id}","starred_url":"https://api.github.com/users/fedora-infra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fedora-infra/subscriptions","organizations_url":"https://api.github.com/users/fedora-infra/orgs","repos_url":"https://api.github.com/users/fedora-infra/repos","events_url":"https://api.github.com/users/fedora-infra/events{/privacy}","received_events_url":"https://api.github.com/users/fedora-infra/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/fedora-infra/fedocal","description":"A web based calendar application for Fedora","fork":false,"url":"https://api.github.com/repos/fedora-infra/fedocal","forks_url":"https://api.github.com/repos/fedora-infra/fedocal/forks","keys_url":"https://api.github.com/repos/fedora-infra/fedocal/keys{/key_id}","collaborators_url":"https://api.github.com/repos/fedora-infra/fedocal/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/fedora-infra/fedocal/teams","hooks_url":"https://api.github.com/repos/fedora-infra/fedocal/hooks","issue_events_url":"https://api.github.com/repos/fedora-infra/fedocal/issues/events{/number}","events_url":"https://api.github.com/repos/fedora-infra/fedocal/events","assignees_url":"https://api.github.com/repos/fedora-infra/fedocal/assignees{/user}","branches_url":"https://api.github.com/repos/fedora-infra/fedocal/branches{/branch}","tags_url":"https://api.github.com/repos/fedora-infra/fedocal/tags","blobs_url":"https://api.github.com/repos/fedora-infra/fedocal/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/fedora-infra/fedocal/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/fedora-infra/fedocal/git/refs{/sha}","trees_url":"https://api.github.com/repos/fedora-infra/fedocal/git/trees{/sha}","statuses_url":"https://api.github.com/repos/fedora-infra/fedocal/statuses/{sha}","languages_url":"https://api.github.com/repos/fedora-infra/fedocal/languages","stargazers_url":"https://api.github.com/repos/fedora-infra/fedocal/stargazers","contributors_url":"https://api.github.com/repos/fedora-infra/fedocal/contributors","subscribers_url":"https://api.github.com/repos/fedora-infra/fedocal/subscribers","subscription_url":"https://api.github.com/repos/fedora-infra/fedocal/subscription","commits_url":"https://api.github.com/repos/fedora-infra/fedocal/commits{/sha}","git_commits_url":"https://api.github.com/repos/fedora-infra/fedocal/git/commits{/sha}","comments_url":"https://api.github.com/repos/fedora-infra/fedocal/comments{/number}","issue_comment_url":"https://api.github.com/repos/fedora-infra/fedocal/issues/comments{/number}","contents_url":"https://api.github.com/repos/fedora-infra/fedocal/contents/{+path}","compare_url":"https://api.github.com/repos/fedora-infra/fedocal/compare/{base}...{head}","merges_url":"https://api.github.com/repos/fedora-infra/fedocal/merges","archive_url":"https://api.github.com/repos/fedora-infra/fedocal/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/fedora-infra/fedocal/downloads","issues_url":"https://api.github.com/repos/fedora-infra/fedocal/issues{/number}","pulls_url":"https://api.github.com/repos/fedora-infra/fedocal/pulls{/number}","milestones_url":"https://api.github.com/repos/fedora-infra/fedocal/milestones{/number}","notifications_url":"https://api.github.com/repos/fedora-infra/fedocal/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/fedora-infra/fedocal/labels{/name}","releases_url":"https://api.github.com/repos/fedora-infra/fedocal/releases{/id}","created_at":"2013-03-22T19:35:10Z","updated_at":"2015-04-29T11:14:38Z","pushed_at":"2015-05-28T08:33:45Z","git_url":"git://github.com/fedora-infra/fedocal.git","ssh_url":"git@github.com:fedora-infra/fedocal.git","clone_url":"https://github.com/fedora-infra/fedocal.git","svn_url":"https://github.com/fedora-infra/fedocal","homepage":"","size":4819,"stargazers_count":7,"watchers_count":7,"language":"Python","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":11,"mirror_url":null,"open_issues_count":1,"forks":11,"open_issues":1,"watchers":7,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175"},"html":{"href":"https://github.com/fedora-infra/fedocal/pull/175"},"issue":{"href":"https://api.github.com/repos/fedora-infra/fedocal/issues/175"},"comments":{"href":"https://api.github.com/repos/fedora-infra/fedocal/issues/175/comments"},"review_comments":{"href":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175/comments"},"review_comment":{"href":"https://api.github.com/repos/fedora-infra/fedocal/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/fedora-infra/fedocal/pulls/175/commits"},"statuses":{"href":"https://api.github.com/repos/fedora-infra/fedocal/statuses/310b054614c7412c0b9389da3abe9a1495b2e11b"}}}}