]> git.mxchange.org Git - friendica.git/commitdiff
Best "uid" for sending comments, refresh after commenting might work now
authorMichael <heluecht@pirati.ca>
Sun, 7 Jan 2018 17:14:43 +0000 (17:14 +0000)
committerMichael <heluecht@pirati.ca>
Sun, 7 Jan 2018 17:14:43 +0000 (17:14 +0000)
boot.php
database.sql
mod/community.php
src/Database/DBStructure.php
src/Object/Post.php
src/Object/Thread.php

index 5607260d9749114051b748a490fa96b0d17d2c0e..e47665f94d072bc9772b9c01ace9b82d928cd46f 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -43,7 +43,7 @@ define('FRIENDICA_PLATFORM',     'Friendica');
 define('FRIENDICA_CODENAME',     'Asparagus');
 define('FRIENDICA_VERSION',      '3.6-dev');
 define('DFRN_PROTOCOL_VERSION',  '2.23');
-define('DB_UPDATE_VERSION',      1238);
+define('DB_UPDATE_VERSION',      1239);
 define('NEW_UPDATE_ROUTINE_VERSION', 1170);
 
 /**
index a8c12f272b41805c1cae49008618ac1538fc4f1a..48c2e7ecee354d1a6f561e99314cbb585cf20efe 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- 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_commented` (`uid`,`commented`),
         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;
 
 --
index 7c480d259e3aefd05b901aba803d471f9fa88df7..4b755e18ce6ebc58eb5b09b210029175e53b9c64 100644 (file)
@@ -190,14 +190,14 @@ function community_getitems($start, $itemspage, $content)
                        item_joins() . " AND `contact`.`self`
                        WHERE `thread`.`visible` AND NOT `thread`.`deleted` AND NOT `thread`.`moderated`
                        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);
        } elseif ($content == 'global') {
                $r = dba::p("SELECT " . item_fieldlists() . " FROM `thread`
                        INNER JOIN `item` ON `item`.`id` = `thread`.`iid` " . item_joins() .
                                "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
                );
                return dba::inArray($r);
index c7bdeabe3dcab833dcf98451e0550c8704d8346e..b33f02345081c8b7a527f557c643f7ea864bcdb8 100644 (file)
@@ -1601,7 +1601,7 @@ class DBStructure {
                                                "uid_created" => array("uid","created"),
                                                "uid_commented" => array("uid","commented"),
                                                "uid_wall_created" => array("uid","wall","created"),
-                                               "private_wall_received" => array("private","wall","received"),
+                                               "private_wall_commented" => array("private","wall","commented"),
                                                )
                                );
                $database["tokens"] = array(
index b0d44256387a5d36e0e99fbb74a204b1620d4300..97768bf56cd79c663d821e3f49da7c1ea89623cb 100644 (file)
@@ -765,6 +765,14 @@ class Post extends BaseObject
                                $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());
                        $comment_box = replace_macros($template, array(
                                '$return_path' => $a->query_string,
@@ -774,7 +782,7 @@ class Post extends BaseObject
                                '$id'          => $this->getId(),
                                '$parent'      => $this->getId(),
                                '$qcomment'    => $qcomment,
-                               '$profile_uid' => $conv->getProfileOwner(),
+                               '$profile_uid' => $uid,
                                '$mylink'      => $a->remove_baseurl($a->contact['url']),
                                '$mytitle'     => t('This is you'),
                                '$myphoto'     => $a->remove_baseurl($a->contact['thumb']),
index 534095efbb3a745cb9773bca013c7ee310016d6a..cf1ddceac25253a636b8ff309df04e025bcfe6a0 100644 (file)
@@ -67,7 +67,7 @@ class Thread extends BaseObject
                                $this->writable = can_write_wall($this->profile_owner) || $writable;
                                break;
                        case 'community':
-                               $this->profile_owner = local_user();
+                               $this->profile_owner = 0;
                                $this->writable = $writable;
                                break;
                        default: