Merge pull request #9176 from MrPetovan/bug/9172-fix-qcomment

Fix qcomment addon
2022.09-rc
Michael Vogel 2020-09-10 06:37:59 +02:00 zatwierdzone przez GitHub
commit db4ff4af93
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
3 zmienionych plików z 37 dodań i 28 usunięć

Wyświetl plik

@ -25,6 +25,7 @@ use Friendica\Content\Nav;
use Friendica\Content\Pager;
use Friendica\Content\Text\BBCode;
use Friendica\Core\ACL;
use Friendica\Core\Addon;
use Friendica\Core\Hook;
use Friendica\Core\Logger;
use Friendica\Core\Renderer;
@ -1378,6 +1379,16 @@ function photos_content(App $a)
if (!DBA::isResult($items)) {
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
/*
* Hmmm, code depending on the presence of a particular addon?
* This should be better if done by a hook
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
$comments .= Renderer::replaceMacros($cmnt_tpl, [
'$return_path' => '',
'$jsreload' => $return_path,
@ -1392,7 +1403,7 @@ function photos_content(App $a)
'$preview' => DI::l10n()->t('Preview'),
'$loading' => DI::l10n()->t('Loading...'),
'$sourceapp' => DI::l10n()->t($a->sourcename),
'$ww' => '',
'$qcomment' => $qcomment,
'$rand_num' => Crypto::randomDigits(12)
]);
}
@ -1425,6 +1436,16 @@ function photos_content(App $a)
}
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
/*
* Hmmm, code depending on the presence of a particular addon?
* This should be better if done by a hook
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
$comments .= Renderer::replaceMacros($cmnt_tpl,[
'$return_path' => '',
'$jsreload' => $return_path,
@ -1438,7 +1459,7 @@ function photos_content(App $a)
'$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'),
'$sourceapp' => DI::l10n()->t($a->sourcename),
'$ww' => '',
'$qcomment' => $qcomment,
'$rand_num' => Crypto::randomDigits(12)
]);
}
@ -1488,6 +1509,16 @@ function photos_content(App $a)
]);
if (($can_post || Security::canWriteToUserWall($owner_uid))) {
/*
* Hmmm, code depending on the presence of a particular addon?
* This should be better if done by a hook
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
$comments .= Renderer::replaceMacros($cmnt_tpl, [
'$return_path' => '',
'$jsreload' => $return_path,
@ -1501,7 +1532,7 @@ function photos_content(App $a)
'$submit' => DI::l10n()->t('Submit'),
'$preview' => DI::l10n()->t('Preview'),
'$sourceapp' => DI::l10n()->t($a->sourcename),
'$ww' => '',
'$qcomment' => $qcomment,
'$rand_num' => Crypto::randomDigits(12)
]);
}

Wyświetl plik

@ -905,21 +905,16 @@ class Post
$comment_box = '';
$conv = $this->getThread();
$ww = '';
if (($conv->getMode() === 'network') && $this->isWallToWall()) {
$ww = 'ww';
}
if ($conv->isWritable() && $this->isWritable()) {
$qcomment = null;
/*
* Hmmm, code depending on the presence of a particular addon?
* This should be better if done by a hook
*/
$qcomment = null;
if (Addon::isEnabled('qcomment')) {
$qc = ((local_user()) ? DI::pConfig()->get(local_user(), 'qcomment', 'words') : null);
$qcomment = (($qc) ? explode("\n", $qc) : null);
$words = DI::pConfig()->get(local_user(), 'qcomment', 'words');
$qcomment = $words ? explode("\n", $words) : [];
}
// Fetch the user id from the parent when the owner user is empty
@ -961,7 +956,6 @@ class Post
'$preview' => DI::l10n()->t('Preview'),
'$indent' => $indent,
'$sourceapp' => DI::l10n()->t($a->sourcename),
'$ww' => $conv->getMode() === 'network' ? $ww : '',
'$rand_num' => Crypto::randomDigits(12)
]);
}

Wyświetl plik

@ -129,22 +129,6 @@
$("#comment-edit-text-" + id).val(tmpStr + ins);
}
function qCommentInsert(obj,id) {
var tmpStr = $("#comment-edit-text-" + id).val();
if (tmpStr == "") {
$("#comment-edit-text-" + id).addClass("comment-edit-text-full");
$("#comment-edit-text-" + id).removeClass("comment-edit-text-empty");
openMenu("comment-edit-submit-wrapper-" + id);
}
var ins = $(obj).val();
ins = ins.replace("&lt;","<");
ins = ins.replace("&gt;",">");
ins = ins.replace("&amp;","&");
ins = ins.replace("&quot;","\"");
$("#comment-edit-text-" + id).val(tmpStr + ins);
$(obj).val("");
}
function showHideCommentBox(id) {
if ($("#comment-edit-form-" + id).is(":visible")) {
$("#comment-edit-form-" + id).hide();