mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update HomeFeedPipeline, observe mutes/blocks during fanout
This commit is contained in:
parent
fe9b4c5a37
commit
8548294c7a
4 changed files with 54 additions and 5 deletions
|
@ -69,7 +69,7 @@ class FeedFollowPipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|||
$actorId = $this->actorId;
|
||||
$followingId = $this->followingId;
|
||||
|
||||
$minId = SnowflakeService::byDate(now()->subMonths(6));
|
||||
$minId = SnowflakeService::byDate(now()->subWeeks(6));
|
||||
|
||||
$ids = Status::where('id', '>', $minId)
|
||||
->where('profile_id', $followingId)
|
||||
|
|
|
@ -10,8 +10,10 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||
use App\UserFilter;
|
||||
use App\Services\FollowerService;
|
||||
use App\Services\HomeTimelineService;
|
||||
use App\Services\StatusService;
|
||||
|
||||
class FeedInsertPipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||
{
|
||||
|
@ -64,11 +66,32 @@ class FeedInsertPipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
|||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$ids = FollowerService::localFollowerIds($this->pid);
|
||||
$sid = $this->sid;
|
||||
$status = StatusService::get($sid, false);
|
||||
|
||||
if(!$status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!in_array($status['pf_type'], ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
HomeTimelineService::add($this->pid, $this->sid);
|
||||
|
||||
|
||||
$ids = FollowerService::localFollowerIds($this->pid);
|
||||
|
||||
if(!$ids || !count($ids)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$skipIds = UserFilter::whereFilterableType('App\Profile')->whereFilterableId($status['account']['id'])->whereIn('filter_type', ['mute', 'block'])->pluck('user_id')->toArray();
|
||||
|
||||
foreach($ids as $id) {
|
||||
HomeTimelineService::add($id, $this->sid);
|
||||
if(!in_array($id, $skipIds)) {
|
||||
HomeTimelineService::add($id, $this->sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,8 +10,10 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||
use App\UserFilter;
|
||||
use App\Services\FollowerService;
|
||||
use App\Services\HomeTimelineService;
|
||||
use App\Services\StatusService;
|
||||
|
||||
class FeedInsertRemotePipeline implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||
{
|
||||
|
@ -64,10 +66,29 @@ class FeedInsertRemotePipeline implements ShouldQueue, ShouldBeUniqueUntilProces
|
|||
*/
|
||||
public function handle(): void
|
||||
{
|
||||
$sid = $this->sid;
|
||||
$status = StatusService::get($sid, false);
|
||||
|
||||
if(!$status) {
|
||||
return;
|
||||
}
|
||||
|
||||
if(!in_array($status['pf_type'], ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$ids = FollowerService::localFollowerIds($this->pid);
|
||||
|
||||
if(!$ids || !count($ids)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$skipIds = UserFilter::whereFilterableType('App\Profile')->whereFilterableId($status['account']['id'])->whereIn('filter_type', ['mute', 'block'])->pluck('user_id')->toArray();
|
||||
|
||||
foreach($ids as $id) {
|
||||
HomeTimelineService::add($id, $this->sid);
|
||||
if(!in_array($id, $skipIds)) {
|
||||
HomeTimelineService::add($id, $this->sid);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ use Illuminate\Queue\InteractsWithQueue;
|
|||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Hashtag;
|
||||
use App\StatusHashtag;
|
||||
use App\UserFilter;
|
||||
use App\Services\HashtagFollowService;
|
||||
use App\Services\HomeTimelineService;
|
||||
use App\Services\StatusService;
|
||||
|
@ -84,6 +85,8 @@ class HashtagInsertFanoutPipeline implements ShouldQueue, ShouldBeUniqueUntilPro
|
|||
return;
|
||||
}
|
||||
|
||||
$skipIds = UserFilter::whereFilterableType('App\Profile')->whereFilterableId($status['account']['id'])->whereIn('filter_type', ['mute', 'block'])->pluck('user_id')->toArray();
|
||||
|
||||
$ids = HashtagFollowService::getPidByHid($hashtag->hashtag_id);
|
||||
|
||||
if(!$ids || !count($ids)) {
|
||||
|
@ -91,7 +94,9 @@ class HashtagInsertFanoutPipeline implements ShouldQueue, ShouldBeUniqueUntilPro
|
|||
}
|
||||
|
||||
foreach($ids as $id) {
|
||||
HomeTimelineService::add($id, $hashtag->status_id);
|
||||
if(!in_array($id, $skipIds)) {
|
||||
HomeTimelineService::add($id, $hashtag->status_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue