{"action":"opened","number":2049,"pull_request":{"url":"https://api.github.com/repos/elkarte/Elkarte/pulls/2049","id":34176600,"html_url":"https://github.com/elkarte/Elkarte/pull/2049","diff_url":"https://github.com/elkarte/Elkarte/pull/2049.diff","patch_url":"https://github.com/elkarte/Elkarte/pull/2049.patch","issue_url":"https://api.github.com/repos/elkarte/Elkarte/issues/2049","number":2049,"state":"open","locked":false,"title":"Notifications","user":{"login":"emanuele45","id":1095308,"avatar_url":"https://avatars.githubusercontent.com/u/1095308?v=3","gravatar_id":"","url":"https://api.github.com/users/emanuele45","html_url":"https://github.com/emanuele45","followers_url":"https://api.github.com/users/emanuele45/followers","following_url":"https://api.github.com/users/emanuele45/following{/other_user}","gists_url":"https://api.github.com/users/emanuele45/gists{/gist_id}","starred_url":"https://api.github.com/users/emanuele45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emanuele45/subscriptions","organizations_url":"https://api.github.com/users/emanuele45/orgs","repos_url":"https://api.github.com/users/emanuele45/repos","events_url":"https://api.github.com/users/emanuele45/events{/privacy}","received_events_url":"https://api.github.com/users/emanuele45/received_events","type":"User","site_admin":false},"body":"At that point I feel it's time to get some feedback.\r\nHere it is a slightly improved notification system.\r\nIt's still missing quite a lot of stuff, but it works (I hope :stuck_out_tongue: ).\r\n\r\n\r\nImportant bit:\r\nhttps://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/Notifications.class.php\r\nthe main Notifications class, the one that should coordinate the work.\r\n\r\nEntry point is the add method, that accepts as parameter a [Notifications_Task object](https://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/NotificationsTask.class.php), nothing more than a \"bag\" with some custom methods to retrieve some stuff we may need later.\r\n\r\nCentral point is the send method. Here each task (i.e. mention or new reply notification, etc.) is processed independently:\r\n* 1st the mentionType object (those in sources/subs/MentionType) is instantiated ([line 57](https://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/Notifications.class.php#L57))\r\n* 2nd the members to be notifies are determined (I'm a bit unsure yet how that happens, but it's a WIP, for the moment it's at [line 62](https://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/Notifications.class.php#L62))\r\n* 3rd it works out what kind of notification/s each member wants (none, simple notification (the mentions area), notification + email, etc., [line 63](https://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/Notifications.class.php#L63))\r\n* 4th for each frequency, it 1) gets the \"message\" (body and subject) from the mentionType object ([line 69](https://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/Notifications.class.php#L56)), 2) sends/inserts each of them ([line 77](https://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/Notifications.class.php#L56))\r\n\r\nTo have an idea of how MentionType classes look like, I think that the buddies one is the best:\r\nhttps://github.com/elkarte/Elkarte/blob/b3422b62723d064bc4d4662e53dc516ee7db68f9/sources/subs/MentionType/BuddyMention.php\r\njust because it's the easiest, all the others had to hook into some action to do their work mixing the actual notification part with some other work.\r\n\r\nSpecial mention is for the [Mentioning](https://github.com/elkarte/Elkarte/blob/0f4d2a1a59b18d981dca5483b36306bab958e1ea/sources/subs/Mentioning.php) class (and the name of the file is wrong...) that takes care of doing some validation and actions on the mentions themselves (i.e. log_mentions that means the mentions are in the menu).\r\n\r\nIt's not yet ready, it still misses all the user interface to configure the settings, but at least it \"works\" (mostly I guess LOL).","created_at":"2015-04-27T14:54:37Z","updated_at":"2015-04-27T14:54:37Z","closed_at":null,"merged_at":null,"merge_commit_sha":null,"assignee":null,"milestone":{"url":"https://api.github.com/repos/elkarte/Elkarte/milestones/4","html_url":"https://github.com/elkarte/Elkarte/milestones/1.1%20Beta","labels_url":"https://api.github.com/repos/elkarte/Elkarte/milestones/4/labels","id":447100,"number":4,"title":"1.1 Beta","description":"","creator":{"login":"eurich","id":1027992,"avatar_url":"https://avatars.githubusercontent.com/u/1027992?v=3","gravatar_id":"","url":"https://api.github.com/users/eurich","html_url":"https://github.com/eurich","followers_url":"https://api.github.com/users/eurich/followers","following_url":"https://api.github.com/users/eurich/following{/other_user}","gists_url":"https://api.github.com/users/eurich/gists{/gist_id}","starred_url":"https://api.github.com/users/eurich/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eurich/subscriptions","organizations_url":"https://api.github.com/users/eurich/orgs","repos_url":"https://api.github.com/users/eurich/repos","events_url":"https://api.github.com/users/eurich/events{/privacy}","received_events_url":"https://api.github.com/users/eurich/received_events","type":"User","site_admin":false},"open_issues":170,"closed_issues":63,"state":"open","created_at":"2013-10-07T08:37:11Z","updated_at":"2015-04-27T14:54:37Z","due_on":"2015-09-06T22:00:00Z","closed_at":null},"commits_url":"https://api.github.com/repos/elkarte/Elkarte/pulls/2049/commits","review_comments_url":"https://api.github.com/repos/elkarte/Elkarte/pulls/2049/comments","review_comment_url":"https://api.github.com/repos/elkarte/Elkarte/pulls/comments{/number}","comments_url":"https://api.github.com/repos/elkarte/Elkarte/issues/2049/comments","statuses_url":"https://api.github.com/repos/elkarte/Elkarte/statuses/0f4d2a1a59b18d981dca5483b36306bab958e1ea","head":{"label":"emanuele45:notifications","ref":"notifications","sha":"0f4d2a1a59b18d981dca5483b36306bab958e1ea","user":{"login":"emanuele45","id":1095308,"avatar_url":"https://avatars.githubusercontent.com/u/1095308?v=3","gravatar_id":"","url":"https://api.github.com/users/emanuele45","html_url":"https://github.com/emanuele45","followers_url":"https://api.github.com/users/emanuele45/followers","following_url":"https://api.github.com/users/emanuele45/following{/other_user}","gists_url":"https://api.github.com/users/emanuele45/gists{/gist_id}","starred_url":"https://api.github.com/users/emanuele45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emanuele45/subscriptions","organizations_url":"https://api.github.com/users/emanuele45/orgs","repos_url":"https://api.github.com/users/emanuele45/repos","events_url":"https://api.github.com/users/emanuele45/events{/privacy}","received_events_url":"https://api.github.com/users/emanuele45/received_events","type":"User","site_admin":false},"repo":{"id":6832792,"name":"Dialogo","full_name":"emanuele45/Dialogo","owner":{"login":"emanuele45","id":1095308,"avatar_url":"https://avatars.githubusercontent.com/u/1095308?v=3","gravatar_id":"","url":"https://api.github.com/users/emanuele45","html_url":"https://github.com/emanuele45","followers_url":"https://api.github.com/users/emanuele45/followers","following_url":"https://api.github.com/users/emanuele45/following{/other_user}","gists_url":"https://api.github.com/users/emanuele45/gists{/gist_id}","starred_url":"https://api.github.com/users/emanuele45/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emanuele45/subscriptions","organizations_url":"https://api.github.com/users/emanuele45/orgs","repos_url":"https://api.github.com/users/emanuele45/repos","events_url":"https://api.github.com/users/emanuele45/events{/privacy}","received_events_url":"https://api.github.com/users/emanuele45/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/emanuele45/Dialogo","description":"This iz ElkArte! (But I don't like to change repo names)","fork":true,"url":"https://api.github.com/repos/emanuele45/Dialogo","forks_url":"https://api.github.com/repos/emanuele45/Dialogo/forks","keys_url":"https://api.github.com/repos/emanuele45/Dialogo/keys{/key_id}","collaborators_url":"https://api.github.com/repos/emanuele45/Dialogo/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/emanuele45/Dialogo/teams","hooks_url":"https://api.github.com/repos/emanuele45/Dialogo/hooks","issue_events_url":"https://api.github.com/repos/emanuele45/Dialogo/issues/events{/number}","events_url":"https://api.github.com/repos/emanuele45/Dialogo/events","assignees_url":"https://api.github.com/repos/emanuele45/Dialogo/assignees{/user}","branches_url":"https://api.github.com/repos/emanuele45/Dialogo/branches{/branch}","tags_url":"https://api.github.com/repos/emanuele45/Dialogo/tags","blobs_url":"https://api.github.com/repos/emanuele45/Dialogo/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/emanuele45/Dialogo/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/emanuele45/Dialogo/git/refs{/sha}","trees_url":"https://api.github.com/repos/emanuele45/Dialogo/git/trees{/sha}","statuses_url":"https://api.github.com/repos/emanuele45/Dialogo/statuses/{sha}","languages_url":"https://api.github.com/repos/emanuele45/Dialogo/languages","stargazers_url":"https://api.github.com/repos/emanuele45/Dialogo/stargazers","contributors_url":"https://api.github.com/repos/emanuele45/Dialogo/contributors","subscribers_url":"https://api.github.com/repos/emanuele45/Dialogo/subscribers","subscription_url":"https://api.github.com/repos/emanuele45/Dialogo/subscription","commits_url":"https://api.github.com/repos/emanuele45/Dialogo/commits{/sha}","git_commits_url":"https://api.github.com/repos/emanuele45/Dialogo/git/commits{/sha}","comments_url":"https://api.github.com/repos/emanuele45/Dialogo/comments{/number}","issue_comment_url":"https://api.github.com/repos/emanuele45/Dialogo/issues/comments{/number}","contents_url":"https://api.github.com/repos/emanuele45/Dialogo/contents/{+path}","compare_url":"https://api.github.com/repos/emanuele45/Dialogo/compare/{base}...{head}","merges_url":"https://api.github.com/repos/emanuele45/Dialogo/merges","archive_url":"https://api.github.com/repos/emanuele45/Dialogo/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/emanuele45/Dialogo/downloads","issues_url":"https://api.github.com/repos/emanuele45/Dialogo/issues{/number}","pulls_url":"https://api.github.com/repos/emanuele45/Dialogo/pulls{/number}","milestones_url":"https://api.github.com/repos/emanuele45/Dialogo/milestones{/number}","notifications_url":"https://api.github.com/repos/emanuele45/Dialogo/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/emanuele45/Dialogo/labels{/name}","releases_url":"https://api.github.com/repos/emanuele45/Dialogo/releases{/id}","created_at":"2012-11-23T20:31:30Z","updated_at":"2015-03-04T21:57:19Z","pushed_at":"2015-04-27T14:50:06Z","git_url":"git://github.com/emanuele45/Dialogo.git","ssh_url":"git@github.com:emanuele45/Dialogo.git","clone_url":"https://github.com/emanuele45/Dialogo.git","svn_url":"https://github.com/emanuele45/Dialogo","homepage":"http://www.elkarte.net/","size":57243,"stargazers_count":2,"watchers_count":2,"language":"PHP","has_issues":false,"has_downloads":true,"has_wiki":false,"has_pages":false,"forks_count":1,"mirror_url":null,"open_issues_count":0,"forks":1,"open_issues":0,"watchers":2,"default_branch":"development"}},"base":{"label":"elkarte:development","ref":"development","sha":"fdb67ed991d97907fc6634c438b4f7bd4bc44564","user":{"login":"elkarte","id":3117105,"avatar_url":"https://avatars.githubusercontent.com/u/3117105?v=3","gravatar_id":"","url":"https://api.github.com/users/elkarte","html_url":"https://github.com/elkarte","followers_url":"https://api.github.com/users/elkarte/followers","following_url":"https://api.github.com/users/elkarte/following{/other_user}","gists_url":"https://api.github.com/users/elkarte/gists{/gist_id}","starred_url":"https://api.github.com/users/elkarte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elkarte/subscriptions","organizations_url":"https://api.github.com/users/elkarte/orgs","repos_url":"https://api.github.com/users/elkarte/repos","events_url":"https://api.github.com/users/elkarte/events{/privacy}","received_events_url":"https://api.github.com/users/elkarte/received_events","type":"Organization","site_admin":false},"repo":{"id":6815666,"name":"Elkarte","full_name":"elkarte/Elkarte","owner":{"login":"elkarte","id":3117105,"avatar_url":"https://avatars.githubusercontent.com/u/3117105?v=3","gravatar_id":"","url":"https://api.github.com/users/elkarte","html_url":"https://github.com/elkarte","followers_url":"https://api.github.com/users/elkarte/followers","following_url":"https://api.github.com/users/elkarte/following{/other_user}","gists_url":"https://api.github.com/users/elkarte/gists{/gist_id}","starred_url":"https://api.github.com/users/elkarte/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/elkarte/subscriptions","organizations_url":"https://api.github.com/users/elkarte/orgs","repos_url":"https://api.github.com/users/elkarte/repos","events_url":"https://api.github.com/users/elkarte/events{/privacy}","received_events_url":"https://api.github.com/users/elkarte/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/elkarte/Elkarte","description":"ElkArte Forum.  A free, open source, PHP-based discussion forum.","fork":false,"url":"https://api.github.com/repos/elkarte/Elkarte","forks_url":"https://api.github.com/repos/elkarte/Elkarte/forks","keys_url":"https://api.github.com/repos/elkarte/Elkarte/keys{/key_id}","collaborators_url":"https://api.github.com/repos/elkarte/Elkarte/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/elkarte/Elkarte/teams","hooks_url":"https://api.github.com/repos/elkarte/Elkarte/hooks","issue_events_url":"https://api.github.com/repos/elkarte/Elkarte/issues/events{/number}","events_url":"https://api.github.com/repos/elkarte/Elkarte/events","assignees_url":"https://api.github.com/repos/elkarte/Elkarte/assignees{/user}","branches_url":"https://api.github.com/repos/elkarte/Elkarte/branches{/branch}","tags_url":"https://api.github.com/repos/elkarte/Elkarte/tags","blobs_url":"https://api.github.com/repos/elkarte/Elkarte/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/elkarte/Elkarte/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/elkarte/Elkarte/git/refs{/sha}","trees_url":"https://api.github.com/repos/elkarte/Elkarte/git/trees{/sha}","statuses_url":"https://api.github.com/repos/elkarte/Elkarte/statuses/{sha}","languages_url":"https://api.github.com/repos/elkarte/Elkarte/languages","stargazers_url":"https://api.github.com/repos/elkarte/Elkarte/stargazers","contributors_url":"https://api.github.com/repos/elkarte/Elkarte/contributors","subscribers_url":"https://api.github.com/repos/elkarte/Elkarte/subscribers","subscription_url":"https://api.github.com/repos/elkarte/Elkarte/subscription","commits_url":"https://api.github.com/repos/elkarte/Elkarte/commits{/sha}","git_commits_url":"https://api.github.com/repos/elkarte/Elkarte/git/commits{/sha}","comments_url":"https://api.github.com/repos/elkarte/Elkarte/comments{/number}","issue_comment_url":"https://api.github.com/repos/elkarte/Elkarte/issues/comments{/number}","contents_url":"https://api.github.com/repos/elkarte/Elkarte/contents/{+path}","compare_url":"https://api.github.com/repos/elkarte/Elkarte/compare/{base}...{head}","merges_url":"https://api.github.com/repos/elkarte/Elkarte/merges","archive_url":"https://api.github.com/repos/elkarte/Elkarte/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/elkarte/Elkarte/downloads","issues_url":"https://api.github.com/repos/elkarte/Elkarte/issues{/number}","pulls_url":"https://api.github.com/repos/elkarte/Elkarte/pulls{/number}","milestones_url":"https://api.github.com/repos/elkarte/Elkarte/milestones{/number}","notifications_url":"https://api.github.com/repos/elkarte/Elkarte/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/elkarte/Elkarte/labels{/name}","releases_url":"https://api.github.com/repos/elkarte/Elkarte/releases{/id}","created_at":"2012-11-22T16:04:26Z","updated_at":"2015-04-25T14:30:16Z","pushed_at":"2015-04-27T13:33:26Z","git_url":"git://github.com/elkarte/Elkarte.git","ssh_url":"git@github.com:elkarte/Elkarte.git","clone_url":"https://github.com/elkarte/Elkarte.git","svn_url":"https://github.com/elkarte/Elkarte","homepage":"http://www.elkarte.net","size":64145,"stargazers_count":42,"watchers_count":42,"language":"PHP","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":32,"mirror_url":null,"open_issues_count":196,"forks":32,"open_issues":196,"watchers":42,"default_branch":"development"}},"_links":{"self":{"href":"https://api.github.com/repos/elkarte/Elkarte/pulls/2049"},"html":{"href":"https://github.com/elkarte/Elkarte/pull/2049"},"issue":{"href":"https://api.github.com/repos/elkarte/Elkarte/issues/2049"},"comments":{"href":"https://api.github.com/repos/elkarte/Elkarte/issues/2049/comments"},"review_comments":{"href":"https://api.github.com/repos/elkarte/Elkarte/pulls/2049/comments"},"review_comment":{"href":"https://api.github.com/repos/elkarte/Elkarte/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/elkarte/Elkarte/pulls/2049/commits"},"statuses":{"href":"https://api.github.com/repos/elkarte/Elkarte/statuses/0f4d2a1a59b18d981dca5483b36306bab958e1ea"}},"merged":false,"mergeable":null,"mergeable_state":"unknown","merged_by":null,"comments":0,"review_comments":0,"commits":18,"additions":1569,"deletions":100,"changed_files":36}}