Merge branch 'dev'

This commit is contained in:
zotlabs 2020-05-13 18:53:38 -07:00
commit a2fd6320d1
4 changed files with 63 additions and 48 deletions

View file

@ -317,6 +317,7 @@ class Item extends Controller {
$parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0); $parent = ((x($_REQUEST,'parent')) ? intval($_REQUEST['parent']) : 0);
$parent_mid = ((x($_REQUEST,'parent_mid')) ? trim($_REQUEST['parent_mid']) : ''); $parent_mid = ((x($_REQUEST,'parent_mid')) ? trim($_REQUEST['parent_mid']) : '');
$hidden_mentions = ((x($_REQUEST,'hidden_mentions')) ? trim($_REQUEST['hidden_mentions']) : '');
/** /**
* Who is viewing this page and posting this thing * Who is viewing this page and posting this thing
@ -393,7 +394,7 @@ class Item extends Controller {
$plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : ''); $plink = ((x($_REQUEST,'permalink')) ? escape_tags($_REQUEST['permalink']) : '');
$obj_type = ((x($_REQUEST,'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE); $obj_type = ((x($_REQUEST,'obj_type')) ? escape_tags($_REQUEST['obj_type']) : ACTIVITY_OBJ_NOTE);
// allow API to bulk load a bunch of imported items with sending out a bunch of posts. // allow API to bulk load a bunch of imported items without sending out a bunch of posts.
$nopush = ((x($_REQUEST,'nopush')) ? intval($_REQUEST['nopush']) : 0); $nopush = ((x($_REQUEST,'nopush')) ? intval($_REQUEST['nopush']) : 0);
/* /*
@ -843,9 +844,6 @@ class Item extends Controller {
if($mimetype === 'text/bbcode') { if($mimetype === 'text/bbcode') {
require_once('include/text.php');
// BBCODE alert: the following functions assume bbcode input // BBCODE alert: the following functions assume bbcode input
// and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.) // and will require alternatives for alternative content-types (text/html, text/markdown, text/plain, etc.)
// we may need virtual or template classes to implement the possible alternatives // we may need virtual or template classes to implement the possible alternatives
@ -864,11 +862,13 @@ class Item extends Controller {
$body = cleanup_bbcode($body); $body = cleanup_bbcode($body);
// Look for tags and linkify them // Look for tags and linkify them
$results = linkify_tags($summary, ($uid) ? $uid : $profile_uid); $summary_tags = linkify_tags($summary, ($uid) ? $uid : $profile_uid);
$results = linkify_tags($body, ($uid) ? $uid : $profile_uid); $body_tags = linkify_tags($body, ($uid) ? $uid : $profile_uid);
$comment_tags = linkify_tags($hidden_mentions, ($uid) ? $uid : $profile_uid);
foreach ( [ $summary_tags, $body_tags, $comment_tags ] as $results ) {
if($results) { if ($results) {
// Set permissions based on tag replacements // Set permissions based on tag replacements
set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $parent_item, $private); set_linkified_perms($results, $str_contact_allow, $str_group_allow, $profile_uid, $parent_item, $private);
@ -876,9 +876,22 @@ class Item extends Controller {
if (! isset($post_tags)) { if (! isset($post_tags)) {
$post_tags = []; $post_tags = [];
} }
foreach($results as $result) { foreach ($results as $result) {
$success = $result['success']; $success = $result['success'];
if($success['replaced']) { if ($success['replaced']) {
// suppress duplicate mentions/tags
$already_tagged = false;
foreach ($post_tags as $pt) {
if ($pt['term'] === $success['term'] && $pt['url'] === $success['url'] && intval($pt['ttype']) === intval($success['termtype'])) {
$already_tagged = true;
break;
}
}
if ($already_tagged) {
continue;
}
$post_tags[] = array( $post_tags[] = array(
'uid' => $profile_uid, 'uid' => $profile_uid,
'ttype' => $success['termtype'], 'ttype' => $success['termtype'],
@ -909,6 +922,7 @@ class Item extends Controller {
} }
} }
} }
}
/** /**

View file

@ -16,7 +16,7 @@ use Zotlabs\Daemon\Master;
* @brief This file defines some global constants and includes the central App class. * @brief This file defines some global constants and includes the central App class.
*/ */
define ( 'STD_VERSION', '20.05.12' ); define ( 'STD_VERSION', '20.05.14' );
define ( 'ZOT_REVISION', '6.0' ); define ( 'ZOT_REVISION', '6.0' );
define ( 'DB_UPDATE_VERSION', 1239 ); define ( 'DB_UPDATE_VERSION', 1239 );

View file

@ -356,13 +356,13 @@ function commentInsert(obj, id) {
} }
function commentAuthors(id) { function commentAuthors(id) {
var auths = $("#thread-authors-" + id).html(); $("#hidden-mentions-" + id).val($("#thread-authors-" + id).html());
if(typeof(auths) != 'undefined') { // if(typeof(auths) != 'undefined') {
var tmpStr = $("#comment-edit-text-" + id).val(); // var tmpStr = $("#comment-edit-text-" + id).val();
if(tmpStr == '') { // if(tmpStr == '') {
$("#comment-edit-text-" + id).val(auths); // $("#comment-edit-text-" + id).val(auths);
} // }
} // }
} }

View file

@ -13,6 +13,7 @@
<input type="hidden" name="return" value="{{$return_path}}" /> <input type="hidden" name="return" value="{{$return_path}}" />
<input type="hidden" name="jsreload" value="{{$jsreload}}" /> <input type="hidden" name="jsreload" value="{{$jsreload}}" />
<input type="hidden" name="preview" id="comment-preview-inp-{{$id}}" value="0" /> <input type="hidden" name="preview" id="comment-preview-inp-{{$id}}" value="0" />
<input type="hidden" name="hidden_mentions" id="hidden-mentions-{{$id}}" value="" />
{{if $anoncomments && ! $observer}} {{if $anoncomments && ! $observer}}
<div id="comment-edit-anon-{{$id}}" style="display: none;" > <div id="comment-edit-anon-{{$id}}" style="display: none;" >
{{include file="field_input.tpl" field=$anonname}} {{include file="field_input.tpl" field=$anonname}}