send notify emails to community pages as well as people

This commit is contained in:
friendica 2012-02-10 00:08:23 -08:00
parent 2f2e331c33
commit b346f4464c

View file

@ -968,40 +968,42 @@ function tag_deliver($uid,$item_id) {
if(! $mention) if(! $mention)
return; return;
if(! $community_page) { // send a notification
require_once('include/enotify.php');
notification(array( require_once('include/enotify.php');
'type' => NOTIFY_TAGSELF, notification(array(
'notify_flags' => $u[0]['notify-flags'], 'type' => NOTIFY_TAGSELF,
'language' => $u[0]['language'], 'notify_flags' => $u[0]['notify-flags'],
'to_name' => $u[0]['username'], 'language' => $u[0]['language'],
'to_email' => $u[0]['email'], 'to_name' => $u[0]['username'],
'item' => $item, 'to_email' => $u[0]['email'],
'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'], 'item' => $item,
'source_name' => $item['author-name'], 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
'source_link' => $item['author-link'], 'source_name' => $item['author-name'],
'source_photo' => $item['author-avatar'], 'source_link' => $item['author-link'],
'verb' => ACTIVITY_TAG, 'source_photo' => $item['author-avatar'],
'otype' => 'item' 'verb' => ACTIVITY_TAG,
)); 'otype' => 'item'
));
if(! $community_page)
return; return;
}
else {
// prevent delivery looping - only proceed
// if the message originated elsewhere and is a top-level post
if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent'])) // tgroup delivery - setup a second delivery chain
return; // prevent delivery looping - only proceed
// if the message originated elsewhere and is a top-level post
// now change this copy of the post to a forum head message and deliver to all the tgroup members if(($item['wall']) || ($item['origin']) || ($item['id'] != $item['parent']))
return;
// now change this copy of the post to a forum head message and deliver to all the tgroup members
q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1", q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1",
intval($item_id) intval($item_id)
); );
proc_run('php','include/notifier.php','tgroup',$item_id);
proc_run('php','include/notifier.php','tgroup',$item_id);
}
} }
@ -1065,7 +1067,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
$final_dfrn_id = ''; $final_dfrn_id = '';
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) {
openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']); openssl_public_decrypt($sent_dfrn_id,$final_dfrn_id,$contact['pubkey']);
openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']); openssl_public_decrypt($challenge,$postvars['challenge'],$contact['pubkey']);
} }
@ -1108,7 +1110,7 @@ function dfrn_deliver($owner,$contact,$atom, $dissolve = false) {
if($dfrn_version >= 2.1) { if($dfrn_version >= 2.1) {
if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY)) { if(($contact['duplex'] && strlen($contact['pubkey'])) || ($owner['page-flags'] == PAGE_COMMUNITY && strlen($contact['pubkey']))) {
openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']); openssl_public_encrypt($key,$postvars['key'],$contact['pubkey']);
} }
else { else {