Merge branch 'dev' into 'dev'
Add 'reply on comment' feature See merge request hubzilla/core!1614
This commit is contained in:
commit
256f8dd41b
@ -305,6 +305,7 @@ class ThreadItem {
|
|||||||
if($this->is_commentable() && $observer) {
|
if($this->is_commentable() && $observer) {
|
||||||
$like = array( t("I like this \x28toggle\x29"), t("like"));
|
$like = array( t("I like this \x28toggle\x29"), t("like"));
|
||||||
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
|
$dislike = array( t("I don't like this \x28toggle\x29"), t("dislike"));
|
||||||
|
$reply_to = array( t("Reply on this comment"), t("reply"), t("Reply to"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($shareable) {
|
if ($shareable) {
|
||||||
@ -348,9 +349,6 @@ class ThreadItem {
|
|||||||
$list_unseen_txt = (($unseen_comments) ? sprintf('%d unseen',$unseen_comments) : '');
|
$list_unseen_txt = (($unseen_comments) ? sprintf('%d unseen',$unseen_comments) : '');
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$children = $this->get_children();
|
$children = $this->get_children();
|
||||||
|
|
||||||
$has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false);
|
$has_tags = (($body['tags'] || $body['categories'] || $body['mentions'] || $body['attachments'] || $body['folders']) ? true : false);
|
||||||
@ -373,6 +371,8 @@ class ThreadItem {
|
|||||||
'text' => strip_tags($body['html']),
|
'text' => strip_tags($body['html']),
|
||||||
'id' => $this->get_id(),
|
'id' => $this->get_id(),
|
||||||
'mid' => $item['mid'],
|
'mid' => $item['mid'],
|
||||||
|
'parent' => $item['parent'],
|
||||||
|
'author_id' => $item['author']['xchan_addr'],
|
||||||
'isevent' => $isevent,
|
'isevent' => $isevent,
|
||||||
'attend' => $attend,
|
'attend' => $attend,
|
||||||
'consensus' => $consensus,
|
'consensus' => $consensus,
|
||||||
@ -425,9 +425,10 @@ class ThreadItem {
|
|||||||
'has_tags' => $has_tags,
|
'has_tags' => $has_tags,
|
||||||
'reactions' => $this->reactions,
|
'reactions' => $this->reactions,
|
||||||
// Item toolbar buttons
|
// Item toolbar buttons
|
||||||
'emojis' => (($this->is_toplevel() && $this->is_commentable() && $observer && feature_enabled($conv->get_profile_owner(),'emojis')) ? '1' : ''),
|
'emojis' => (($this->is_toplevel() && $this->is_commentable() && $observer && feature_enabled($conv->get_profile_owner(),'emojis')) ? '1' : ''),
|
||||||
'like' => $like,
|
'like' => $like,
|
||||||
'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''),
|
'dislike' => ((feature_enabled($conv->get_profile_owner(),'dislike')) ? $dislike : ''),
|
||||||
|
'reply_to' => (((! $this->is_toplevel()) && feature_enabled($conv->get_profile_owner(),'reply_to')) ? $reply_to : ''),
|
||||||
'share' => $share,
|
'share' => $share,
|
||||||
'embed' => $embed,
|
'embed' => $embed,
|
||||||
'rawmid' => $item['mid'],
|
'rawmid' => $item['mid'],
|
||||||
@ -869,4 +870,3 @@ class ThreadItem {
|
|||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ class Display extends \Zotlabs\Web\Controller {
|
|||||||
$sysid = $sys['channel_id'];
|
$sysid = $sys['channel_id'];
|
||||||
|
|
||||||
if(local_channel()) {
|
if(local_channel()) {
|
||||||
$r = q("SELECT item.id as item_id from item WHERE uid = %d and mid = '%s' $item_normal limit 1",
|
$r = q("SELECT item.parent as item_id from item WHERE uid = %d and mid = '%s' $item_normal limit 1",
|
||||||
intval(local_channel()),
|
intval(local_channel()),
|
||||||
dbesc($target_item['parent_mid'])
|
dbesc($target_item['parent_mid'])
|
||||||
);
|
);
|
||||||
|
@ -329,9 +329,14 @@ class Item extends Controller {
|
|||||||
$obj_type = ACTIVITY_OBJ_COMMENT;
|
$obj_type = ACTIVITY_OBJ_COMMENT;
|
||||||
|
|
||||||
if($parent) {
|
if($parent) {
|
||||||
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
|
// Get commented post data
|
||||||
|
$rr = q("SELECT parent, mid FROM item WHERE id = %d LIMIT 1",
|
||||||
intval($parent)
|
intval($parent)
|
||||||
);
|
);
|
||||||
|
// and its parent
|
||||||
|
$r = q("SELECT * FROM item WHERE id = %d LIMIT 1",
|
||||||
|
intval($rr[0]['parent'])
|
||||||
|
);
|
||||||
}
|
}
|
||||||
elseif($parent_mid && $uid) {
|
elseif($parent_mid && $uid) {
|
||||||
// This is coming from an API source, and we are logged in
|
// This is coming from an API source, and we are logged in
|
||||||
@ -910,8 +915,7 @@ class Item extends Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if($parent_item)
|
if($parent_item)
|
||||||
$parent_mid = $parent_item['mid'];
|
$parent_mid = $rr[0]['mid'];
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Fallback so that we alway have a thr_parent
|
// Fallback so that we alway have a thr_parent
|
||||||
@ -1160,7 +1164,7 @@ class Item extends Controller {
|
|||||||
'verb' => ACTIVITY_POST,
|
'verb' => ACTIVITY_POST,
|
||||||
'otype' => 'item',
|
'otype' => 'item',
|
||||||
'parent' => $parent,
|
'parent' => $parent,
|
||||||
'parent_mid' => $parent_item['mid']
|
'parent_mid' => $rr[0]['mid']
|
||||||
));
|
));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -167,6 +167,14 @@ function get_features($filtered = true, $level = (-1)) {
|
|||||||
t('Ability to mark special posts with a star indicator'),
|
t('Ability to mark special posts with a star indicator'),
|
||||||
false,
|
false,
|
||||||
get_config('feature_lock','star_posts'),
|
get_config('feature_lock','star_posts'),
|
||||||
|
],
|
||||||
|
|
||||||
|
[
|
||||||
|
'reply_to',
|
||||||
|
t('Reply on comment'),
|
||||||
|
t('Ability to reply on selected comment'),
|
||||||
|
false,
|
||||||
|
get_config('feature_lock','reply_to'),
|
||||||
]
|
]
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -1876,8 +1876,11 @@ function item_store($arr, $allow_exec = false, $deliver = true) {
|
|||||||
// even though we don't support it now, preserve the info
|
// even though we don't support it now, preserve the info
|
||||||
// and re-attach to the conversation parent.
|
// and re-attach to the conversation parent.
|
||||||
|
|
||||||
|
// @FIXME when we'll start threaded comments support,
|
||||||
|
// now this respected on mid / parent_mid level (MK)
|
||||||
|
|
||||||
if($r[0]['mid'] != $r[0]['parent_mid']) {
|
if($r[0]['mid'] != $r[0]['parent_mid']) {
|
||||||
$arr['parent_mid'] = $r[0]['parent_mid'];
|
//$arr['parent_mid'] = $r[0]['parent_mid'];
|
||||||
$z = q("SELECT * FROM item WHERE mid = '%s' AND parent_mid = '%s' AND uid = %d
|
$z = q("SELECT * FROM item WHERE mid = '%s' AND parent_mid = '%s' AND uid = %d
|
||||||
ORDER BY id ASC LIMIT 1",
|
ORDER BY id ASC LIMIT 1",
|
||||||
dbesc($r[0]['parent_mid']),
|
dbesc($r[0]['parent_mid']),
|
||||||
|
@ -231,6 +231,10 @@ function handle_comment_form(e) {
|
|||||||
$('#' + emptyCommentElm).removeAttr('tabindex');
|
$('#' + emptyCommentElm).removeAttr('tabindex');
|
||||||
$('#' + emptySubmitElm).removeAttr('tabindex');
|
$('#' + emptySubmitElm).removeAttr('tabindex');
|
||||||
form.find(':not(.comment-edit-text)').hide();
|
form.find(':not(.comment-edit-text)').hide();
|
||||||
|
form.find(':input[name=parent]').val(emptyCommentElm.replace(/\D/g,''));
|
||||||
|
var btn = form.find(':button[type=submit]').html();
|
||||||
|
form.find(':button[type=submit]').html(btn.replace(/<[^>]*>/g, '').trim());
|
||||||
|
form.find(':button[type=submit]').prop('title', '');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1144,6 +1148,16 @@ function doprofilelike(ident, verb) {
|
|||||||
$.get('like/' + ident + '?verb=' + verb, function() { window.location.href=window.location.href; });
|
$.get('like/' + ident + '?verb=' + verb, function() { window.location.href=window.location.href; });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function doreply(parent, ident, owner, hint) {
|
||||||
|
var form = $('#comment-edit-form-' + parent.toString());
|
||||||
|
form.find('input[name=parent]').val(ident);
|
||||||
|
var i = form.find('button[type=submit]');
|
||||||
|
var btn = i.html().replace(/<[^>]*>/g, '').trim();
|
||||||
|
i.html('<i class="fa fa-reply" ></i> ' + btn);
|
||||||
|
i.prop('title', hint);
|
||||||
|
form.find('textarea').val("@{" + owner + "}\n");
|
||||||
|
$('#comment-edit-text-' + parent.toString()).focus();
|
||||||
|
}
|
||||||
|
|
||||||
function dropItem(url, object) {
|
function dropItem(url, object) {
|
||||||
|
|
||||||
|
@ -102,6 +102,11 @@
|
|||||||
<i class="fa fa-thumbs-o-down{{if $item.my_responses.dislike}} ivoted{{/if}}" ></i>
|
<i class="fa fa-thumbs-o-down{{if $item.my_responses.dislike}} ivoted{{/if}}" ></i>
|
||||||
</button>
|
</button>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
{{if $item.reply_to}}
|
||||||
|
<button type="button" title="{{$item.reply_to.0}}" class="btn btn-outline-secondary btn-sm" onclick="doreply({{$item.parent}},{{$item.id}},'{{$item.author_id}}', '{{$item.reply_to.2}} {{$item.name}}'); return false;">
|
||||||
|
<i class="fa fa-reply" ></i>
|
||||||
|
</button>
|
||||||
|
{{/if}}
|
||||||
{{if $item.isevent}}
|
{{if $item.isevent}}
|
||||||
<div class="btn-group">
|
<div class="btn-group">
|
||||||
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown" id="wall-item-attend-menu-{{$item.id}}" title="{{$item.attend_title}}">
|
<button type="button" class="btn btn-outline-secondary btn-sm dropdown-toggle" data-toggle="dropdown" id="wall-item-attend-menu-{{$item.id}}" title="{{$item.attend_title}}">
|
||||||
|
Reference in New Issue
Block a user