]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #6474 from tobiasd/2019.01-CHANGELOG
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Mon, 21 Jan 2019 08:40:39 +0000 (09:40 +0100)
committerGitHub <noreply@github.com>
Mon, 21 Jan 2019 08:40:39 +0000 (09:40 +0100)
CHANGELOG for 2019.01

mod/admin.php
src/App.php
src/Protocol/ActivityPub/Receiver.php
src/Protocol/ActivityPub/Transmitter.php
view/templates/photos_upload.tpl
view/theme/frio/templates/photos_upload.tpl
view/theme/frio/theme.php

index 1cbe24e71d989bad74988fcfb3059ba939c8c0da..9b8a054c423e4cb391d76aef7a08e7c35173f2bc 100644 (file)
@@ -33,6 +33,23 @@ use Friendica\Util\Network;
 use Friendica\Util\Strings;
 use Friendica\Util\Temporal;
 
+/**
+ * Sets the current theme for theme settings pages.
+ *
+ * This needs to be done before the post() or content() methods are called.
+ *
+ * @param App $a
+ */
+function admin_init(App $a)
+{
+       if ($a->argc > 2 && $a->argv[1] == 'themes') {
+               $theme = $a->argv[2];
+               if (is_file("view/theme/$theme/config.php")) {
+                       $a->setCurrentTheme($theme);
+               }
+       }
+}
+
 /**
  * @brief Process send data from the admin panels subpages
  *
@@ -89,15 +106,8 @@ function admin_post(App $a)
 
                                $theme = $a->argv[2];
                                if (is_file("view/theme/$theme/config.php")) {
-                                       $a->setCurrentTheme($theme);
-
-                                       require_once "view/theme/$theme/theme.php";
                                        require_once "view/theme/$theme/config.php";
 
-                                       $init = $theme . '_init';
-                                       if (function_exists($init)) {
-                                               $init($a);
-                                       }
                                        if (function_exists('theme_admin_post')) {
                                                theme_admin_post($a);
                                        }
@@ -2306,16 +2316,8 @@ function admin_page_themes(App $a)
 
                $admin_form = '';
                if (is_file("view/theme/$theme/config.php")) {
-                       $a->setCurrentTheme($theme);
-
-                       require_once "view/theme/$theme/theme.php";
                        require_once "view/theme/$theme/config.php";
 
-                       $init = $theme . "_init";
-                       if (function_exists($init)) {
-                               $init($a);
-                       }
-
                        if (function_exists('theme_admin')) {
                                $admin_form = theme_admin($a);
                        }
index 26c93b250029d9509168fbad703607775b92d083..c41cfdc6c0d4bf0bf7a5eed15b1a4f3009ad7c8d 100644 (file)
@@ -1720,13 +1720,7 @@ class App
 
                $content = '';
 
-               // Load current theme info after module has been executed as theme could have been set in module
-               $theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
-               if (file_exists($theme_info_file)) {
-                       require_once $theme_info_file;
-               }
-
-               // Call module functions
+               // Initialize module that can set the current theme in the init() method, either directly or via App->profile_uid
                if ($this->module_loaded) {
                        $this->page['page_title'] = $this->module;
                        $placeholder = '';
@@ -1740,12 +1734,20 @@ class App
                        if (!$this->error) {
                                call_user_func([$this->module_class, 'rawContent']);
                        }
+               }
 
-                       if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_init')) {
-                               $func = str_replace('-', '_', $this->getCurrentTheme()) . '_init';
-                               $func($this);
-                       }
+               // Load current theme info after module has been initialized as theme could have been set in module
+               $theme_info_file = 'view/theme/' . $this->getCurrentTheme() . '/theme.php';
+               if (file_exists($theme_info_file)) {
+                       require_once $theme_info_file;
+               }
 
+               if (function_exists(str_replace('-', '_', $this->getCurrentTheme()) . '_init')) {
+                       $func = str_replace('-', '_', $this->getCurrentTheme()) . '_init';
+                       $func($this);
+               }
+
+               if ($this->module_loaded) {
                        if (! $this->error && $_SERVER['REQUEST_METHOD'] === 'POST') {
                                Core\Addon::callHooks($this->module . '_mod_post', $_POST);
                                call_user_func([$this->module_class, 'post']);
index ac75155b20c6bccee5659eb6f1751e61e029231f..61e9f8e9c6d8374e88ffc2578d1f78b05529e720 100644 (file)
@@ -332,7 +332,10 @@ class Receiver
                        return;
                }
 
-               self::storeConversation($object_data, $body);
+               // Only store content related stuff - and no announces, since they possibly overwrite the original content
+               if (in_array($object_data['object_type'], self::CONTENT_TYPES) && ($type != 'as:Announce')) {
+                       self::storeConversation($object_data, $body);
+               }
 
                // Internal flag for thread completion. See Processor.php
                if (!empty($activity['thread-completion'])) {
index 05d0c458679b2550764469fd21bf3f807a75791e..89986f49239ba1451945e5c92f5d8bf49fd5d206 100644 (file)
@@ -307,6 +307,16 @@ class Transmitter
                        $last_id = $item['id'];
                }
 
+               $always_bcc = false;
+
+               // Check if we should always deliver our stuff via BCC
+               if (!empty($item['uid'])) {
+                       $profile = Profile::getByUID($item['uid']);
+                       if (!empty($profile)) {
+                               $always_bcc = $profile['hide-friends'];
+                       }
+               }
+
                // Will be activated in a later step
                // $networks = [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS];
 
@@ -349,11 +359,13 @@ class Transmitter
                        }
 
                        foreach ($receiver_list as $receiver) {
-                               $contact = DBA::selectFirst('contact', ['url'], ['id' => $receiver, 'network' => $networks]);
+                               $contact = DBA::selectFirst('contact', ['url', 'hidden'], ['id' => $receiver, 'network' => $networks]);
                                if (DBA::isResult($contact) && !empty($profile = APContact::getByURL($contact['url'], false))) {
-                                       // BCC is currently deactivated, due to Pleroma and Mastodon not reacting like expected
-                                       // $data['bcc'][] = $profile['url'];
-                                       $data['cc'][] = $profile['url'];
+                                       if ($contact['hidden'] || $always_bcc) {
+                                               $data['bcc'][] = $profile['url'];
+                                       } else {
+                                               $data['cc'][] = $profile['url'];
+                                       }
                                }
                        }
                }
@@ -536,7 +548,15 @@ class Transmitter
         */
        private static function getTypeOfItem($item)
        {
-               if (!empty(Diaspora::isReshare($item['body'], false))) {
+               $reshared = false;
+
+               // Only check for a reshare, if it is a real reshare and no quoted reshare
+               if (strpos($item['body'], "[share") === 0) {
+                       $announce = api_share_as_retweet($item);
+                       $reshared = !empty($announce['plink']);
+               }
+
+               if ($reshared) {
                        $type = 'Announce';
                } elseif ($item['verb'] == ACTIVITY_POST) {
                        if ($item['created'] == $item['edited']) {
@@ -735,7 +755,8 @@ class Transmitter
                $terms = Term::tagArrayFromItemId($item['id']);
                foreach ($terms as $term) {
                        if ($term['type'] == TERM_HASHTAG) {
-                               $tags[] = ['type' => 'Hashtag', 'href' => $term['url'], 'name' => '#' . $term['term']];
+                               $url = System::baseUrl() . '/search?tag=' . urlencode($term['term']);
+                               $tags[] = ['type' => 'Hashtag', 'href' => $url, 'name' => '#' . $term['term']];
                        } elseif ($term['type'] == TERM_MENTION) {
                                $contact = Contact::getDetailsByURL($term['url']);
                                if (!empty($contact['addr'])) {
@@ -1006,7 +1027,17 @@ class Transmitter
                        return self::createNote($item);
                }
 
-               return $announce['plink'];
+               // Fetch the original id of the object
+               $activity = ActivityPub::fetchContent($announce['plink'], $item['uid']);
+               if (!empty($activity)) {
+                       $ldactivity = JsonLD::compact($activity);
+                       $id = JsonLD::fetchElement($ldactivity, '@id');
+                       if (!empty($id)) {
+                               return $id;
+                       }
+               }
+
+               return self::createNote($item);
        }
 
        /**
index 9e606242ed81325bd9fa63eec4f592f39a641ad8..054fd1a335dc9c44146ba7ec5fb034de6b0bb42b 100644 (file)
@@ -14,7 +14,7 @@
        <div id="photos-upload-exist-wrapper">
                <div id="photos-upload-existing-album-text">{{$existalbumtext}}</div>
                <select id="photos-upload-album-select" name="album" size="4">
-               {{$albumselect}}
+               {{$albumselect  nofilter}}
                </select>
        </div>
        <div id="photos-upload-exist-end"></div>
index 81d0f967e29852cdb60d788e0cf5321cf0c8936c..e3bcd30692e42eb468f0efbf5587fb36180bb1be 100644 (file)
@@ -9,7 +9,7 @@
                        <label id="photos-upload-text" for="photos-upload-newalbum" >{{$newalbum}}</label>
 
                        <input id="photos-upload-album-select" class="form-control" placeholder="{{$existalbumtext}}" list="dl-photo-upload" type="text" name="album" size="4">
-                       <datalist id="dl-photo-upload">{{$albumselect}}</datalist>
+                       <datalist id="dl-photo-upload">{{$albumselect  nofilter}}</datalist>
                </div>
                <div id="photos-upload-end" class="clearfix"></div>
 
index 9019a26205349c1329a157474386ae4c23f6423c..9bae9053af09e7a7e8ba65433beedcafb3b65995 100644 (file)
@@ -22,26 +22,17 @@ use Friendica\Model;
 use Friendica\Module;
 use Friendica\Util\Strings;
 
-$frio = 'view/theme/frio';
-
-global $frio;
-
 function frio_init(App $a)
 {
+       global $frio;
+       $frio = 'view/theme/frio';
+
        // disable the events module link in the profile tab
        $a->theme_events_in_profile = false;
        $a->videowidth = 622;
 
        Renderer::setActiveTemplateEngine('smarty3');
 
-       $baseurl = System::baseUrl();
-
-       $style = PConfig::get(local_user(), 'frio', 'style');
-
-       $frio = 'view/theme/frio';
-
-       global $frio;
-
        // if the device is a mobile device set js is_mobile
        // variable so the js scripts can use this information
        if ($a->is_mobile || $a->is_tablet) {
@@ -51,10 +42,6 @@ function frio_init(App $a)
                        </script>
 EOT;
        }
-
-       if ($style == '') {
-               $style = Config::get('frio', 'style');
-       }
 }
 
 function frio_install()