Merge pull request #4750 from mbliznikova/3698_make_unlisted_photos_visible_in_collections

3698 make unlisted photos visible in collections
This commit is contained in:
daniel 2023-12-05 00:27:30 -07:00 committed by GitHub
commit baa653d7de
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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;
});
});
},