{"action":"created","comment":{"url":"https://api.github.com/repos/monicahq/monica/pulls/comments/243481933","pull_request_review_id":187264652,"id":243481933,"node_id":"MDI0OlB1bGxSZXF1ZXN0UmV2aWV3Q29tbWVudDI0MzQ4MTkzMw==","diff_hunk":"@@ -306,40 +291,53 @@ public function edit(Contact $contact)\n     }\n \n     /**\n-     * Update the identity and address of the People object.\n+     * Update the contact.\n      *\n      * @param  Request $request\n      * @param Contact $contact\n      * @return \\Illuminate\\Http\\Response\n      */\n     public function update(Request $request, Contact $contact)\n     {\n-        $validator = Validator::make($request->all(), [\n-            'firstname' => 'required|max:50',\n-            'lastname' => 'max:100',\n-            'nickname' => 'max:100',\n-            'description' => 'max:240',\n-            'gender' => 'required',\n-            'file' => 'max:10240',\n-            'birthdate' => 'required|string',\n-            'birthdayDate' => 'date_format:Y-m-d',\n-        ]);\n-\n-        if ($validator->fails()) {\n-            return back()\n-                ->withInput()\n-                ->withErrors($validator);\n+        // process birthday dates\n+        // TODO: remove this part entirely when we redo this whole SpecialDate\n+        // thing\n+        if ($request->get('birthdate') == 'exact') {\n+            $birthdate = $request->input('birthdayDate');\n+            $birthdate = DateHelper::parseDate($birthdate);\n+            $day = $birthdate->day;\n+            $month = $birthdate->month;\n+            $year = $birthdate->year;\n+        } else {\n+            $day = $request->get('day');\n+            $month = $request->get('month');\n+            $year = $request->get('year');\n         }\n \n-        if (! $contact->setName($request->input('firstname'), $request->input('lastname'))) {\n-            return back()\n-                ->withInput()\n-                ->withErrors('There has been a problem with saving the name.');\n-        }\n+        $data = [\n+            'account_id' => auth()->user()->account->id,\n+            'contact_id' => $contact->id,\n+            'first_name' => $request->get('firstname'),\n+            'last_name' => $request->input('lastname', null),\n+            'nickname' => $request->input('nickname', null),\n+            'gender_id' => $request->get('gender'),\n+            'description' => $request->input('description', null),\n+            'is_birthdate_known' => ($request->get('birthdate') == 'unknown' ? false : true),\n+            'birthdate_day' => $day,\n+            'birthdate_month' => $month,\n+            'birthdate_year' => $year,\n+            'birthdate_is_age_based' => ($request->get('birthdate') == 'approximate' ? true : false),\n+            'birthdate_age' => $request->get('age'),\n+            'birthdate_add_reminder' => ($request->get('addReminder') != '' ? true : false),\n+            'is_deceased' => ($request->get('is_deceased') != '' ? true : false),\n+            'is_deceased_date_known' => ($request->get('is_deceased_date_known') != '' ? true : false),\n+            'deceased_date_day' => $request->get('deceased_date_day'),\n+            'deceased_date_month' => $request->get('deceased_date_month'),\n+            'deceased_date_year' => $request->get('deceased_date_year'),","path":"app/Http/Controllers/ContactsController.php","position":144,"original_position":144,"commit_id":"90d05a0f27495a3bc19df588720f770f01df7b9c","original_commit_id":"90d05a0f27495a3bc19df588720f770f01df7b9c","user":{"login":"sonarcloud[bot]","id":39514782,"node_id":"MDM6Qm90Mzk1MTQ3ODI=","avatar_url":"https://avatars2.githubusercontent.com/in/12526?v=4","gravatar_id":"","url":"https://api.github.com/users/sonarcloud%5Bbot%5D","html_url":"https://github.com/apps/sonarcloud","followers_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/followers","following_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/following{/other_user}","gists_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/gists{/gist_id}","starred_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/subscriptions","organizations_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/orgs","repos_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/repos","events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/events{/privacy}","received_events_url":"https://api.github.com/users/sonarcloud%5Bbot%5D/received_events","type":"Bot","site_admin":false},"body":"![Code Smell](https://sonarsource.github.io/sonar-github/code_smell.png 'Code Smell') Code Smell: Remove the literal \"true\" boolean value. ([php:S1125](https://sonarcloud.io/organizations/monicahq/rules#rule_key=php%3AS1125))\n\n[See it in SonarCloud](https://sonarcloud.io/project/issues?id=monica&pullRequest=2168&issues=AWfMwsvNP9uNp_grytgY&open=AWfMwsvNP9uNp_grytgY)\n\n[ISSUE_KEY]: AWfMwsvNP9uNp_grytgY","created_at":"2018-12-21T03:44:08Z","updated_at":"2018-12-21T03:44:09Z","html_url":"https://github.com/monicahq/monica/pull/2168#discussion_r243481933","pull_request_url":"https://api.github.com/repos/monicahq/monica/pulls/2168","author_association":"NONE","_links":{"self":{"href":"https://api.github.com/repos/monicahq/monica/pulls/comments/243481933"},"html":{"href":"https://github.com/monicahq/monica/pull/2168#discussion_r243481933"},"pull_request":{"href":"https://api.github.com/repos/monicahq/monica/pulls/2168"}}},"pull_request":{"url":"https://api.github.com/repos/monicahq/monica/pulls/2168","id":239552545,"node_id":"MDExOlB1bGxSZXF1ZXN0MjM5NTUyNTQ1","html_url":"https://github.com/monicahq/monica/pull/2168","diff_url":"https://github.com/monicahq/monica/pull/2168.diff","patch_url":"https://github.com/monicahq/monica/pull/2168.patch","issue_url":"https://api.github.com/repos/monicahq/monica/issues/2168","number":2168,"state":"open","locked":false,"title":"chore: refactor contact management with services","user":{"login":"djaiss","id":61099,"node_id":"MDQ6VXNlcjYxMDk5","avatar_url":"https://avatars3.githubusercontent.com/u/61099?v=4","gravatar_id":"","url":"https://api.github.com/users/djaiss","html_url":"https://github.com/djaiss","followers_url":"https://api.github.com/users/djaiss/followers","following_url":"https://api.github.com/users/djaiss/following{/other_user}","gists_url":"https://api.github.com/users/djaiss/gists{/gist_id}","starred_url":"https://api.github.com/users/djaiss/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/djaiss/subscriptions","organizations_url":"https://api.github.com/users/djaiss/orgs","repos_url":"https://api.github.com/users/djaiss/repos","events_url":"https://api.github.com/users/djaiss/events{/privacy}","received_events_url":"https://api.github.com/users/djaiss/received_events","type":"User","site_admin":false},"body":"This PR refactors how contacts are created/updated/deleted using services.\r\n\r\nTodo:\r\n- [x] Put back `new ResizeAvatars` to Create/Update service\r\n- [x] Delete avatars when deleting a contact\r\n- [x] Changelog","created_at":"2018-12-18T16:30:29Z","updated_at":"2018-12-21T03:44:08Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2987c224ce16a7aa5f47b72ccdffc7ce534de125","assignee":null,"assignees":[],"requested_reviewers":[],"requested_teams":[],"labels":[],"milestone":null,"commits_url":"https://api.github.com/repos/monicahq/monica/pulls/2168/commits","review_comments_url":"https://api.github.com/repos/monicahq/monica/pulls/2168/comments","review_comment_url":"https://api.github.com/repos/monicahq/monica/pulls/comments{/number}","comments_url":"https://api.github.com/repos/monicahq/monica/issues/2168/comments","statuses_url":"https://api.github.com/repos/monicahq/monica/statuses/90d05a0f27495a3bc19df588720f770f01df7b9c","head":{"label":"monicahq:2018-12-18-add-contact-services","ref":"2018-12-18-add-contact-services","sha":"90d05a0f27495a3bc19df588720f770f01df7b9c","user":{"login":"monicahq","id":25832602,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1ODMyNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/25832602?v=4","gravatar_id":"","url":"https://api.github.com/users/monicahq","html_url":"https://github.com/monicahq","followers_url":"https://api.github.com/users/monicahq/followers","following_url":"https://api.github.com/users/monicahq/following{/other_user}","gists_url":"https://api.github.com/users/monicahq/gists{/gist_id}","starred_url":"https://api.github.com/users/monicahq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicahq/subscriptions","organizations_url":"https://api.github.com/users/monicahq/orgs","repos_url":"https://api.github.com/users/monicahq/repos","events_url":"https://api.github.com/users/monicahq/events{/privacy}","received_events_url":"https://api.github.com/users/monicahq/received_events","type":"Organization","site_admin":false},"repo":{"id":82238168,"node_id":"MDEwOlJlcG9zaXRvcnk4MjIzODE2OA==","name":"monica","full_name":"monicahq/monica","private":false,"owner":{"login":"monicahq","id":25832602,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1ODMyNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/25832602?v=4","gravatar_id":"","url":"https://api.github.com/users/monicahq","html_url":"https://github.com/monicahq","followers_url":"https://api.github.com/users/monicahq/followers","following_url":"https://api.github.com/users/monicahq/following{/other_user}","gists_url":"https://api.github.com/users/monicahq/gists{/gist_id}","starred_url":"https://api.github.com/users/monicahq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicahq/subscriptions","organizations_url":"https://api.github.com/users/monicahq/orgs","repos_url":"https://api.github.com/users/monicahq/repos","events_url":"https://api.github.com/users/monicahq/events{/privacy}","received_events_url":"https://api.github.com/users/monicahq/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/monicahq/monica","description":"Personal CRM. Remember everything about your friends and family.","fork":false,"url":"https://api.github.com/repos/monicahq/monica","forks_url":"https://api.github.com/repos/monicahq/monica/forks","keys_url":"https://api.github.com/repos/monicahq/monica/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monicahq/monica/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monicahq/monica/teams","hooks_url":"https://api.github.com/repos/monicahq/monica/hooks","issue_events_url":"https://api.github.com/repos/monicahq/monica/issues/events{/number}","events_url":"https://api.github.com/repos/monicahq/monica/events","assignees_url":"https://api.github.com/repos/monicahq/monica/assignees{/user}","branches_url":"https://api.github.com/repos/monicahq/monica/branches{/branch}","tags_url":"https://api.github.com/repos/monicahq/monica/tags","blobs_url":"https://api.github.com/repos/monicahq/monica/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monicahq/monica/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monicahq/monica/git/refs{/sha}","trees_url":"https://api.github.com/repos/monicahq/monica/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monicahq/monica/statuses/{sha}","languages_url":"https://api.github.com/repos/monicahq/monica/languages","stargazers_url":"https://api.github.com/repos/monicahq/monica/stargazers","contributors_url":"https://api.github.com/repos/monicahq/monica/contributors","subscribers_url":"https://api.github.com/repos/monicahq/monica/subscribers","subscription_url":"https://api.github.com/repos/monicahq/monica/subscription","commits_url":"https://api.github.com/repos/monicahq/monica/commits{/sha}","git_commits_url":"https://api.github.com/repos/monicahq/monica/git/commits{/sha}","comments_url":"https://api.github.com/repos/monicahq/monica/comments{/number}","issue_comment_url":"https://api.github.com/repos/monicahq/monica/issues/comments{/number}","contents_url":"https://api.github.com/repos/monicahq/monica/contents/{+path}","compare_url":"https://api.github.com/repos/monicahq/monica/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monicahq/monica/merges","archive_url":"https://api.github.com/repos/monicahq/monica/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monicahq/monica/downloads","issues_url":"https://api.github.com/repos/monicahq/monica/issues{/number}","pulls_url":"https://api.github.com/repos/monicahq/monica/pulls{/number}","milestones_url":"https://api.github.com/repos/monicahq/monica/milestones{/number}","notifications_url":"https://api.github.com/repos/monicahq/monica/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monicahq/monica/labels{/name}","releases_url":"https://api.github.com/repos/monicahq/monica/releases{/id}","deployments_url":"https://api.github.com/repos/monicahq/monica/deployments","created_at":"2017-02-17T00:02:58Z","updated_at":"2018-12-21T03:23:25Z","pushed_at":"2018-12-21T03:41:01Z","git_url":"git://github.com/monicahq/monica.git","ssh_url":"git@github.com:monicahq/monica.git","clone_url":"https://github.com/monicahq/monica.git","svn_url":"https://github.com/monicahq/monica","homepage":"https://monicahq.com","size":62566,"stargazers_count":6280,"watchers_count":6280,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":708,"mirror_url":null,"archived":false,"open_issues_count":359,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":708,"open_issues":359,"watchers":6280,"default_branch":"master"}},"base":{"label":"monicahq:master","ref":"master","sha":"731a6f0643b614cb9c0832a4df28b6188d8917e2","user":{"login":"monicahq","id":25832602,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1ODMyNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/25832602?v=4","gravatar_id":"","url":"https://api.github.com/users/monicahq","html_url":"https://github.com/monicahq","followers_url":"https://api.github.com/users/monicahq/followers","following_url":"https://api.github.com/users/monicahq/following{/other_user}","gists_url":"https://api.github.com/users/monicahq/gists{/gist_id}","starred_url":"https://api.github.com/users/monicahq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicahq/subscriptions","organizations_url":"https://api.github.com/users/monicahq/orgs","repos_url":"https://api.github.com/users/monicahq/repos","events_url":"https://api.github.com/users/monicahq/events{/privacy}","received_events_url":"https://api.github.com/users/monicahq/received_events","type":"Organization","site_admin":false},"repo":{"id":82238168,"node_id":"MDEwOlJlcG9zaXRvcnk4MjIzODE2OA==","name":"monica","full_name":"monicahq/monica","private":false,"owner":{"login":"monicahq","id":25832602,"node_id":"MDEyOk9yZ2FuaXphdGlvbjI1ODMyNjAy","avatar_url":"https://avatars3.githubusercontent.com/u/25832602?v=4","gravatar_id":"","url":"https://api.github.com/users/monicahq","html_url":"https://github.com/monicahq","followers_url":"https://api.github.com/users/monicahq/followers","following_url":"https://api.github.com/users/monicahq/following{/other_user}","gists_url":"https://api.github.com/users/monicahq/gists{/gist_id}","starred_url":"https://api.github.com/users/monicahq/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/monicahq/subscriptions","organizations_url":"https://api.github.com/users/monicahq/orgs","repos_url":"https://api.github.com/users/monicahq/repos","events_url":"https://api.github.com/users/monicahq/events{/privacy}","received_events_url":"https://api.github.com/users/monicahq/received_events","type":"Organization","site_admin":false},"html_url":"https://github.com/monicahq/monica","description":"Personal CRM. Remember everything about your friends and family.","fork":false,"url":"https://api.github.com/repos/monicahq/monica","forks_url":"https://api.github.com/repos/monicahq/monica/forks","keys_url":"https://api.github.com/repos/monicahq/monica/keys{/key_id}","collaborators_url":"https://api.github.com/repos/monicahq/monica/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/monicahq/monica/teams","hooks_url":"https://api.github.com/repos/monicahq/monica/hooks","issue_events_url":"https://api.github.com/repos/monicahq/monica/issues/events{/number}","events_url":"https://api.github.com/repos/monicahq/monica/events","assignees_url":"https://api.github.com/repos/monicahq/monica/assignees{/user}","branches_url":"https://api.github.com/repos/monicahq/monica/branches{/branch}","tags_url":"https://api.github.com/repos/monicahq/monica/tags","blobs_url":"https://api.github.com/repos/monicahq/monica/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/monicahq/monica/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/monicahq/monica/git/refs{/sha}","trees_url":"https://api.github.com/repos/monicahq/monica/git/trees{/sha}","statuses_url":"https://api.github.com/repos/monicahq/monica/statuses/{sha}","languages_url":"https://api.github.com/repos/monicahq/monica/languages","stargazers_url":"https://api.github.com/repos/monicahq/monica/stargazers","contributors_url":"https://api.github.com/repos/monicahq/monica/contributors","subscribers_url":"https://api.github.com/repos/monicahq/monica/subscribers","subscription_url":"https://api.github.com/repos/monicahq/monica/subscription","commits_url":"https://api.github.com/repos/monicahq/monica/commits{/sha}","git_commits_url":"https://api.github.com/repos/monicahq/monica/git/commits{/sha}","comments_url":"https://api.github.com/repos/monicahq/monica/comments{/number}","issue_comment_url":"https://api.github.com/repos/monicahq/monica/issues/comments{/number}","contents_url":"https://api.github.com/repos/monicahq/monica/contents/{+path}","compare_url":"https://api.github.com/repos/monicahq/monica/compare/{base}...{head}","merges_url":"https://api.github.com/repos/monicahq/monica/merges","archive_url":"https://api.github.com/repos/monicahq/monica/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/monicahq/monica/downloads","issues_url":"https://api.github.com/repos/monicahq/monica/issues{/number}","pulls_url":"https://api.github.com/repos/monicahq/monica/pulls{/number}","milestones_url":"https://api.github.com/repos/monicahq/monica/milestones{/number}","notifications_url":"https://api.github.com/repos/monicahq/monica/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/monicahq/monica/labels{/name}","releases_url":"https://api.github.com/repos/monicahq/monica/releases{/id}","deployments_url":"https://api.github.com/repos/monicahq/monica/deployments","created_at":"2017-02-17T00:02:58Z","updated_at":"2018-12-21T03:23:25Z","pushed_at":"2018-12-21T03:41:01Z","git_url":"git://github.com/monicahq/monica.git","ssh_url":"git@github.com:monicahq/monica.git","clone_url":"https://github.com/monicahq/monica.git","svn_url":"https://github.com/monicahq/monica","homepage":"https://monicahq.com","size":62566,"stargazers_count":6280,"watchers_count":6280,"language":"PHP","has_issues":true,"has_projects":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":708,"mirror_url":null,"archived":false,"open_issues_count":359,"license":{"key":"agpl-3.0","name":"GNU Affero General Public License v3.0","spdx_id":"AGPL-3.0","url":"https://api.github.com/licenses/agpl-3.0","node_id":"MDc6TGljZW5zZTE="},"forks":708,"open_issues":359,"watchers":6280,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/monicahq/monica/pulls/2168"},"html":{"href":"https://github.com/monicahq/monica/pull/2168"},"issue":{"href":"https://api.github.com/repos/monicahq/monica/issues/2168"},"comments":{"href":"https://api.github.com/repos/monicahq/monica/issues/2168/comments"},"review_comments":{"href":"https://api.github.com/repos/monicahq/monica/pulls/2168/comments"},"review_comment":{"href":"https://api.github.com/repos/monicahq/monica/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/monicahq/monica/pulls/2168/commits"},"statuses":{"href":"https://api.github.com/repos/monicahq/monica/statuses/90d05a0f27495a3bc19df588720f770f01df7b9c"}},"author_association":"MEMBER"}}
{"actor":{"display_login":"sonarcloud"}}