From 62c056651aad7bfe995c4e38796992109940d943 Mon Sep 17 00:00:00 2001 From: Daniel Supernault <877217+dansup@users.noreply.github.com> Date: Tue, 6 Sep 2022 18:09:14 -0600 Subject: [PATCH] Update Collection components, fix addId bug # --- .../js/components/CollectionComponent.vue | 305 +++++++++++++++--- .../js/components/CollectionCompose.vue | 30 +- 2 files changed, 276 insertions(+), 59 deletions(-) diff --git a/resources/assets/js/components/CollectionComponent.vue b/resources/assets/js/components/CollectionComponent.vue index 1d029ce3b..3480fa9ee 100644 --- a/resources/assets/js/components/CollectionComponent.vue +++ b/resources/assets/js/components/CollectionComponent.vue @@ -5,13 +5,53 @@
+
+
+
+ +
+

+ This collection is unpublished. +

+

+ This collection is not visible to anyone else until you publish it.
+ To publish, click on the Edit button and then click on the Publish button. +

+
+
+
+
+
+ +
+

{{title || 'Untitled Collection'}}

{{description}}

- {{posts.length}} photos · by {{profileUsername}} + + + + Draft + + + Followers Only + + · + + {{collection.post_count}} photos + · + by {{profileUsername}}

@@ -23,30 +63,103 @@

-     +     -     +    

- +
- -
- - - + > --> +
+ - + +
+ +
+
+ +

Loading more...

+
+
+
+
+
+
@@ -64,6 +177,7 @@
@@ -101,13 +215,14 @@
+
-
+
-
-
+
+
@@ -133,13 +248,14 @@ +

Select a Photo to Delete

-
+
@@ -147,12 +263,11 @@
-
- diff --git a/resources/assets/js/components/CollectionCompose.vue b/resources/assets/js/components/CollectionCompose.vue index 91115b5ee..89f4e5f93 100644 --- a/resources/assets/js/components/CollectionCompose.vue +++ b/resources/assets/js/components/CollectionCompose.vue @@ -25,12 +25,13 @@

- +

@@ -55,7 +56,7 @@

-
+
-
+
@@ -119,11 +120,10 @@ export default { step: 1, title: '', description: '', - visibility: 'private', collection: { title: '', description: '', - visibility: 'public' + visibility: 'draft' }, id: '', posts: [], @@ -188,11 +188,16 @@ export default { swal('Invalid URL', 'You can only add posts from this instance', 'error'); this.id = ''; } - if(url.slice(0, origin.length + 3) !== origin + '/p/' || split.length !== 6) { + + if(url.includes('/i/web/post/') || url.includes('/p/')) { + let id = split[split.length - 1]; + console.log('adding ' + id); + this.addToIds(id); + return; + } else { swal('Invalid URL', 'Invalid URL', 'error'); this.id = ''; - } - this.addToIds(split[5]); + } return; }, @@ -206,10 +211,11 @@ export default { }, fetchRecentPosts() { - axios.get('/api/pixelfed/v1/accounts/' + this.profileId + '/statuses', { + axios.get('/api/v1/accounts/' + this.profileId + '/statuses', { params: { only_media: true, min_id: 1, + limit: 40 } }).then(res => { this.recentPosts = res.data.filter(s => { @@ -217,7 +223,7 @@ export default { return s.id; }); return s.visibility == 'public' && s.sensitive == false && ids.indexOf(s.id) == -1; - }).slice(0,3); + }); }); }, @@ -237,7 +243,7 @@ export default { visibility: this.collection.visibility }) .then(res => { - window.location.href = res.data; + window.location.href = res.data.url; }).catch(err => { swal('Something went wrong', 'There was a problem with your request, please try again later.', 'error'); }); @@ -266,4 +272,4 @@ export default { } } } - \ No newline at end of file +