mirror of
https://codeberg.org/streams/streams.git
synced 2024-09-19 16:55:18 +00:00
make bang tag exclusive
This commit is contained in:
parent
41c68724e0
commit
46d5d4ad63
7 changed files with 15 additions and 15 deletions
|
@ -346,7 +346,7 @@ define ( 'TERM_THING', 7 );
|
|||
define ( 'TERM_BOOKMARK', 8 );
|
||||
define ( 'TERM_HIERARCHY', 9 );
|
||||
define ( 'TERM_COMMUNITYTAG', 10 );
|
||||
define ( 'TERM_FORUM', 11 );
|
||||
define ( 'TERM_GROUP', 11 );
|
||||
define ( 'TERM_EMOJI', 12 );
|
||||
define ( 'TERM_QUOTED', 13 );
|
||||
|
||||
|
|
|
@ -1100,7 +1100,7 @@ function encode_item_xchan($xchan) {
|
|||
function encode_item_terms($terms,$mirror = false) {
|
||||
$ret = [];
|
||||
|
||||
$allowed_export_terms = [TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY, TERM_BOOKMARK, TERM_COMMUNITYTAG, TERM_FORUM];
|
||||
$allowed_export_terms = [TERM_UNKNOWN, TERM_HASHTAG, TERM_MENTION, TERM_CATEGORY, TERM_BOOKMARK, TERM_COMMUNITYTAG, TERM_GROUP];
|
||||
|
||||
if($mirror) {
|
||||
$allowed_export_terms[] = TERM_PCATEGORY;
|
||||
|
@ -1199,7 +1199,7 @@ function decode_tags($t) {
|
|||
$tag['ttype'] = TERM_COMMUNITYTAG;
|
||||
break;
|
||||
case 'forum':
|
||||
$tag['ttype'] = TERM_FORUM;
|
||||
$tag['ttype'] = TERM_GROUP;
|
||||
break;
|
||||
default:
|
||||
case 'unknown':
|
||||
|
@ -2674,7 +2674,7 @@ function tag_deliver($uid, $item_id) {
|
|||
*/
|
||||
|
||||
|
||||
$terms = ((isset($item['term'])) ? get_terms_oftype($item['term'],[TERM_MENTION, TERM_FORUM]) : false);
|
||||
$terms = ((isset($item['term'])) ? get_terms_oftype($item['term'],[TERM_MENTION, TERM_GROUP]) : false);
|
||||
|
||||
$pterms = ((isset($item['term'])) ? get_terms_oftype($item['term'], [TERM_PCATEGORY, TERM_HASHTAG] ) : false);
|
||||
|
||||
|
@ -2745,7 +2745,7 @@ function tag_deliver($uid, $item_id) {
|
|||
*/
|
||||
|
||||
if ($is_group && intval($item['item_thread_top']) && (! intval($item['item_wall']))) {
|
||||
if ((intval($term['ttype']) === TERM_FORUM || get_pconfig($uid,'system','post_via_mentions',in_array($role,['forum','forum_moderated']))) && perm_is_allowed($uid, $item['author_xchan'], 'post_wall')) {
|
||||
if ((intval($term['ttype']) === TERM_GROUP || get_pconfig($uid,'system','post_via_mentions',in_array($role,['forum','forum_moderated']))) && perm_is_allowed($uid, $item['author_xchan'], 'post_wall')) {
|
||||
logger('group mention delivery for ' . $u['channel_address']);
|
||||
start_delivery_chain($u, $item, $item_id, false, true, (($item['edited'] != $item['created']) || $item['item_deleted']));
|
||||
q("update item set item_blocked = %d where id = %d",
|
||||
|
@ -2948,7 +2948,7 @@ function i_am_mentioned($channel,$item,$check_groups = false) {
|
|||
|
||||
$tagged = false;
|
||||
$matches = [];
|
||||
$tagtype = $check_groups ? TERM_FORUM : TERM_MENTION;
|
||||
$tagtype = $check_groups ? TERM_GROUP : TERM_MENTION;
|
||||
$terms = ((isset($item['term'])) ? get_terms_oftype($item['term'], $tagtype) : false);
|
||||
|
||||
if ($terms) {
|
||||
|
|
|
@ -2967,7 +2967,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
|
|||
$termtype = ((str_starts_with($tag, '#')) ? TERM_HASHTAG : TERM_UNKNOWN);
|
||||
$termtype = ((str_starts_with($tag, '"#')) ? TERM_HASHTAG : $termtype);
|
||||
$termtype = ((str_starts_with($tag, '@')) ? TERM_MENTION : $termtype);
|
||||
$termtype = ((str_starts_with($tag, '!')) ? TERM_FORUM : $termtype);
|
||||
$termtype = ((str_starts_with($tag, '!')) ? TERM_GROUP : $termtype);
|
||||
|
||||
// Is it a hashtag of some kind?
|
||||
|
||||
|
@ -3035,7 +3035,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
|
|||
|
||||
// BEGIN mentions
|
||||
|
||||
if (in_array($termtype, [TERM_MENTION, TERM_FORUM])) {
|
||||
if (in_array($termtype, [TERM_MENTION, TERM_GROUP])) {
|
||||
// The @! tag will alter permissions
|
||||
|
||||
// $in_network is set to false to avoid false positives on posts originating
|
||||
|
@ -3159,7 +3159,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
|
|||
}
|
||||
|
||||
// add the channel's xchan_hash to $access_tag if exclusive
|
||||
if ($exclusive) {
|
||||
if (($termtype === TERM_GROUP) || $exclusive) {
|
||||
$access_tag = 'cid:' . $xc['xchan_hash'];
|
||||
}
|
||||
|
||||
|
@ -3173,7 +3173,7 @@ function handle_tag(&$body, &$str_tags, $profile_uid, $tag, $in_network = true)
|
|||
|
||||
$zrl = isOWAEnabled($url) ? 'zrl' : 'url';
|
||||
|
||||
if ($termtype === TERM_FORUM) {
|
||||
if ($termtype === TERM_GROUP) {
|
||||
$newtag = '!' . (($exclusive) ? '!' : '') . '[' . $zrl . '=' . $profile . ']' . $newname . '[/' . $zrl . ']';
|
||||
$body = str_replace('!' . (($exclusive) ? '!' : '') . $name, $newtag, $body);
|
||||
}
|
||||
|
|
|
@ -165,7 +165,7 @@ function format_term_for_display($term)
|
|||
$s = '';
|
||||
if (($term['ttype'] == TERM_HASHTAG) || ($term['ttype'] == TERM_COMMUNITYTAG)) {
|
||||
$s .= '#';
|
||||
} elseif ($term['ttype'] == TERM_FORUM) {
|
||||
} elseif ($term['ttype'] == TERM_GROUP) {
|
||||
$s .= '!';
|
||||
} elseif ($term['ttype'] == TERM_MENTION) {
|
||||
$s .= '@';
|
||||
|
|
|
@ -516,7 +516,7 @@ class Activity
|
|||
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))];
|
||||
$ret[] = ['ttype' => TERM_GROUP, 'url' => $t['href'], 'term' => escape_tags(substr($t['name'], 1))];
|
||||
} else {
|
||||
$ret[] = ['ttype' => TERM_MENTION, 'url' => $t['href'], 'term' => escape_tags((str_starts_with($t['name'], '@')) ? substr($t['name'], 1) : $t['name'])];
|
||||
}
|
||||
|
@ -563,7 +563,7 @@ class Activity
|
|||
}
|
||||
break;
|
||||
|
||||
case TERM_FORUM:
|
||||
case TERM_GROUP:
|
||||
$term = self::lookup_term_addr($t['url'], $t['term']);
|
||||
$ret[] = ['type' => 'Mention', 'href' => $t['url'], 'name' => '!' . (($term) ?: $t['term'])];
|
||||
break;
|
||||
|
|
|
@ -800,7 +800,7 @@ class Ping extends Controller
|
|||
$forums['total'] = 0;
|
||||
|
||||
for ($x = 0; $x < $fcount; $x++) {
|
||||
$ttype = TERM_FORUM;
|
||||
$ttype = TERM_GROUP;
|
||||
$p = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype = $ttype AND term = '" . protect_sprintf(dbesc($forums[$x]['xchan_name'])) . "'");
|
||||
|
||||
$p = ids_to_querystr($p, 'parent');
|
||||
|
|
|
@ -331,7 +331,7 @@ class Stream extends Controller
|
|||
$p1 = q("SELECT DISTINCT parent FROM item WHERE uid = " . intval(local_channel()) . " AND ( author_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' OR owner_xchan = '" . dbesc($cid_r[0]['abook_xchan']) . "' ) $item_normal ");
|
||||
$p2 = q("SELECT oid AS parent FROM term WHERE uid = " . intval(local_channel()) . " AND ttype in (%d, %d) AND term = '" . dbesc($cid_r[0]['xchan_name']) . "'",
|
||||
intval(TERM_MENTION),
|
||||
intval(TERM_FORUM)
|
||||
intval(TERM_GROUP)
|
||||
);
|
||||
|
||||
$p_str = ids_to_querystr(array_merge($p1, $p2), 'parent');
|
||||
|
|
Loading…
Reference in a new issue