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'); abort(400, 'You can only add '.$max.' posts per collection');
} }
$status = Status::whereScope('public') $status = Status::whereIn('scope', ['public', 'unlisted'])
->whereProfileId($profileId) ->whereProfileId($profileId)
->whereIn('type', ['photo', 'photo:album', 'video']) ->whereIn('type', ['photo', 'photo:album', 'video'])
->findOrFail($postId); ->findOrFail($postId);
@ -176,7 +176,7 @@ class CollectionController extends Controller
$collection->save(); $collection->save();
CollectionService::setCollection($collection->id, $collection); CollectionService::setCollection($collection->id, $collection);
return StatusService::get($status->id); return StatusService::get($status->id, false);
} }
public function getCollection(Request $request, $id) public function getCollection(Request $request, $id)
@ -226,10 +226,10 @@ class CollectionController extends Controller
return collect($items) return collect($items)
->map(function($id) { ->map(function($id) {
return StatusService::get($id); return StatusService::get($id, false);
}) })
->filter(function($item) { ->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(); ->values();
} }
@ -298,7 +298,7 @@ class CollectionController extends Controller
abort(400, 'You cannot delete the only post of a collection!'); 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']) ->whereIn('type', ['photo', 'photo:album', 'video'])
->findOrFail($postId); ->findOrFail($postId);

View File

@ -460,7 +460,7 @@ export default {
}) })
.then(res => { .then(res => {
self.postsList = res.data.filter(l => { 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.loadingPostList = false;
self.$refs.addPhotoModal.show(); self.$refs.addPhotoModal.show();

View File

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