Prechádzať zdrojové kódy

Merge pull request #4805 from pixelfed/staging

Staging
daniel 1 rok pred
rodič
commit
abcaa19ff1

+ 9 - 0
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)

+ 3 - 3
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];
 	}
 

+ 23 - 2
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)

+ 23 - 2
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')

+ 3 - 3
resources/assets/components/sections/Notifications.vue

@@ -87,12 +87,12 @@
 									</div>
 									<div v-else-if="n.type == 'story:react'">
 										<p class="my-0">
-											<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.acct">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> reacted to your <a class="font-weight-bold" v-bind:href="'/account/direct/t/'+n.account.id">story</a>.
+											<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.acct">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> reacted to your <a class="font-weight-bold" v-bind:href="'/i/web/direct/thread/'+n.account.id">story</a>.
 										</p>
 									</div>
 									<div v-else-if="n.type == 'story:comment'">
 										<p class="my-0">
-											<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.acct">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> commented on your <a class="font-weight-bold" v-bind:href="'/account/direct/t/'+n.account.id">story</a>.
+											<a :href="getProfileUrl(n.account)" class="font-weight-bold text-dark word-break" :title="n.account.acct">{{n.account.local == false ? '@':''}}{{truncate(n.account.username)}}</a> commented on your <a class="font-weight-bold" v-bind:href="'/i/web/direct/thread/'+n.account.id">story</a>.
 										</p>
 									</div>
 									<div v-else-if="n.type == 'mention'">
@@ -216,7 +216,7 @@
 
 		methods: {
 			init() {
-				if(this.retryAttempts == 3) {
+				if(this.retryAttempts == 1) {
 					this.hasLoaded = true;
 					this.isEmpty = true;
 					clearTimeout(this.retryTimeout);

+ 23 - 6
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 => {

+ 1 - 0
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;
 						}
 					}

+ 18 - 19
resources/assets/js/components/presenter/PhotoAlbumPresenter.vue

@@ -26,8 +26,7 @@
 			<slide v-for="(img, index) in status.media_attachments" :key="'px-carousel-'+img.id + '-' + index" class="" style="background: #000; display: flex;align-items: center;" :title="img.description">
 
 				<img
-					:class="img.filter_class + ' img-fluid w-100 p-0'"
-					style=""
+					class="img-fluid w-100 p-0"
 					:src="img.url"
 					:alt="altText(img)"
 					loading="lazy"
@@ -162,28 +161,28 @@
 
 <style type="text/css" scoped>
   .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;
   }
 </style>