Best "uid" for sending comments, refresh after commenting might work now

This commit is contained in:
Michael 2018-01-07 17:14:43 +00:00
parent 708d034c6d
commit e12b6e01a2
6 changed files with 16 additions and 8 deletions

View file

@ -43,7 +43,7 @@ define('FRIENDICA_PLATFORM', 'Friendica');
define('FRIENDICA_CODENAME', 'Asparagus'); define('FRIENDICA_CODENAME', 'Asparagus');
define('FRIENDICA_VERSION', '3.6-dev'); define('FRIENDICA_VERSION', '3.6-dev');
define('DFRN_PROTOCOL_VERSION', '2.23'); define('DFRN_PROTOCOL_VERSION', '2.23');
define('DB_UPDATE_VERSION', 1238); define('DB_UPDATE_VERSION', 1239);
define('NEW_UPDATE_ROUTINE_VERSION', 1170); define('NEW_UPDATE_ROUTINE_VERSION', 1170);
/** /**

View file

@ -1,6 +1,6 @@
-- ------------------------------------------ -- ------------------------------------------
-- Friendica 3.6-dev (Asparagus) -- Friendica 3.6-dev (Asparagus)
-- DB_UPDATE_VERSION 1238 -- DB_UPDATE_VERSION 1239
-- ------------------------------------------ -- ------------------------------------------
@ -972,7 +972,7 @@ CREATE TABLE IF NOT EXISTS `thread` (
INDEX `uid_created` (`uid`,`created`), INDEX `uid_created` (`uid`,`created`),
INDEX `uid_commented` (`uid`,`commented`), INDEX `uid_commented` (`uid`,`commented`),
INDEX `uid_wall_created` (`uid`,`wall`,`created`), INDEX `uid_wall_created` (`uid`,`wall`,`created`),
INDEX `private_wall_received` (`private`,`wall`,`received`) INDEX `private_wall_commented` (`private`,`wall`,`commented`)
) DEFAULT COLLATE utf8mb4_general_ci; ) DEFAULT COLLATE utf8mb4_general_ci;
-- --

View file

@ -190,14 +190,14 @@ function community_getitems($start, $itemspage, $content)
item_joins() . " AND `contact`.`self` item_joins() . " AND `contact`.`self`
WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated` WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
AND NOT `thread`.`private` AND `thread`.`wall` AND NOT `thread`.`private` AND `thread`.`wall`
ORDER BY `thread`.`received` DESC LIMIT " . intval($start) . ", " . intval($itemspage) ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage)
); );
return dba::inArray($r); return dba::inArray($r);
} elseif ($content == 'global') { } elseif ($content == 'global') {
$r = dba::p("SELECT " . item_fieldlists() . " FROM `thread` $r = dba::p("SELECT " . item_fieldlists() . " FROM `thread`
INNER JOIN `item` ON `item`.`id` = `thread`.`iid` " . item_joins() . INNER JOIN `item` ON `item`.`id` = `thread`.`iid` " . item_joins() .
"WHERE `thread`.`uid` = 0 AND `verb` = ? "WHERE `thread`.`uid` = 0 AND `verb` = ?
ORDER BY `thread`.`created` DESC LIMIT " . intval($start) . ", " . intval($itemspage), ORDER BY `thread`.`commented` DESC LIMIT " . intval($start) . ", " . intval($itemspage),
ACTIVITY_POST ACTIVITY_POST
); );
return dba::inArray($r); return dba::inArray($r);

View file

@ -1601,7 +1601,7 @@ class DBStructure {
"uid_created" => array("uid","created"), "uid_created" => array("uid","created"),
"uid_commented" => array("uid","commented"), "uid_commented" => array("uid","commented"),
"uid_wall_created" => array("uid","wall","created"), "uid_wall_created" => array("uid","wall","created"),
"private_wall_received" => array("private","wall","received"), "private_wall_commented" => array("private","wall","commented"),
) )
); );
$database["tokens"] = array( $database["tokens"] = array(

View file

@ -765,6 +765,14 @@ class Post extends BaseObject
$qcomment = (($qc) ? explode("\n", $qc) : null); $qcomment = (($qc) ? explode("\n", $qc) : null);
} }
// Fetch the user id from the parent when the owner user is empty
$uid = $conv->getProfileOwner();
$parent_uid = $this->getDataValue('uid');
if (!empty($parent_uid) && empty($uid) && ($uid != $parent_uid)) {
$uid = $parent_uid;
}
$template = get_markup_template($this->getCommentBoxTemplate()); $template = get_markup_template($this->getCommentBoxTemplate());
$comment_box = replace_macros($template, array( $comment_box = replace_macros($template, array(
'$return_path' => $a->query_string, '$return_path' => $a->query_string,
@ -774,7 +782,7 @@ class Post extends BaseObject
'$id' => $this->getId(), '$id' => $this->getId(),
'$parent' => $this->getId(), '$parent' => $this->getId(),
'$qcomment' => $qcomment, '$qcomment' => $qcomment,
'$profile_uid' => $conv->getProfileOwner(), '$profile_uid' => $uid,
'$mylink' => $a->remove_baseurl($a->contact['url']), '$mylink' => $a->remove_baseurl($a->contact['url']),
'$mytitle' => t('This is you'), '$mytitle' => t('This is you'),
'$myphoto' => $a->remove_baseurl($a->contact['thumb']), '$myphoto' => $a->remove_baseurl($a->contact['thumb']),

View file

@ -67,7 +67,7 @@ class Thread extends BaseObject
$this->writable = can_write_wall($this->profile_owner) || $writable; $this->writable = can_write_wall($this->profile_owner) || $writable;
break; break;
case 'community': case 'community':
$this->profile_owner = local_user(); $this->profile_owner = 0;
$this->writable = $writable; $this->writable = $writable;
break; break;
default: default: