]> git.mxchange.org Git - friendica.git/commitdiff
Merge pull request #6163 from hoergen/socke
authorTobias Diekershoff <tobias.diekershoff@gmx.net>
Sun, 18 Nov 2018 13:11:40 +0000 (14:11 +0100)
committerGitHub <noreply@github.com>
Sun, 18 Nov 2018 13:11:40 +0000 (14:11 +0100)
[Doc] Rearranged and wrote some parts new and more coherent.

include/items.php
src/Content/ContactSelector.php
src/Content/Feature.php
src/Content/Widget.php
src/Protocol/OStatus.php

index 87f0a2d4e0e005fcba459cc2ab9408be6e2b1e45..b9e1a0c9944d97f2b2d9094b8e67dc414a5b1263 100644 (file)
@@ -352,7 +352,7 @@ function drop_item($id, $return = '')
 
        // locate item to be deleted
 
-       $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity'];
+       $fields = ['id', 'uid', 'guid', 'contact-id', 'deleted', 'gravity', parent];
        $item = Item::selectFirstForUser(local_user(), $fields, ['id' => $id]);
 
        if (!DBA::isResult($item)) {
@@ -408,6 +408,11 @@ function drop_item($id, $return = '')
                }
 
                $is_comment = ($item['gravity'] == GRAVITY_COMMENT) ? true : false;
+               $parentitem = null;
+               if (!empty($item['parent'])){
+                       $fields = ['guid'];
+                       $parentitem = Item::selectFirstForUser(local_user(), $fields, ['id' => $item['parent']]);
+               }
 
                // delete the item
                Item::deleteForUser(['id' => $item['id']], local_user());
@@ -417,14 +422,28 @@ function drop_item($id, $return = '')
                // removes update_* from return_url to ignore Ajax refresh
                $return_url = str_replace("update_", "", $return_url);
 
-               // if unknown location or top level post called from display
-               if (empty($return_url) || ((strpos($return_url, 'display') !== false) AND (!$is_comment))) {
-                       $a->internalRedirect('network');
-                       //NOTREACHED
+               // Check if delete a comment
+               if ($is_comment) {
+                       // Return to parent guid
+                       if (!empty($parentitem)) {
+                               $a->internalRedirect('display/' . $parentitem['guid']);
+                               //NOTREACHED
+                       }
+                       // In case something goes wrong
+                       else {
+                               $a->internalRedirect('network');
+                               //NOTREACHED
+                       }
                }
                else {
-                       $a->internalRedirect($return_url);
-                       //NOTREACHED
+                       // if unknown location or deleting top level post called from display
+                       if (empty($return_url) || strpos($return_url, 'display') !== false) {
+                               $a->internalRedirect('network');
+                               //NOTREACHED
+                       } else {
+                               $a->internalRedirect($return_url);
+                               //NOTREACHED
+                       }
                }
        } else {
                notice(L10n::t('Permission denied.') . EOL);
index a23acecc553097aee9f17ca6d217f6f36f65b34a..5ba6528ed0561b6ebd1bc70759dcbcf4dcb6d3ab 100644 (file)
@@ -78,7 +78,7 @@ class ContactSelector
        public static function networkToName($network, $profile = "")
        {
                $nets = [
-                       Protocol::DFRN      =>   L10n::t('Friendica'),
+                       Protocol::DFRN      =>   L10n::t('DFRN'),
                        Protocol::OSTATUS   =>   L10n::t('OStatus'),
                        Protocol::FEED      =>   L10n::t('RSS/Atom'),
                        Protocol::MAIL      =>   L10n::t('Email'),
index fe961db7d346bd0d0c4f6e0f5a5dde9cc15c9e3b..f6d64803454950d290043de4fbdecc30389eff34 100644 (file)
@@ -96,7 +96,7 @@ class Feature
                                ['archives',         L10n::t('Archives'), L10n::t('Ability to select posts by date ranges'), false, Config::get('feature_lock', 'archives', false)],
                                ['forumlist_widget', L10n::t('List Forums'),    L10n::t('Enable widget to display the forums your are connected with'), true, Config::get('feature_lock', 'forumlist_widget', false)],
                                ['groups',           L10n::t('Group Filter'),   L10n::t('Enable widget to display Network posts only from selected group'), false, Config::get('feature_lock', 'groups', false)],
-                               ['networks',         L10n::t('Network Filter'), L10n::t('Enable widget to display Network posts only from selected network'), false, Config::get('feature_lock', 'networks', false)],
+                               ['networks',         L10n::t('Protocol Filter'), L10n::t('Enable widget to display Network posts only from selected protocols'), false, Config::get('feature_lock', 'networks', false)],
                                ['savedsearch',      L10n::t('Saved Searches'), L10n::t('Save search terms for re-use'), false, Config::get('feature_lock', 'savedsearch', false)],
                        ],
 
index 0ea539dec0d36740fceea9bc8e751ce42694e71d..ab9bb8882893f148868b490363c36eadc1ef8a3c 100644 (file)
@@ -155,10 +155,10 @@ class Widget
                }
 
                return Renderer::replaceMacros(Renderer::getMarkupTemplate('nets.tpl'), array(
-                       '$title' => L10n::t('Networks'),
+                       '$title' => L10n::t('Protocols'),
                        '$desc' => '',
                        '$sel_all' => (($selected == '') ? 'selected' : ''),
-                       '$all' => L10n::t('All Networks'),
+                       '$all' => L10n::t('All Protocols'),
                        '$nets' => $nets,
                        '$base' => $baseurl,
                ));
index 5f5066d75c3bc7489151a6fe9aea091796c14163..875880a936354640862bade57570770af2329f55 100644 (file)
@@ -1263,10 +1263,11 @@ class OStatus
         * @param object $doc    XML document
         * @param array  $owner  Contact data of the poster
         * @param string $filter The related feed filter (activity, posts or comments)
+        * @param bool   $feed_mode Behave like a regular feed for users if true
         *
         * @return object header root element
         */
-       private static function addHeader(DOMDocument $doc, array $owner, $filter)
+       private static function addHeader(DOMDocument $doc, array $owner, $filter, $feed_mode = false)
        {
                $a = get_app();
 
@@ -1283,10 +1284,23 @@ class OStatus
                $root->setAttribute("xmlns:mastodon", NAMESPACE_MASTODON);
 
                $title = '';
+               $selfUri = '/feed/' . $owner["nick"] . '/';
                switch ($filter) {
-                       case 'activity': $title = L10n::t('%s\'s timeline', $owner['name']); break;
-                       case 'posts'   : $title = L10n::t('%s\'s posts'   , $owner['name']); break;
-                       case 'comments': $title = L10n::t('%s\'s comments', $owner['name']); break;
+                       case 'activity':
+                               $title = L10n::t('%s\'s timeline', $owner['name']);
+                               $selfUri .= $filter;
+                               break;
+                       case 'posts':
+                               $title = L10n::t('%s\'s posts', $owner['name']);
+                               break;
+                       case 'comments':
+                               $title = L10n::t('%s\'s comments', $owner['name']);
+                               $selfUri .= $filter;
+                               break;
+               }
+
+               if (!$feed_mode) {
+                       $selfUri = "/dfrn_poll/" . $owner["nick"];
                }
 
                $attributes = ["uri" => "https://friendi.ca", "version" => FRIENDICA_VERSION . "-" . DB_UPDATE_VERSION];
@@ -1320,8 +1334,7 @@ class OStatus
                $attributes = ["href" => System::baseUrl() . "/salmon/" . $owner["nick"], "rel" => "http://salmon-protocol.org/ns/salmon-mention"];
                XML::addElement($doc, $root, "link", "", $attributes);
 
-               $attributes = ["href" => System::baseUrl() . "/dfrn_poll/" . $owner["nick"],
-                       "rel" => "self", "type" => "application/atom+xml"];
+               $attributes = ["href" => System::baseUrl() . $selfUri, "rel" => "self", "type" => "application/atom+xml"];
                XML::addElement($doc, $root, "link", "", $attributes);
 
                if ($owner['account-type'] == Contact::ACCOUNT_TYPE_COMMUNITY) {
@@ -2206,7 +2219,7 @@ class OStatus
                $doc = new DOMDocument('1.0', 'utf-8');
                $doc->formatOutput = true;
 
-               $root = self::addHeader($doc, $owner, $filter);
+               $root = self::addHeader($doc, $owner, $filter, $feed_mode);
 
                foreach ($items as $item) {
                        if (Config::get('system', 'ostatus_debug')) {