mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update HomeFeedPipeline, fix tag filtering
This commit is contained in:
parent
e5401f8558
commit
f105f4e8f6
6 changed files with 267 additions and 242 deletions
|
@ -1,8 +1,8 @@
|
|||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
indent_style = tab
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
|
|
|
@ -12,6 +12,7 @@ use App\Hashtag;
|
|||
use App\StatusHashtag;
|
||||
use App\Services\HashtagFollowService;
|
||||
use App\Services\HomeTimelineService;
|
||||
use App\Services\StatusService;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||
|
||||
|
@ -72,6 +73,16 @@ class HashtagInsertFanoutPipeline implements ShouldQueue, ShouldBeUniqueUntilPro
|
|||
public function handle(): void
|
||||
{
|
||||
$hashtag = $this->hashtag;
|
||||
$sid = $hashtag->status_id;
|
||||
$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 = HashtagFollowService::getPidByHid($hashtag->hashtag_id);
|
||||
|
||||
|
|
|
@ -12,6 +12,7 @@ use App\Hashtag;
|
|||
use App\StatusHashtag;
|
||||
use App\Services\HashtagFollowService;
|
||||
use App\Services\HomeTimelineService;
|
||||
use App\Services\StatusService;
|
||||
use Illuminate\Queue\Middleware\WithoutOverlapping;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||
|
||||
|
@ -68,6 +69,15 @@ class HashtagRemoveFanoutPipeline implements ShouldQueue, ShouldBeUniqueUntilPro
|
|||
{
|
||||
$sid = $this->sid;
|
||||
$hid = $this->hid;
|
||||
$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 = HashtagFollowService::getPidByHid($hid);
|
||||
|
||||
|
|
|
@ -48,7 +48,7 @@ class HashtagUnfollowPipeline implements ShouldQueue
|
|||
{
|
||||
$hid = $this->hid;
|
||||
$pid = $this->pid;
|
||||
$slug = $this->slug;
|
||||
$slug = strtolower($this->slug);
|
||||
|
||||
$statusIds = HomeTimelineService::get($pid, 0, -1);
|
||||
|
||||
|
@ -59,17 +59,17 @@ class HashtagUnfollowPipeline implements ShouldQueue
|
|||
|
||||
foreach($statusIds as $id) {
|
||||
$status = StatusService::get($id, false);
|
||||
if(!$status) {
|
||||
if(!$status || empty($status['tags'])) {
|
||||
HomeTimelineService::rem($pid, $id);
|
||||
continue;
|
||||
}
|
||||
$following = in_array($status['account']['id'], $followingIds);
|
||||
if($following || !isset($status['tags'])) {
|
||||
$following = in_array((int) $status['account']['id'], $followingIds);
|
||||
if($following === true) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$tags = collect($status['tags'])->map(function($tag) {
|
||||
return $tag['name'];
|
||||
return strtolower($tag['name']);
|
||||
})->filter()->values()->toArray();
|
||||
|
||||
if(in_array($slug, $tags)) {
|
||||
|
|
|
@ -19,6 +19,7 @@ use Illuminate\Contracts\Queue\ShouldQueue;
|
|||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use App\Services\StatusService;
|
||||
use App\Services\UserFilterService;
|
||||
use App\Services\AdminShadowFilterService;
|
||||
use App\Jobs\HomeFeedPipeline\FeedInsertPipeline;
|
||||
|
@ -158,6 +159,7 @@ class StatusEntityLexer implements ShouldQueue
|
|||
public function fanout()
|
||||
{
|
||||
$status = $this->status;
|
||||
StatusService::refresh($status->id);
|
||||
|
||||
if(config('exp.cached_home_timeline')) {
|
||||
if( $status->in_reply_to_id === null &&
|
||||
|
|
|
@ -132,5 +132,7 @@ class StatusTagsPipeline implements ShouldQueue
|
|||
$mention->save();
|
||||
MentionPipeline::dispatch($status, $mention);
|
||||
});
|
||||
|
||||
StatusService::refresh($status->id);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue