oFix #3698, make unlisted photos visible in collections

This commit is contained in:
mbliznikova 2023-11-09 18:27:24 +00:00
parent 170f877c26
commit 2c6edf37a7
3 changed files with 7 additions and 8 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);
@ -176,7 +176,7 @@ class CollectionController extends Controller
$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 +226,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 +298,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

@ -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();

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;
});
});
},