From 9818656425c46c0c42d624a8dead09d68a127aa2 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 04:27:09 -0700 Subject: [PATCH 1/7] Update DirectMessageController, dispatch local deletes to pipeline --- app/Http/Controllers/DirectMessageController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Http/Controllers/DirectMessageController.php b/app/Http/Controllers/DirectMessageController.php index 959b944ce..b706572b3 100644 --- a/app/Http/Controllers/DirectMessageController.php +++ b/app/Http/Controllers/DirectMessageController.php @@ -17,6 +17,7 @@ use App\{ use App\Services\MediaPathService; use App\Services\MediaBlocklistService; use App\Jobs\StatusPipeline\NewStatusPipeline; +use App\Jobs\StatusPipeline\StatusDelete; use Illuminate\Support\Str; use App\Util\ActivityPub\Helpers; use App\Services\AccountService; @@ -502,6 +503,8 @@ class DirectMessageController extends Controller if($recipient['local'] == false) { $dmc = $dm; $this->remoteDelete($dmc); + } else { + StatusDelete::dispatch($status)->onQueue('high'); } if(Conversation::whereStatusId($sid)->count()) { @@ -543,9 +546,6 @@ class DirectMessageController extends Controller StatusService::del($status->id, true); - $status->delete(); - $dm->delete(); - return [200]; } From 4c95306f1246bba3127e8977667fc6721ee2f66f Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 04:44:45 -0700 Subject: [PATCH 2/7] Update StatusPipeline, fix Direct and Story notification deletion --- .../StatusPipeline/RemoteStatusDelete.php | 25 +++++++++++++++++-- app/Jobs/StatusPipeline/StatusDelete.php | 25 +++++++++++++++++-- 2 files changed, 46 insertions(+), 4 deletions(-) diff --git a/app/Jobs/StatusPipeline/RemoteStatusDelete.php b/app/Jobs/StatusPipeline/RemoteStatusDelete.php index cb14288a1..78c41ed3d 100644 --- a/app/Jobs/StatusPipeline/RemoteStatusDelete.php +++ b/app/Jobs/StatusPipeline/RemoteStatusDelete.php @@ -40,6 +40,7 @@ use App\Services\CollectionService; use App\Services\StatusService; use App\Jobs\MediaPipeline\MediaDeletePipeline; use App\Jobs\ProfilePipeline\DecrementPostCount; +use App\Services\NotificationService; class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing { @@ -137,14 +138,34 @@ class RemoteStatusDelete implements ShouldQueue, ShouldBeUniqueUntilProcessing CollectionService::removeItem($col->collection_id, $col->object_id); $col->delete(); }); - DirectMessage::whereStatusId($status->id)->delete(); + $dms = DirectMessage::whereStatusId($status->id)->get(); + foreach($dms as $dm) { + $not = Notification::whereItemType('App\DirectMessage') + ->whereItemId($dm->id) + ->first(); + if($not) { + NotificationService::del($not->profile_id, $not->id); + $not->forceDeleteQuietly(); + } + $dm->delete(); + } Like::whereStatusId($status->id)->forceDelete(); Media::whereStatusId($status->id) ->get() ->each(function($media) { MediaDeletePipeline::dispatch($media)->onQueue('mmo'); }); - MediaTag::where('status_id', $status->id)->delete(); + $mediaTags = MediaTag::where('status_id', $status->id)->get(); + foreach($mediaTags as $mtag) { + $not = Notification::whereItemType('App\MediaTag') + ->whereItemId($mtag->id) + ->first(); + if($not) { + NotificationService::del($not->profile_id, $not->id); + $not->forceDeleteQuietly(); + } + $mtag->delete(); + } Mention::whereStatusId($status->id)->forceDelete(); Notification::whereItemType('App\Status') ->whereItemId($status->id) diff --git a/app/Jobs/StatusPipeline/StatusDelete.php b/app/Jobs/StatusPipeline/StatusDelete.php index 5b200fdf0..c0ced1368 100644 --- a/app/Jobs/StatusPipeline/StatusDelete.php +++ b/app/Jobs/StatusPipeline/StatusDelete.php @@ -35,6 +35,7 @@ use GuzzleHttp\Promise; use App\Util\ActivityPub\HttpSignature; use App\Services\CollectionService; use App\Services\StatusService; +use App\Services\NotificationService; use App\Jobs\MediaPipeline\MediaDeletePipeline; class StatusDelete implements ShouldQueue @@ -115,10 +116,30 @@ class StatusDelete implements ShouldQueue $col->delete(); }); - DirectMessage::whereStatusId($status->id)->delete(); + $dms = DirectMessage::whereStatusId($status->id)->get(); + foreach($dms as $dm) { + $not = Notification::whereItemType('App\DirectMessage') + ->whereItemId($dm->id) + ->first(); + if($not) { + NotificationService::del($not->profile_id, $not->id); + $not->forceDeleteQuietly(); + } + $dm->delete(); + } Like::whereStatusId($status->id)->delete(); - MediaTag::where('status_id', $status->id)->delete(); + $mediaTags = MediaTag::where('status_id', $status->id)->get(); + foreach($mediaTags as $mtag) { + $not = Notification::whereItemType('App\MediaTag') + ->whereItemId($mtag->id) + ->first(); + if($not) { + NotificationService::del($not->profile_id, $not->id); + $not->forceDeleteQuietly(); + } + $mtag->delete(); + } Mention::whereStatusId($status->id)->forceDelete(); Notification::whereItemType('App\Status') From 4c3823b0c428e17a872edfd5da52782cd7261aef Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 04:51:29 -0700 Subject: [PATCH 3/7] Update Notifications.vue, fix deprecated DM action links for story activities --- resources/assets/components/sections/Notifications.vue | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/resources/assets/components/sections/Notifications.vue b/resources/assets/components/sections/Notifications.vue index b2c904184..1ddf522fc 100644 --- a/resources/assets/components/sections/Notifications.vue +++ b/resources/assets/components/sections/Notifications.vue @@ -87,12 +87,12 @@

- {{n.account.local == false ? '@':''}}{{truncate(n.account.username)}} reacted to your story. + {{n.account.local == false ? '@':''}}{{truncate(n.account.username)}} reacted to your story.

- {{n.account.local == false ? '@':''}}{{truncate(n.account.username)}} commented on your story. + {{n.account.local == false ? '@':''}}{{truncate(n.account.username)}} commented on your story.

@@ -216,7 +216,7 @@ methods: { init() { - if(this.retryAttempts == 3) { + if(this.retryAttempts == 1) { this.hasLoaded = true; this.isEmpty = true; clearTimeout(this.retryTimeout); From 0a0681199f985005467ab21a41564637dfd7d0cb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 04:56:21 -0700 Subject: [PATCH 4/7] Update ComposeModal, fix missing alttext post state --- resources/assets/js/components/ComposeModal.vue | 1 + 1 file changed, 1 insertion(+) diff --git a/resources/assets/js/components/ComposeModal.vue b/resources/assets/js/components/ComposeModal.vue index 9ca6e0419..4ffd84666 100644 --- a/resources/assets/js/components/ComposeModal.vue +++ b/resources/assets/js/components/ComposeModal.vue @@ -1347,6 +1347,7 @@ export default { if(count.length) { swal('Missing media descriptions', 'You have enabled mandatory media descriptions. Please add media descriptions under Advanced settings to proceed. For more information, please see the media settings page.', 'warning'); + this.isPosting = false; return; } } From 822e9888bb08a89197c3621e80a64cee6bdbfbe8 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 05:01:04 -0700 Subject: [PATCH 5/7] Update PhotoAlbumPresenter.vue, fix fullscreen mode --- .../presenter/PhotoAlbumPresenter.vue | 37 +++++++++---------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/resources/assets/js/components/presenter/PhotoAlbumPresenter.vue b/resources/assets/js/components/presenter/PhotoAlbumPresenter.vue index c83f11e20..3adda10df 100644 --- a/resources/assets/js/components/presenter/PhotoAlbumPresenter.vue +++ b/resources/assets/js/components/presenter/PhotoAlbumPresenter.vue @@ -26,8 +26,7 @@ .card-img-top { - border-top-left-radius: 0 !important; - border-top-right-radius: 0 !important; + border-top-left-radius: 0 !important; + border-top-right-radius: 0 !important; } .content-label-wrapper { - position: relative; + position: relative; } .content-label { - margin: 0; - position: absolute; - top:50%; - left:50%; - transform: translate(-50%, -50%); - display: flex; - flex-direction: column; - align-items: center; - justify-content: center; - width: 100%; - height: 100%; - z-index: 2; - background: rgba(0, 0, 0, 0.2) + margin: 0; + position: absolute; + top:50%; + left:50%; + transform: translate(-50%, -50%); + display: flex; + flex-direction: column; + align-items: center; + justify-content: center; + width: 100%; + height: 100%; + z-index: 2; + background: rgba(0, 0, 0, 0.2) } .album-wrapper { - position: relative; + position: relative; } From 9c43e7e26505700f98cd094d7b0b6cd00205b531 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 05:25:03 -0700 Subject: [PATCH 6/7] Update Timeline.vue, improve CHT pagination --- .../assets/components/sections/Timeline.vue | 29 +++++++++++++++---- 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/resources/assets/components/sections/Timeline.vue b/resources/assets/components/sections/Timeline.vue index dd2c7d2f0..6b064acea 100644 --- a/resources/assets/components/sections/Timeline.vue +++ b/resources/assets/components/sections/Timeline.vue @@ -186,7 +186,8 @@ sharesModalPost: {}, forceUpdateIdx: 0, showReblogBanner: false, - enablingReblogs: false + enablingReblogs: false, + baseApi: '/api/v1/pixelfed/timelines/', } }, @@ -201,6 +202,10 @@ return; }; } + if(window.App.config.ab.hasOwnProperty('cached_home_timeline')) { + const cht = window.App.config.ab.cached_home_timeline == true; + this.baseApi = cht ? '/api/v1/timelines/' : '/api/pixelfed/v1/timelines/'; + } this.fetchSettings(); }, @@ -247,7 +252,7 @@ fetchTimeline(scrollToTop = false) { let url, params; if(this.getScope() === 'home' && this.settings && this.settings.hasOwnProperty('enable_reblogs') && this.settings.enable_reblogs) { - url = `/api/v1/timelines/home`; + url = this.baseApi + `home`; params = { '_pe': 1, max_id: this.max_id, @@ -255,12 +260,17 @@ include_reblogs: true, } } else { - url = `/api/pixelfed/v1/timelines/${this.getScope()}`; + url = this.baseApi + this.getScope(); params = { max_id: this.max_id, limit: 6, + '_pe': 1, } } + if(this.getScope() === 'network') { + params.remote = true; + url = this.baseApi + `public`; + } axios.get(url, { params: params }).then(res => { @@ -278,7 +288,7 @@ this.max_id = Math.min(...ids); this.feed = res.data; - if(res.data.length !== 6) { + if(res.data.length < 4) { this.canLoadMore = false; this.showLoadMore = true; } @@ -306,7 +316,8 @@ let url, params; if(this.getScope() === 'home' && this.settings && this.settings.hasOwnProperty('enable_reblogs') && this.settings.enable_reblogs) { - url = `/api/v1/timelines/home`; + url = this.baseApi + `home`; + params = { '_pe': 1, max_id: this.max_id, @@ -314,12 +325,18 @@ include_reblogs: true, } } else { - url = `/api/pixelfed/v1/timelines/${this.getScope()}`; + url = this.baseApi + this.getScope(); params = { max_id: this.max_id, limit: 6, + '_pe': 1, } } + if(this.getScope() === 'network') { + params.remote = true; + url = this.baseApi + `public`; + + } axios.get(url, { params: params }).then(res => { From ed5e956a542521d82e28e538c3bdcf50a36329d4 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 8 Dec 2023 05:25:44 -0700 Subject: [PATCH 7/7] Update changelog --- CHANGELOG.md | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3aa36a529..4453cdec6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -66,6 +66,15 @@ - Update FederationController, add proper following/follower counts ([3204fb96](https://github.com/pixelfed/pixelfed/commit/3204fb96)) - Update FederationController, add proper statuses counts ([3204fb96](https://github.com/pixelfed/pixelfed/commit/3204fb96)) - Update Inbox handler, fix missing object_url and uri fields for direct statuses ([a0157fce](https://github.com/pixelfed/pixelfed/commit/a0157fce)) +- Update DirectMessageController, deliver direct delete activities to user inbox instead of sharedInbox ([d848792a](https://github.com/pixelfed/pixelfed/commit/d848792a)) +- Update DirectMessageController, dispatch deliver and delete actions to the job queue ([7f462a80](https://github.com/pixelfed/pixelfed/commit/7f462a80)) +- Update Inbox, improve story attribute collection ([06bee36c](https://github.com/pixelfed/pixelfed/commit/06bee36c)) +- Update DirectMessageController, dispatch local deletes to pipeline ([98186564](https://github.com/pixelfed/pixelfed/commit/98186564)) +- Update StatusPipeline, fix Direct and Story notification deletion ([4c95306f](https://github.com/pixelfed/pixelfed/commit/4c95306f)) +- Update Notifications.vue, fix deprecated DM action links for story activities ([4c3823b0](https://github.com/pixelfed/pixelfed/commit/4c3823b0)) +- Update ComposeModal, fix missing alttext post state ([0a068119](https://github.com/pixelfed/pixelfed/commit/0a068119)) +- Update PhotoAlbumPresenter.vue, fix fullscreen mode ([822e9888](https://github.com/pixelfed/pixelfed/commit/822e9888)) +- Update Timeline.vue, improve CHT pagination ([9c43e7e2](https://github.com/pixelfed/pixelfed/commit/9c43e7e2)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9)