Merge pull request #4795 from pixelfed/staging

Staging
This commit is contained in:
daniel 2023-12-05 00:50:51 -07:00 committed by GitHub
commit f9badbf4dd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 232 additions and 228 deletions

View file

@ -153,7 +153,7 @@ class CollectionController extends Controller
abort(400, 'You can only add '.$max.' posts per collection');
}
$status = Status::whereScope('public')
$status = Status::whereIn('scope', ['public', 'unlisted'])
->whereProfileId($profileId)
->whereIn('type', ['photo', 'photo:album', 'video'])
->findOrFail($postId);
@ -166,17 +166,13 @@ class CollectionController extends Controller
'order' => $count,
]);
CollectionService::addItem(
$collection->id,
$status->id,
$count
);
CollectionService::deleteCollection($collection->id);
$collection->updated_at = now();
$collection->save();
CollectionService::setCollection($collection->id, $collection);
return StatusService::get($status->id);
return StatusService::get($status->id, false);
}
public function getCollection(Request $request, $id)
@ -226,10 +222,10 @@ class CollectionController extends Controller
return collect($items)
->map(function($id) {
return StatusService::get($id);
return StatusService::get($id, false);
})
->filter(function($item) {
return $item && isset($item['account'], $item['media_attachments']);
return $item && ($item['visibility'] == 'public' || $item['visibility'] == 'unlisted') && isset($item['account'], $item['media_attachments']);
})
->values();
}
@ -298,7 +294,7 @@ class CollectionController extends Controller
abort(400, 'You cannot delete the only post of a collection!');
}
$status = Status::whereScope('public')
$status = Status::whereIn('scope', ['public', 'unlisted'])
->whereIn('type', ['photo', 'photo:album', 'video'])
->findOrFail($postId);

View file

@ -30,6 +30,7 @@ use App\Util\ActivityPub\{
};
use Zttp\Zttp;
use App\Services\InstanceService;
use App\Services\AccountService;
class FederationController extends Controller
{
@ -239,12 +240,15 @@ class FederationController extends Controller
{
abort_if(!config_cache('federation.activitypub.enabled'), 404);
$id = AccountService::usernameToId($username);
abort_if(!$id, 404);
$account = AccountService::get($id);
abort_if(!$account || !isset($account['following_count']), 404);
$obj = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $request->getUri(),
'type' => 'OrderedCollectionPage',
'totalItems' => 0,
'orderedItems' => []
'type' => 'OrderedCollection',
'totalItems' => $account['following_count'] ?? 0,
];
return response()->json($obj);
}
@ -252,15 +256,16 @@ class FederationController extends Controller
public function userFollowers(Request $request, $username)
{
abort_if(!config_cache('federation.activitypub.enabled'), 404);
$id = AccountService::usernameToId($username);
abort_if(!$id, 404);
$account = AccountService::get($id);
abort_if(!$account || !isset($account['followers_count']), 404);
$obj = [
'@context' => 'https://www.w3.org/ns/activitystreams',
'id' => $request->getUri(),
'type' => 'OrderedCollectionPage',
'totalItems' => 0,
'orderedItems' => []
'type' => 'OrderedCollection',
'totalItems' => $account['followers_count'] ?? 0,
];
return response()->json($obj);
}
}

View file

@ -33,7 +33,7 @@ RUN apt-get update \
# Required for GD
libxpm4 \
libxpm-dev \
libwebp6 \
libwebp7 \
libwebp-dev \
## Video Processing
ffmpeg \

View file

@ -33,7 +33,7 @@ RUN apt-get update \
# Required for GD
libxpm4 \
libxpm-dev \
libwebp6 \
libwebp7 \
libwebp-dev \
## Video Processing
ffmpeg \

View file

@ -460,7 +460,7 @@ export default {
})
.then(res => {
self.postsList = res.data.filter(l => {
return self.ids.indexOf(l.id) == -1;
return (l.visibility == 'public' || l.visibility == 'unlisted') && l.sensitive == false && self.ids.indexOf(l.id) == -1;
});
self.loadingPostList = false;
self.$refs.addPhotoModal.show();
@ -619,6 +619,9 @@ export default {
this.posts = this.posts.filter(post => {
return post.id != id;
});
this.ids = this.ids.filter(post_id => {
return post_id != id;
});
},
addRecentId(post) {
@ -630,6 +633,7 @@ export default {
// window.location.reload();
this.closeModals();
this.posts.push(res.data);
this.ids.push(post.id);
this.collection.post_count++;
}).catch(err => {
swal('Oops!', 'An error occured, please try selecting another post.', 'error');

View file

@ -194,7 +194,6 @@ export default {
swal('Invalid URL', 'You can only add posts from this instance', 'error');
this.id = '';
}
if(url.includes('/i/web/post/') || url.includes('/p/')) {
let id = split[split.length - 1];
console.log('adding ' + id);
@ -228,7 +227,7 @@ export default {
let ids = this.posts.map(s => {
return s.id;
});
return s.visibility == 'public' && s.sensitive == false && ids.indexOf(s.id) == -1;
return (s.visibility == 'public' || s.visibility == 'unlisted') && s.sensitive == false && ids.indexOf(s.id) == -1;
});
});
},