diff options
-rw-r--r-- | Zotlabs/Lib/Activity.php | 13 | ||||
-rw-r--r-- | Zotlabs/Module/Acl.php | 12 | ||||
-rw-r--r-- | Zotlabs/Module/Item.php | 1 | ||||
-rw-r--r-- | include/items.php | 13 | ||||
-rw-r--r-- | include/text.php | 21 | ||||
-rw-r--r-- | view/js/autocomplete.js | 25 |
6 files changed, 27 insertions, 58 deletions
diff --git a/Zotlabs/Lib/Activity.php b/Zotlabs/Lib/Activity.php index 60284c56d..dc868c93e 100644 --- a/Zotlabs/Lib/Activity.php +++ b/Zotlabs/Lib/Activity.php @@ -570,12 +570,7 @@ class Activity { break; case 'Mention': - $mention_type = substr($t['name'], 0, 1); - if ($mention_type === '!') { - $ret[] = ['ttype' => TERM_FORUM, 'url' => $t['href'], 'term' => escape_tags(substr($t['name'], 1))]; - } else { - $ret[] = ['ttype' => TERM_MENTION, 'url' => $t['href'], 'term' => escape_tags((substr($t['name'], 0, 1) === '@') ? substr($t['name'], 1) : $t['name'])]; - } + $ret[] = ['ttype' => TERM_MENTION, 'url' => $t['href'], 'term' => escape_tags((substr($t['name'], 0, 1) === '@') ? substr($t['name'], 1) : $t['name'])]; break; case 'Bookmark': @@ -610,10 +605,6 @@ class Activity { $ret[] = ['type' => 'Mention', 'href' => $t['url'], 'name' => '@' . $t['term']]; break; - case TERM_FORUM: - $ret[] = ['type' => 'Mention', 'href' => $t['url'], 'name' => '!' . $t['term']]; - break; - case TERM_BOOKMARK: $ret[] = ['type' => 'Bookmark', 'href' => $t['url'], 'name' => $t['term']]; break; @@ -945,7 +936,7 @@ class Activity { if (!$t['url']) { continue; } - if (in_array($t['ttype'], [TERM_MENTION, TERM_FORUM])) { + if ($t['ttype'] == TERM_MENTION) { $url = self::lookup_term_url($t['url']); $list[] = (($url) ? $url : $t['url']); } diff --git a/Zotlabs/Module/Acl.php b/Zotlabs/Module/Acl.php index e7a1e6706..b98f5621e 100644 --- a/Zotlabs/Module/Acl.php +++ b/Zotlabs/Module/Acl.php @@ -69,7 +69,6 @@ class Acl extends \Zotlabs\Web\Controller { $sql_extra = ''; $sql_extra2 = ''; $sql_extra3 = ''; - $sql_extra4 = (($type === 'f') ? ' AND xchan_pubforum = 1 ' : ''); $sql_extra2_xchan = ''; $order_extra2 = ''; @@ -220,7 +219,7 @@ class Acl extends \Zotlabs\Web\Controller { $r = q("SELECT abook_id as id, xchan_hash as hash, xchan_name as name, xchan_network as net, xchan_photo_s as micro, xchan_url as url, xchan_addr as nick, abook_their_perms, xchan_pubforum, abook_flags, abook_self FROM abook left join xchan on abook_xchan = xchan_hash - WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra2 $sql_extra4 order by $order_extra2 xchan_name asc" , + WHERE (abook_channel = %d $extra_channels_sql) AND abook_blocked = 0 and abook_pending = 0 and xchan_deleted = 0 $sql_extra2 order by $order_extra2 xchan_name asc" , intval(local_channel()) ); @@ -338,7 +337,6 @@ class Acl extends \Zotlabs\Web\Controller { else $r = array(); - if($r) { $i = count($contacts); $x = []; @@ -369,12 +367,10 @@ class Acl extends \Zotlabs\Web\Controller { "nick" => substr($g['nick'],0,strpos($g['nick'],'@')), "self" => (intval($g['abook_self']) ? 'abook-self' : ''), "taggable" => 'taggable', - "label" => t('network'), - "net" => $g['net'] ?? '' - + "label" => t('network') ); } - //if($type !== 'f') { + if($type !== 'f') { if (! array_key_exists($x[$lkey], $contacts) || ($contacts[$x[$lkey]]['net'] !== 'zot6' && $g['net'] == 'zot6')) { $contacts[$x[$lkey]] = array( "type" => "c", @@ -391,7 +387,7 @@ class Acl extends \Zotlabs\Web\Controller { "net" => $g['net'] ?? '' ); } - //} + } $i++; } } diff --git a/Zotlabs/Module/Item.php b/Zotlabs/Module/Item.php index 0643cc447..27fc62ee6 100644 --- a/Zotlabs/Module/Item.php +++ b/Zotlabs/Module/Item.php @@ -840,6 +840,7 @@ class Item extends Controller { // Look for tags and linkify them $results = linkify_tags($body, ($uid) ? $uid : $profile_uid); + if ($results) { // Set permissions based on tag replacements diff --git a/include/items.php b/include/items.php index d8f817fc2..b795df90d 100644 --- a/include/items.php +++ b/include/items.php @@ -2686,7 +2686,12 @@ function tag_deliver($uid, $item_id) { * Now we've got those out of the way. Let's see if this is a post that's tagged for re-delivery */ - $terms = isset($item['term']) ? get_terms_oftype($item['term'], [TERM_MENTION, TERM_FORUM]) : []; + $terms = []; + if (array_key_exists('term', $item)) { + $terms = array_merge(get_terms_oftype($item['term'],TERM_MENTION),get_terms_oftype($item['term'],TERM_FORUM)); + logger('Post mentions: ' . print_r($terms,true), LOGGER_DATA); + } + $max_forums = get_config('system','max_tagged_forums',2); $matched_forums = 0; @@ -2727,7 +2732,7 @@ function tag_deliver($uid, $item_id) { // standard forum tagging sequence !forumname - +/* $forumpattern = '/\!\!?\[[uz]rl\=([^\]]*?)\]((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/'; $forumpattern2 = '/\[[uz]rl\=([^\]]*?)\]\!((?:.(?!\[[uz]rl\=))*?)\[\/[uz]rl\]/'; @@ -2761,6 +2766,8 @@ function tag_deliver($uid, $item_id) { } } +*/ + if(! ($tagged || $plustagged)) { logger('Mention was in a reshare or exceeded max_tagged_forums - ignoring'); continue; @@ -2986,6 +2993,7 @@ function tgroup_check($uid, $item) { $body = preg_replace('/\[share(.*?)\[\/share\]/','',$item['body']); +/* $forumpattern = '/\!\!?\[zrl\=([^\]]*?)\]((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; $forumpattern2 = '/\[zrl\=([^\]]*?)\]\!((?:.(?!\[zrl\=))*?)\[\/zrl\]/'; @@ -3025,6 +3033,7 @@ function tgroup_check($uid, $item) { logger('tgroup_check: mention was in a reshare or exceeded max_tagged_forums - ignoring'); continue; } +*/ return true; } diff --git a/include/text.php b/include/text.php index 415a51790..d7ffa5550 100644 --- a/include/text.php +++ b/include/text.php @@ -1652,7 +1652,7 @@ function format_hashtags(&$item) { function format_mentions(&$item) { $s = ''; - $terms = isset($item['term']) ? get_terms_oftype($item['term'], [TERM_MENTION, TERM_FORUM]) : []; + $terms = isset($item['term']) ? get_terms_oftype($item['term'], TERM_MENTION) : []; if($terms) { foreach($terms as $t) { if(! isset($t['term'])) @@ -2876,7 +2876,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) $termtype = ((strpos($tag,'#') === 0) ? TERM_HASHTAG : TERM_UNKNOWN); $termtype = ((strpos($tag,'@') === 0) ? TERM_MENTION : $termtype); - $termtype = ((strpos($tag,'!') === 0) ? TERM_FORUM : $termtype); +// $termtype = ((strpos($tag,'!') === 0) ? TERM_FORUM : $termtype); $termtype = ((strpos($tag,'#^[') === 0) ? TERM_BOOKMARK : $termtype); // Is it a hashtag of some kind? @@ -2943,7 +2943,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) // BEGIN mentions - if (in_array($termtype, [TERM_MENTION, TERM_FORUM])) { + if ($termtype === TERM_MENTION) { // The @! tag will alter permissions @@ -3051,15 +3051,8 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) $profile = str_replace(',','%2c',$profile); $url = $profile; - if($termtype === TERM_FORUM) { - $newtag = '!' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; - $body = str_replace('!' . (($exclusive) ? '!' : '') . $name, $newtag, $body); - } - - if ($termtype === TERM_MENTION) { - $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; - $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); - } + $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; + $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); // append tag to str_tags if(! stristr($str_tags,$newtag)) { @@ -3117,12 +3110,12 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true) //create profile link $profile = str_replace(',','%2c',$profile); $url = $profile; - +/* if($termtype === TERM_FORUM) { $newtag = '!' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; $body = str_replace('!' . (($exclusive) ? '!' : '') . $name, $newtag, $body); } - +*/ if ($termtype === TERM_MENTION) { $newtag = '@' . (($exclusive) ? '!' : '') . '[zrl=' . $profile . ']' . $newname . '[/zrl]'; $body = str_replace('@' . (($exclusive) ? '!' : '') . $name, $newtag, $body); diff --git a/view/js/autocomplete.js b/view/js/autocomplete.js index 09f6a71c4..8edd8dafa 100644 --- a/view/js/autocomplete.js +++ b/view/js/autocomplete.js @@ -178,16 +178,6 @@ function string2bb(element) { template: contact_format }; - // Autocomplete forums - forums = { - match: /(^|\s)(\!\!*)([^ \n]{3,})$/, - index: 3, - cache: true, - search: function(term, callback) { contact_search(term, callback, backend_url, 'f', extra_channels, spinelement=false); }, - replace: editor_replace, - template: contact_format - }; - // Autocomplete hashtags tags = { match: /(^|\s)(\#)([^ \n]{2,})$/, @@ -220,7 +210,7 @@ function string2bb(element) { } }); // it seems important that contacts are before channels here. Otherwise we run into regex issues. - textcomplete.register([contacts, channels, smilies, forums, tags]); + textcomplete.register([contacts,channels,smilies,tags]); }); }; })( jQuery ); @@ -244,17 +234,6 @@ function string2bb(element) { template: contact_format, }; - // Autocomplete forums - forums = { - match: /(^\!)([^\n]{2,})$/, - index: 2, - cache: true, - search: function(term, callback) { contact_search(term, callback, backend_url, 'f', [], spinelement='#nav-search-spinner'); }, - replace: basic_replace, - template: contact_format - }; - - // Autocomplete hashtags tags = { match: /(^\#)([^ \n]{2,})$/, @@ -278,7 +257,7 @@ function string2bb(element) { maxCount: 100 } }); - textcomplete.register([contacts, forums, tags]); + textcomplete.register([contacts,tags]); }); textcomplete.on('selected', function() { this.editor.el.form.submit(); }); |