diff options
-rwxr-xr-x | include/text.php | 2 | ||||
-rw-r--r-- | include/zot.php | 66 | ||||
-rw-r--r-- | js/main.js | 16 | ||||
-rw-r--r-- | version.inc | 2 |
4 files changed, 83 insertions, 3 deletions
diff --git a/include/text.php b/include/text.php index 6ab1d3c8b..db29697f9 100755 --- a/include/text.php +++ b/include/text.php @@ -850,7 +850,6 @@ function smilies($s, $sample = false) { ':like', ':dislike', 'red#', - '~friendika', '~friendica' ); @@ -889,7 +888,6 @@ function smilies($s, $sample = false) { '<img class="smiley" src="' . $a->get_baseurl() . '/images/like.gif" alt=":like" />', '<img class="smiley" src="' . $a->get_baseurl() . '/images/dislike.gif" alt=":dislike" />', '<img class="smiley" src="' . $a->get_baseurl() . '/images/rhash-16.png" alt="red#" /></a>', - '<a href="http://project.friendika.com">~friendika <img class="smiley" src="' . $a->get_baseurl() . '/images/friendika-16.png" alt="~friendika" /></a>', '<a href="http://friendica.com">~friendica <img class="smiley" src="' . $a->get_baseurl() . '/images/friendica-16.png" alt="~friendica" /></a>' ); diff --git a/include/zot.php b/include/zot.php index be0760a05..f10a02d47 100644 --- a/include/zot.php +++ b/include/zot.php @@ -1036,6 +1036,10 @@ function process_delivery($sender,$arr,$deliveries,$relay) { } if($arr['item_restrict'] & ITEM_DELETED) { + + // remove_community_tag is a no-op if this isn't a community tag activity + remove_community_tag($sender,$arr,$channel['channel_id']); + $item_id = delete_imported_item($sender,$arr,$channel['channel_id']); $result[] = array($d['hash'],'deleted'); @@ -1116,6 +1120,68 @@ function process_delivery($sender,$arr,$deliveries,$relay) { } +function remove_community_tag($sender,$arr,$uid) { + + if(! (activity_match($arr['verb'],ACTIVITY_TAG) && ($arr['obj_type'] == ACTIVITY_OBJ_TAGTERM))) + return; + + logger('remove_community_tag: invoked'); + + + if(! get_pconfig($uid,'system','blocktags')) { + logger('remove_community tag: permission denied.'); + return; + } + + $r = q("select * from item where mid = '%s' and uid = %d limit 1", + dbesc($arr['mid']), + intval($uid) + ); + if(! $r) { + logger('remove_community_tag: no item'); + return; + } + + if(($sender['hash'] != $r[0]['owner_xchan']) && ($sender['hash'] != $r[0]['author_xchan'])) { + logger('remove_community_tag: sender not authorised.'); + return; + } + + $i = $r[0]; + + if($i['target']) + $i['target'] = json_decode($i['target'],true); + if($i['object']) + $i['object'] = json_decode($i['object'],true); + + if(! ($i['target'] && $i['object'])) { + logger('remove_community_tag: no target/object'); + return; + } + + $message_id = $i['target']['id']; + + $r = q("select id from item where mid = '%s' and uid = %d limit 1", + dbesc($message_id), + intval($uid) + ); + if(! $r) { + logger('remove_community_tag: no parent message'); + return; + } + + $x = q("delete from term where uid = %d and oid = %d and otype = %d and type = %d and term = '%s' and url = '%s' limit 1", + intval($uid), + intval($r[0]['id']), + intval(TERM_OBJ_POST), + intval(TERM_HASHTAG), + dbesc($i['object']['title']), + dbesc(get_rel_link($i['object']['link'],'alternate')) + ); + + return; +} + function update_imported_item($sender,$item,$uid) { item_store_update($item); diff --git a/js/main.js b/js/main.js index f1a50e28a..8b1114d19 100644 --- a/js/main.js +++ b/js/main.js @@ -343,6 +343,8 @@ function updateConvItems(mode,data) { + var expanded_comments = false; + if(mode === 'update') { prev = 'threads-begin'; @@ -353,7 +355,14 @@ function updateConvItems(mode,data) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); +// expanded_comments = false; +// $('.collapsed-comments',this).each(function() { +// if($(this).is(':visible')) +// expanded_comments = this; +// }); $('#' + prev).after($(this)); +// if(expanded_comments) +// $(expanded_comments).show(); $(".autotime").timeago(); // divgrow doesn't prevent itself from attaching a second (or 500th) // "show more" div to a content region - it also has a few other @@ -365,7 +374,14 @@ function updateConvItems(mode,data) { $('img',this).each(function() { $(this).attr('src',$(this).attr('dst')); }); +// expanded_comments = false; +// $('.collapsed-comments',this).each(function() { +// if($(this).is(':visible')) +// expanded_comments = this; +// }); $('#' + ident).replaceWith($(this)); +// if(expanded_comments) +// $(expanded_comments).show(); $(".autotime").timeago(); // $("div.wall-item-body").divgrow({ initialHeight: 400 }); diff --git a/version.inc b/version.inc index a91ac0c4c..ab6fd81ae 100644 --- a/version.inc +++ b/version.inc @@ -1 +1 @@ -2013-06-30.360 +2013-07-01.361 |