implement unfollow thread
This commit is contained in:
@@ -917,6 +917,9 @@ function item_photo_menu($item){
|
||||
if($item['parent'] == $item['id'] && $channel && ($channel_hash != $item['author_xchan'])) {
|
||||
$sub_link = 'javascript:dosubthread(' . $item['id'] . '); return false;';
|
||||
}
|
||||
if($channel) {
|
||||
$unsub_link = 'javascript:dounsubthread(' . $item['id'] . '); return false;';
|
||||
}
|
||||
}
|
||||
|
||||
$profile_link = chanlink_hash($item['author_xchan']);
|
||||
@@ -941,6 +944,7 @@ function item_photo_menu($item){
|
||||
$menu = Array(
|
||||
t("View Source") => $vsrc_link,
|
||||
t("Follow Thread") => $sub_link,
|
||||
t("Stop Following") => $unsub_link,
|
||||
t("View Status") => $status_link,
|
||||
t("View Profile") => $profile_link,
|
||||
t("View Photos") => $photos_link,
|
||||
|
||||
@@ -2837,6 +2837,8 @@ function store_diaspora_comment_sig($datarray, $channel, $parent_item, $post_id,
|
||||
function send_status_notifications($post_id,$item) {
|
||||
|
||||
$notify = false;
|
||||
$unfollowed = false;
|
||||
|
||||
$parent = 0;
|
||||
|
||||
$r = q("select channel_hash from channel where channel_id = %d limit 1",
|
||||
@@ -2864,6 +2866,14 @@ function send_status_notifications($post_id,$item) {
|
||||
foreach($x as $xx) {
|
||||
if($xx['author_xchan'] === $r[0]['channel_hash']) {
|
||||
$notify = true;
|
||||
|
||||
// check for an unfollow thread activity - we should probably decode the obj and check the id
|
||||
// but it will be extremely rare for this to be wrong.
|
||||
|
||||
if(($xx['verb'] === ACTIVITY_UNFOLLOW)
|
||||
&& ($xx['obj_type'] === ACTIVITY_OBJ_NOTE || $xx['obj_type'] === ACTIVITY_OBJ_PHOTO)
|
||||
&& ($xx['parent'] != $xx['id']))
|
||||
$unfollowed = true;
|
||||
}
|
||||
if($xx['id'] == $xx['parent']) {
|
||||
$parent = $xx['parent'];
|
||||
@@ -2871,6 +2881,9 @@ function send_status_notifications($post_id,$item) {
|
||||
}
|
||||
}
|
||||
|
||||
if($unfollowed)
|
||||
return;
|
||||
|
||||
$link = get_app()->get_baseurl() . '/display/' . $item['mid'];
|
||||
|
||||
$y = q("select id from notify where link = '%s' and uid = %d limit 1",
|
||||
|
||||
Reference in New Issue
Block a user