Merge pull request #2480 from pixelfed/staging

Update Collections, add custom limit
This commit is contained in:
daniel 2020-12-10 01:07:44 -07:00 committed by GitHub
commit e4a06cc056
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 20 additions and 13 deletions

View file

@ -124,6 +124,7 @@
- Updated BaseApiController, add favourites method. ([76353ca9](https://github.com/pixelfed/pixelfed/commit/76353ca9))
- Updated dockerfile, fix composer issue. ([ef45c4b21](https://github.com/pixelfed/pixelfed/commit/ef45c4b21))
- Updated reply/comment view, improve layout and include child reply. ([2eca670e](https://github.com/pixelfed/pixelfed/commit/2eca670e))
- Updated Collections, add custom limit. ([048642be](https://github.com/pixelfed/pixelfed/commit/048642be))
## [v0.10.9 (2020-04-17)](https://github.com/pixelfed/pixelfed/compare/v0.10.8...v0.10.9)
### Added

View file

@ -121,8 +121,9 @@ class CollectionController extends Controller
$collection = Collection::whereProfileId($profileId)->findOrFail($collectionId);
$count = $collection->items()->count();
if($count >= 50) {
abort(400, 'You can only add 50 posts per collection');
$max = config('pixelfed.max_collection_length');
if($count >= $max) {
abort(400, 'You can only add '.$max.' posts per collection');
}
$status = Status::whereScope('public')
@ -165,7 +166,7 @@ class CollectionController extends Controller
if($collection->visibility !== 'public') {
abort_if(!Auth::check() || Auth::user()->profile_id != $collection->profile_id, 404);
}
$posts = $collection->posts()->orderBy('order', 'asc')->paginate(18);
$posts = $collection->posts()->orderBy('order', 'asc')->get();
$fractal = new Fractal\Manager();
$fractal->setSerializer(new ArraySerializer());

View file

@ -8,7 +8,7 @@ use Illuminate\Support\Str;
class Config {
public static function get() {
return Cache::remember('api:site:configuration', now()->addMinutes(30), function() {
return Cache::remember('api:site:configuration:_v0', now()->addHours(30), function() {
return [
'open_registration' => config('pixelfed.open_registration'),
'uploader' => [
@ -17,6 +17,8 @@ class Config {
'album_limit' => config('pixelfed.max_album_length'),
'image_quality' => config('pixelfed.image_quality'),
'max_collection_length' => config('pixelfed.max_collection_length', 18),
'optimize_image' => config('pixelfed.optimize_image'),
'optimize_video' => config('pixelfed.optimize_video'),

View file

@ -239,6 +239,7 @@ return [
]
],
'max_collection_length' => (int) env('PF_MAX_COLLECTION_LENGTH', 18),
'media_types' => env('MEDIA_TYPES', 'image/jpeg,image/png,image/gif'),

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -8,8 +8,8 @@
"/css/appdark.css": "/css/appdark.css?id=995ec87dd4aff426cd1c",
"/css/landing.css": "/css/landing.css?id=3092e86721fa8b922c06",
"/css/quill.css": "/css/quill.css?id=e3741782d15a3031f785",
"/js/collectioncompose.js": "/js/collectioncompose.js?id=72e8fa48c00604a44eb9",
"/js/collections.js": "/js/collections.js?id=915db7c1d080d61edcc9",
"/js/collectioncompose.js": "/js/collectioncompose.js?id=c6a07cb79dd7d6c7b8a0",
"/js/collections.js": "/js/collections.js?id=6f64a9032085ebac28b3",
"/js/components.js": "/js/components.js?id=88296701f1382d285031",
"/js/compose.js": "/js/compose.js?id=e74fdb55681c6d21f4d5",
"/js/compose-classic.js": "/js/compose-classic.js?id=283f19c895f4118a2a8b",
@ -29,5 +29,5 @@
"/js/status.js": "/js/status.js?id=70f5597c1069d7ead4bb",
"/js/story-compose.js": "/js/story-compose.js?id=13f9606a3c4ce7acf17b",
"/js/theme-monokai.js": "/js/theme-monokai.js?id=8842103833ba4861bcfa",
"/js/timeline.js": "/js/timeline.js?id=8b144724e85e8bef50bf"
"/js/timeline.js": "/js/timeline.js?id=44dae7cd501b4b9adce2"
}

View file

@ -161,6 +161,7 @@ export default {
data() {
return {
config: window.App.config,
loaded: false,
posts: [],
ids: [],
@ -243,7 +244,7 @@ export default {
},
pushId() {
let max = 18;
let max = this.config.uploader.max_collection_length;
let addingPostToCollection = true;
let self = this;
if(this.posts.length >= max) {

View file

@ -113,6 +113,7 @@ export default {
props: ['collection-id', 'profile-id'],
data() {
return {
config: window.App.config,
loaded: false,
limit: 8,
step: 1,
@ -175,7 +176,7 @@ export default {
},
addId() {
let max = 18;
let max = this.config.uploader.max_collection_length;
if(this.posts.length >= max) {
swal('Error', 'You can only add ' + max + ' posts per collection', 'error');
return;

View file

@ -345,7 +345,7 @@
<footer>
<div class="container pb-5">
<p class="mb-0 text-uppercase font-weight-bold text-muted small">
<a href="/site/about" class="text-dark pr-2">About Us</a>
<a href="/site/about" class="text-dark pr-2">About</a>
<a href="/site/help" class="text-dark pr-2">Help</a>
<a href="/site/language" class="text-dark pr-2">Language</a>
<a href="/discover/profiles" class="text-dark pr-2">Profiles</a>