aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-02-09 21:18:50 -0800
committerfriendica <info@friendica.com>2012-02-09 21:18:50 -0800
commitffe7d8b1e9964e28b50ccce49d74836067c099c1 (patch)
treeb058bb33227f18e6dc54a07f2a15a7c55a7c3e53
parent5859f9dcf68c2ca6ad355c16e7fbf5080eea9e75 (diff)
downloadvolse-hubzilla-ffe7d8b1e9964e28b50ccce49d74836067c099c1.tar.gz
volse-hubzilla-ffe7d8b1e9964e28b50ccce49d74836067c099c1.tar.bz2
volse-hubzilla-ffe7d8b1e9964e28b50ccce49d74836067c099c1.zip
item tag notifications
-rwxr-xr-xinclude/items.php64
-rwxr-xr-xmod/settings.php1
-rwxr-xr-xview/settings.tpl1
3 files changed, 43 insertions, 23 deletions
diff --git a/include/items.php b/include/items.php
index 9f2cc491b..fd90494b1 100755
--- a/include/items.php
+++ b/include/items.php
@@ -905,7 +905,7 @@ function item_store($arr,$force_parent = false) {
);
}
- tgroup_deliver($arr['uid'],$current_post);
+ tag_deliver($arr['uid'],$current_post);
return $current_post;
}
@@ -923,22 +923,22 @@ function get_item_contact($item,$contacts) {
}
-function tgroup_deliver($uid,$item_id) {
+function tag_deliver($uid,$item_id) {
-
- // setup a second delivery chain for forum/community posts if appropriate
+ // look for mention tags and setup a second delivery chain for forum/community posts if appropriate
$a = get_app();
- $deliver_to_tgroup = false;
+ $mention = false;
- $u = q("select * from user where uid = %d and `page-flags` = %d limit 1",
- intval($uid),
- intval(PAGE_COMMUNITY)
+ $u = q("select uid, nickname, language, username, email, `page-flags`, `notify-flags` from user where uid = %d limit 1",
+ intval($uid)
);
if(! count($u))
return;
+ $community_page = (($u[0]['page-flags'] == PAGE_COMMUNITY) ? true : false);
+
$i = q("select * from item where id = %d and uid = %d limit 1",
intval($item_id),
intval($uid)
@@ -948,13 +948,6 @@ function tgroup_deliver($uid,$item_id) {
$item = $i[0];
- // 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']))
- return;
-
-
$link = normalise_link($a->get_baseurl() . '/profile/' . $u[0]['nickname']);
// Diaspora uses their own hardwired link URL in @-tags
@@ -966,24 +959,49 @@ function tgroup_deliver($uid,$item_id) {
if($cnt) {
foreach($matches as $mtch) {
if(link_compare($link,$mtch[1]) || link_compare($dlink,$mtch[1])) {
- $deliver_to_tgroup = true;
- logger('tgroup_deliver: local group mention found: ' . $mtch[2]);
+ $mention = true;
+ logger('tag_deliver: mention found: ' . $mtch[2]);
}
}
}
- if(! $deliver_to_tgroup)
+ if(! $mention)
+ return;
+
+ if(! $community_page) {
+ require_once('include/enotify.php');
+ notification(array(
+ 'type' => NOTIFY_TAGSELF,
+ 'notify_flags' => $u[0]['notify-flags'],
+ 'language' => $u[0]['language'],
+ 'to_name' => $u[0]['username'],
+ 'to_email' => $u[0]['email'],
+ 'item' => $item,
+ 'link' => $a->get_baseurl() . '/display/' . $u[0]['nickname'] . '/' . $item['id'],
+ 'source_name' => $item['author-name'],
+ 'source_link' => $item['author-link'],
+ 'source_photo' => $item['author-avatar'],
+ 'verb' => ACTIVITY_TAG,
+ 'otype' => 'item'
+ ));
return;
+ }
+ else {
+ // 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",
- intval($item_id)
- );
- proc_run('php','include/notifier.php','tgroup',$item_id);
+ q("update item set wall = 1, origin = 1, forum_mode = 1 where id = %d limit 1",
+ intval($item_id)
+ );
+ proc_run('php','include/notifier.php','tgroup',$item_id);
+ }
}
diff --git a/mod/settings.php b/mod/settings.php
index e75272539..b4cd2e608 100755
--- a/mod/settings.php
+++ b/mod/settings.php
@@ -818,6 +818,7 @@ function settings_content(&$a) {
'$notify4' => array('notify4', t('Someone writes a followup comment'), ($notify & NOTIFY_COMMENT), NOTIFY_COMMENT, ''),
'$notify5' => array('notify5', t('You receive a private message'), ($notify & NOTIFY_MAIL), NOTIFY_MAIL, ''),
'$notify6' => array('notify6', t('You receive a friend suggestion'), ($notify & NOTIFY_SUGGEST), NOTIFY_SUGGEST, ''),
+ '$notify7' => array('notify7', t('You are tagged in a post'), ($notify & NOTIFY_TAGSELF), NOTIFY_TAGSELF, ''),
'$h_advn' => t('Advanced Page Settings'),
diff --git a/view/settings.tpl b/view/settings.tpl
index 6310ff47e..1172df8b9 100755
--- a/view/settings.tpl
+++ b/view/settings.tpl
@@ -108,6 +108,7 @@ $suggestme
{{inc field_intcheckbox.tpl with $field=$notify4 }}{{endinc}}
{{inc field_intcheckbox.tpl with $field=$notify5 }}{{endinc}}
{{inc field_intcheckbox.tpl with $field=$notify6 }}{{endinc}}
+{{inc field_intcheckbox.tpl with $field=$notify7 }}{{endinc}}
</div>