]> git.mxchange.org Git - friendica.git/commitdiff
death to comment box oddities (a slow death as it will take some time for everybody...
authorFriendika <info@friendika.com>
Tue, 12 Apr 2011 03:11:21 +0000 (20:11 -0700)
committerFriendika <info@friendika.com>
Tue, 12 Apr 2011 03:11:21 +0000 (20:11 -0700)
boot.php
include/conversation.php
include/items.php
mod/follow.php
update.php

index 7b68505925051f10673e0d8ac07a489e0672570b..f04b8c3947671d6e22de2942a48d362adb1406af 100644 (file)
--- a/boot.php
+++ b/boot.php
@@ -4,7 +4,7 @@ set_time_limit(0);
 
 define ( 'FRIENDIKA_VERSION',      '2.1.946' );
 define ( 'DFRN_PROTOCOL_VERSION',  '2.21'    );
-define ( 'DB_UPDATE_VERSION',      1048      );
+define ( 'DB_UPDATE_VERSION',      1049      );
 
 define ( 'EOL',                    "<br />\r\n"     );
 define ( 'ATOM_TIME',              'Y-m-d\TH:i:s\Z' );
index 3f8ea419651c9f794459ca8458edd2f07b6b4ef7..d81142bca568d7ce468427c42b22d41b3fd43893 100644 (file)
@@ -6,21 +6,21 @@ function conversation(&$a, $items, $mode, $update) {
        require_once('bbcode.php');
 
        $profile_owner = 0;
-       $writable      = false;
+       $page_writeable      = false;
 
        if($mode === 'network') {
                $profile_owner = local_user();
-               $writable = true;
+               $page_writeable = true;
        }
 
        if($mode === 'profile') {
                $profile_owner = $a->profile['profile_uid'];
-               $writable = can_write_wall($a,$profile_owner);
+               $page_writeable = can_write_wall($a,$profile_owner);
        }
 
        if($mode === 'display') {
                $profile_owner = $a->profile['uid'];
-               $writable = can_write_wall($a,$profile_owner);
+               $page_writeable = can_write_wall($a,$profile_owner);
        }
 
        if($update)
@@ -177,7 +177,6 @@ function conversation(&$a, $items, $mode, $update) {
                        $sparkle = '';
                        $owner_url = $owner_photo = $owner_name = '';
 
-
                        // We've already parsed out like/dislike for special treatment. We can ignore them now
 
                        if(((activity_match($item['verb'],ACTIVITY_LIKE)) 
@@ -185,11 +184,17 @@ function conversation(&$a, $items, $mode, $update) {
                                && ($item['id'] != $item['parent']))
                                continue;
 
+                       $toplevelpost = (($item['id'] == $item['parent']) ? true : false);
+
+
                        // Take care of author collapsing and comment collapsing
                        // If a single author has more than 3 consecutive top-level posts, squash the remaining ones.
                        // If there are more than two comments, squash all but the last 2.
 
-                       if($item['id'] == $item['parent']) {
+                       if($toplevelpost) {
+
+                               $item_writeable = (($item['writable'] || $item['self']) ? true : false);
+
                                if($blowhard == $item['cid'] && (! $item['self']) && ($mode != 'profile')) {
                                        $blowhard_count ++;
                                        if($blowhard_count == 3) {
@@ -210,6 +215,8 @@ function conversation(&$a, $items, $mode, $update) {
                                $comments_seen ++;
 
 
+                       $show_comment_box = ((($page_writeable) && ($item_writeable) && ($comments_seen == $comments[$item['parent']])) ? true : false);
+
                        if(($comments[$item['parent']] > 2) && ($comments_seen <= ($comments[$item['parent']] - 2)) && ($item['gravity'] == 6)) {
                                if(! $comments_collapsed) {
                                        $o .= '<div class="ccollapse-wrapper fakelink" id="ccollapse-wrapper-' . $item['parent'] . '" onclick="openClose(' . '\'ccollapse-' . $item['parent'] . '\');" >' . sprintf( t('See all %d comments'), $comments[$item['parent']]) . '</div>';
@@ -265,7 +272,7 @@ function conversation(&$a, $items, $mode, $update) {
 
                        $likebuttons = '';
 
-                       if($writable) {
+                       if($page_writeable) {
                                if($item['id'] == $item['parent']) {
                                        $likebuttons = replace_macros((($item['private']) ? $noshare_tpl : $like_tpl),array(
                                                '$id' => $item['id'],
@@ -276,7 +283,7 @@ function conversation(&$a, $items, $mode, $update) {
                                        ));
                                }
 
-                               if($item['last-child']) {
+                               if(($show_comment_box) || (($show_comment_box == false) && ($item['last-child']))) {
                                        $comment = replace_macros($cmnt_tpl,array(
                                                '$return_path' => '', 
                                                '$jsreload' => (($mode === 'display') ? $_SESSION['return_url'] : ''),
index d7644fb421cb315523ead3db28b40005d0eb4e21..86579512eb8d33ffa27c5792f23bd42ff63fe29a 100644 (file)
@@ -1367,8 +1367,8 @@ function new_follower($importer,$contact,$datarray,$item) {
                // create contact record - set to readonly
 
                $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `name`, `nick`, `photo`, `network`, `rel`, 
-                       `blocked`, `readonly`, `pending` )
-                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1 ) ",
+                       `blocked`, `readonly`, `pending`, `writable` )
+                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', %d, 0, 1, 1, 1 ) ",
                        intval($importer['uid']),
                        dbesc(datetime_convert()),
                        dbesc($url),
index f30ecdc92132f71f14366b5389dc3839d78ad536..04858ce52d3406ae74676788fc7447f914b01987 100644 (file)
@@ -195,6 +195,9 @@ function follow_post(&$a) {
        if(! x($vcard,'photo'))
                $vcard['photo'] = $a->get_baseurl() . '/images/default-profile.jpg' ; 
 
+
+       $writeable = ((($network === 'stat') && ($notify)) ? 1 : 0);
+
        // check if we already have a contact
        // the poll url is more reliable than the profile url, as we may have
        // indirect links or webfinger links
@@ -217,8 +220,8 @@ function follow_post(&$a) {
        else {
                // create contact record 
                $r = q("INSERT INTO `contact` ( `uid`, `created`, `url`, `alias`, `notify`, `poll`, `name`, `nick`, `photo`, `network`, `rel`, `priority`,
-                       `blocked`, `readonly`, `pending` )
-                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, 0, 0, 0 ) ",
+                       `writable`, `blocked`, `readonly`, `pending` )
+                       VALUES ( %d, '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', '%s', %d, %d, %d, 0, 0, 0 ) ",
                        intval(local_user()),
                        dbesc(datetime_convert()),
                        dbesc($profile),
@@ -230,7 +233,8 @@ function follow_post(&$a) {
                        dbesc($vcard['photo']),
                        dbesc($network),
                        intval(REL_FAN),
-                       intval($priority)
+                       intval($priority),
+                       intval($writable)
                );
        }
 
index 1d45f5f11aca38a707f30746ec07e9a18801c315..3875933d27f8cf9b0117d65d15a5ba9130883b77 100644 (file)
@@ -428,3 +428,7 @@ function update_1047() {
        q("ALTER TABLE `contact` ADD `writable` TINYINT( 1 ) NOT NULL DEFAULT '0' AFTER `readonly` ");
 }
 
+function update_1048() {
+       q("UPDATE `contact` SET `writable` = 1 WHERE `network` = 'stat' AND `notify` != '' ");
+}
+