Просмотр исходного кода

Ticket #4861 - Timeline: Add possibility to include Public posts in For You feed.

AntonLV 1 год назад
Родитель
Сommit
fa333330e8

+ 1 - 0
modules/boonex/russian/data/langs/bx_timeline/ru.xml

@@ -80,6 +80,7 @@
     <string name="_bx_timeline_option_extenals_every_feed_and_hot_preload"><![CDATA[Показывать внешнее событие как каждое N-е в ленте 'Для тебя' при включенной 'Бесконечной прокрутке']]></string>
     <string name="_bx_timeline_option_for_you_sources"><![CDATA[Лента 'Для Вас' состоит из]]></string>
     <string name="_bx_timeline_option_for_you_sources_err"><![CDATA[Для фида должен быть включен хотя бы один источник.]]></string>
+    <string name="_bx_timeline_option_for_you_sources_public"><![CDATA[Публичная лента]]></string>
     <string name="_bx_timeline_option_for_you_sources_feed"><![CDATA[Лента контекст (профиль) + подписки]]></string>
     <string name="_bx_timeline_option_for_you_sources_channels"><![CDATA[Каналы]]></string>
     <string name="_bx_timeline_option_for_you_sources_hot"><![CDATA['Горячая' хроника]]></string>

+ 2 - 0
modules/boonex/timeline/classes/BxTimelineConfig.php

@@ -229,6 +229,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
                 'option_hfs_content' => '_bx_timeline_option_hot_sources_content',
                 'option_hfs_comment' => '_bx_timeline_option_hot_sources_comment',
                 'option_hfs_vote' => '_bx_timeline_option_hot_sources_vote',
+                'option_fyfs_public' => '_bx_timeline_option_for_you_sources_public',
                 'option_fyfs_feed' => '_bx_timeline_option_for_you_sources_feed',
                 'option_fyfs_channels' => '_bx_timeline_option_for_you_sources_channels',
                 'option_fyfs_hot' => '_bx_timeline_option_for_you_sources_hot',
@@ -434,6 +435,7 @@ class BxTimelineConfig extends BxBaseModNotificationsConfig
         ];
 
         $this->_aForYouSourcesList = [
+            BX_TIMELINE_FYFS_PUBLIC,
             BX_TIMELINE_FYFS_FEED,
             BX_TIMELINE_TYPE_CHANNELS,
             BX_TIMELINE_FYFS_HOT,

+ 10 - 0
modules/boonex/timeline/classes/BxTimelineDb.php

@@ -1328,6 +1328,16 @@ class BxTimelineDb extends BxBaseModNotificationsDb
                         $mixedWhereSubclause['p8'] = "`{$sTableAlias}`.`owner_id` IN (" . $this->implode_escape(array_keys($aList)) . ")";
                     }
                 }
+
+                //--- 'For You' feed only: Public
+                if($bForYou && in_array(BX_TIMELINE_FYFS_PUBLIC, $aForYouSources)) {
+                    //--- Select All System posts
+                    $sWhereSubclause = "`{$sTableAlias}`.`system`='1'";
+                    //--- Select Public (Direct) posts created on Home Page Timeline (Public Feed) 
+                    $sWhereSubclause .= $this->prepareAsString(" OR `{$sTableAlias}`.`owner_id`=?", 0);
+
+                    $mixedWhereSubclause['p9'] = "(" . $sWhereSubclause . ")";
+                }
                 break;
 
             //--- Feed: Profile + All Profile Connections

+ 1 - 0
modules/boonex/timeline/classes/BxTimelineModule.php

@@ -77,6 +77,7 @@ define('BX_TIMELINE_HFS_COMMENT', 'comment');
 define('BX_TIMELINE_HFS_VOTE', 'vote');
 
 //--- For You Feed sources
+define('BX_TIMELINE_FYFS_PUBLIC', 'public');
 define('BX_TIMELINE_FYFS_FEED', 'feed');
 define('BX_TIMELINE_FYFS_CHANNELS', 'channels');
 define('BX_TIMELINE_FYFS_HOT', 'hot');

+ 1 - 0
modules/boonex/timeline/install/langs/en.xml

@@ -80,6 +80,7 @@
     <string name="_bx_timeline_option_extenals_every_feed_and_hot_preload"><![CDATA[Show external event as every N-th in 'For You' timeline with Infinite Scroll enabled]]></string>
     <string name="_bx_timeline_option_for_you_sources"><![CDATA['For You' feed consists of]]></string>
     <string name="_bx_timeline_option_for_you_sources_err"><![CDATA[At least one source should be enabled for the feed.]]></string>
+    <string name="_bx_timeline_option_for_you_sources_public"><![CDATA[Public]]></string>
     <string name="_bx_timeline_option_for_you_sources_feed"><![CDATA[Feed]]></string>
     <string name="_bx_timeline_option_for_you_sources_channels"><![CDATA[Channels]]></string>
     <string name="_bx_timeline_option_for_you_sources_hot"><![CDATA[Hot feed]]></string>

+ 1 - 1
modules/boonex/timeline/install/sql/enable.sql

@@ -397,7 +397,7 @@ VALUES (@iTypeId, 'bx_timeline_feed_for_you', '_bx_timeline_options_category_fee
 SET @iCategId = LAST_INSERT_ID();
 
 INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `check`, `check_params`, `check_error`, `extra`, `order`) VALUES
-('bx_timeline_for_you_sources', 'feed,channels,hot,recom_friends,recom_subscriptions', @iCategId, '_bx_timeline_option_for_you_sources', 'list', 'Avail', '', '_bx_timeline_option_for_you_sources_err', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:29:"get_for_you_sources_checklist";}', 1),
+('bx_timeline_for_you_sources', 'public,feed,channels,hot,recom_friends,recom_subscriptions', @iCategId, '_bx_timeline_option_for_you_sources', 'list', 'Avail', '', '_bx_timeline_option_for_you_sources_err', 'a:2:{s:6:"module";s:11:"bx_timeline";s:6:"method";s:29:"get_for_you_sources_checklist";}', 1),
 ('bx_timeline_for_you_threshold_recom_friends', '1', @iCategId, '_bx_timeline_option_for_you_threshold_recom_friends', 'digit', '', '', '', '', 10),
 ('bx_timeline_for_you_threshold_recom_subscriptions', '1', @iCategId, '_bx_timeline_option_for_you_threshold_recom_subscriptions', 'digit', '', '', '', '', 11);