]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #7339 from annando/gcontact-update
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 7 Jul 2019 17:28:20 +0000 (13:28 -0400)
committerGitHub <noreply@github.com>
Sun, 7 Jul 2019 17:28:20 +0000 (13:28 -0400)
Restructured Contact/GContact handling

mod/photos.php
src/Console/GlobalCommunitySilence.php
view/theme/frio/img/none.png [new file with mode: 0644]
view/theme/frio/style.php
view/theme/frio/templates/admin/blocklist/contact.tpl

index b904abe311da1f428c22182dd36b89b6a6033430..8b8402847fea7f18eacbe25850ebbad4af1891e2 100644 (file)
@@ -1320,6 +1320,7 @@ function photos_content(App $a)
 
                if (DBA::isResult($linked_items)) {
                        // This is a workaround to not being forced to rewrite the while $sql_extra handling
+                       // @TODO: On old photo items without a matching thread record, this sets $link_item to false
                        $link_item = Item::selectFirst([], ['id' => $linked_items[0]['id']]);
 
                        $condition = ["`parent` = ? AND `parent` != `id`",  $link_item['parent']];
@@ -1538,7 +1539,7 @@ function photos_content(App $a)
                        }
                        $response_verbs = ['like'];
                        $response_verbs[] = 'dislike';
-                       $responses = get_responses($conv_responses, $response_verbs, $link_item);
+                       $responses = get_responses($conv_responses, $response_verbs, $link_item ?: []);
 
                        $paginate = $pager->renderFull($total);
                }
index daaf55149979f7098cd962326883f1e1c1396873..466c1adf5ae7925848b6928288d803ce861d1940 100644 (file)
@@ -2,10 +2,9 @@
 
 namespace Friendica\Console;
 
-use Friendica\Core\Protocol;
+use Friendica\BaseObject;
 use Friendica\Database\DBA;
-use Friendica\Network\Probe;
-use Friendica\Util\Strings;
+use Friendica\Model\Contact;
 use RuntimeException;
 
 /**
@@ -47,8 +46,6 @@ HELP;
 
        protected function doExecute()
        {
-               $a = \get_app();
-
                if ($this->getOption('v')) {
                        $this->out('Class: ' . __CLASS__);
                        $this->out('Arguments: ' . var_export($this->args, true));
@@ -64,27 +61,16 @@ HELP;
                        throw new \Asika\SimpleConsole\CommandArgsException('Too many arguments');
                }
 
-               if ($a->getMode()->isInstall()) {
+               if (BaseObject::getApp()->getMode()->isInstall()) {
                        throw new RuntimeException('Database isn\'t ready or populated yet');
                }
 
-               /**
-                * 1. make nurl from last parameter
-                * 2. check DB (contact) if there is a contact with uid=0 and that nurl, get the ID
-                * 3. set the flag hidden=1 for the contact entry with the found ID
-                * */
-               $net = Probe::uri($this->getArgument(0));
-               if (in_array($net['network'], [Protocol::PHANTOM, Protocol::MAIL])) {
-                       throw new RuntimeException('This account seems not to exist.');
-               }
-
-               $nurl = Strings::normaliseLink($net['url']);
-               $contact = DBA::selectFirst("contact", ["id"], ["nurl" => $nurl, "uid" => 0]);
-               if (DBA::isResult($contact)) {
-                       DBA::update("contact", ["hidden" => true], ["id" => $contact["id"]]);
-                       $this->out('NOTICE: The account should be silenced from the global community page');
+               $contact_id = Contact::getIdForURL($this->getArgument(0));
+               if ($contact_id) {
+                       DBA::update('contact', ['hidden' => true], ['id' => $contact_id]);
+                       $this->out('The account has been successfully silenced from the global community page.');
                } else {
-                       throw new RuntimeException('NOTICE: Could not find any entry for this URL (' . $nurl . ')');
+                       throw new RuntimeException('Could not find any public contact entry for this URL (' . $this->getArgument(0) . ')');
                }
 
                return 0;
diff --git a/view/theme/frio/img/none.png b/view/theme/frio/img/none.png
new file mode 100644 (file)
index 0000000..c8375db
Binary files /dev/null and b/view/theme/frio/img/none.png differ
index 6a8aaf2c2819fcd06e1e292573c4b1934b421be1..d6336ae3ddcada84ac6056ddf4d1e77dc4849285 100644 (file)
@@ -101,7 +101,7 @@ $nav_icon_color   = (empty($nav_icon_color)   ? '#fff'         : $nav_icon_color
 $link_color       = (empty($link_color)       ? '#6fdbe8'      : $link_color);
 $background_color = (empty($background_color) ? '#ededed'      : $background_color);
 // The background image can not be empty. So we use a dummy jpg if no image was set.
-$background_image = (empty($background_image) ? 'img/none.jpg' : $background_image);
+$background_image = (empty($background_image) ? 'img/none.png' : $background_image);
 $modified         = (empty($modified)         ? time()         : $modified);
 
 
index 1f43b412b786c613bdabea15cf880c136f262252..59f02dba56ebb34c5385990f0adf38493fee9ad0 100644 (file)
@@ -37,7 +37,7 @@
                        <div class="section-subtitle-wrapper" role="tab" id="admin-settings-contactblock-blocked">
                                <h4>
                                        <a class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#admin-settings" href="#admin-settings-contactblock-blocked-collapse" aria-expanded="{{if count($contacts) > 0}}true{{else}}false{{/if}}" aria-controls="admin-settings-contactblock-blocked-collapse">
-                                               {{$h_contacts}} ({{count($contacts)}})
+                                               {{$h_contacts}} ({{$total_contacts}})
                                        </a>
                                </h4>
                        </div>