diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 178fc5b5c..c7a27dd0f 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -66,15 +66,24 @@ +
- - {{status.account.username}} - +
+ + + {{status.account.username}} + + + + {{status.account.relationship.following == true ? 'Following' : 'Follow'}} + + {{status.place.name}}, {{status.place.country}} +
+ + +

@@ -209,7 +224,7 @@
-
+
@@ -252,22 +267,36 @@
- +
+ + + +
+
+
+
+ Tip: Hide follower counts + +
+

+ You can hide followers or following count and lists on your profile. +
Privacy Settings

+
@@ -400,9 +429,25 @@
Copy Link
+
Moderation Tools
+
Delete
Cancel
+ +
+
Unlist from Timelines
+
Add Content Warning
+
Cancel
+
+
-
- +
+
@@ -524,7 +569,8 @@ ctxMenuStatus: false, ctxMenuRelationship: false, ctxEmbedPayload: false, - copiedEmbed: false + copiedEmbed: false, + showTips: true, } }, @@ -563,6 +609,10 @@ this.modes.distractionFree = false; } + if(localStorage.getItem('metro-tips') == 'false') { + this.showTips = false; + } + this.$nextTick(function () { $('[data-toggle="tooltip"]').tooltip() }); @@ -623,13 +673,19 @@ this.max_id = Math.min(...ids); $('.timeline .pagination').removeClass('d-none'); this.loading = false; - this.fetchHashtagPosts(); + if(this.feed.length == 6) { + this.fetchHashtagPosts(); + this.fetchTimelineApi(); + } else { + this.fetchHashtagPosts(); + } }).catch(err => { }); }, infiniteTimeline($state) { if(this.loading) { + $state.complete(); return; } let apiUrl = false; @@ -649,7 +705,7 @@ axios.get(apiUrl, { params: { max_id: this.max_id, - limit: 6 + limit: 9 }, }).then(res => { if (res.data.length && this.loading == false) { @@ -826,7 +882,7 @@ }); }, - deletePost(status, index) { + deletePost(status) { if($('body').hasClass('loggedIn') == false || this.ownerOrAdmin(status) == false) { return; } @@ -841,8 +897,8 @@ }).then(res => { this.feed = this.feed.filter(s => { return s.id != status.id; - }) - swal('Success', 'You have successfully deleted this post', 'success'); + }); + this.$refs.ctxModal.hide(); }).catch(err => { swal('Error', 'Something went wrong. Please try again later.', 'error'); }); @@ -916,6 +972,7 @@ } }); break; + case 'unlisted': msg = 'Are you sure you want to unlist from timelines for ' + username + ' ?'; swal({ @@ -1073,8 +1130,8 @@ }); }, - lightbox(src) { - this.lightboxMedia = src; + lightbox(status) { + this.lightboxMedia = status.media_attachments[0]; this.$refs.lightboxModal.show(); }, @@ -1114,13 +1171,26 @@ }); }, - followModalAction(id, index, type = 'following') { + followAction(status) { + let id = status.account.id; + axios.post('/i/follow', { item: id }).then(res => { - if(type == 'following') { - this.following.splice(index, 1); + this.feed.forEach(s => { + if(s.account.id == id) { + s.account.relationship.following = !s.account.relationship.following; + } + }); + + let username = status.account.acct; + + if(status.account.relationship.following) { + swal('Follow successful!', 'You are now following ' + username, 'success'); + } else { + swal('Unfollow successful!', 'You are no longer following ' + username, 'success'); } + }).catch(err => { if(err.response.data.message) { swal('Error', err.response.data.message, 'error'); @@ -1190,7 +1260,6 @@ }, fetchHashtagPosts() { - axios.get('/api/local/discover/tag/list') .then(res => { let tags = res.data; @@ -1210,7 +1279,6 @@ } }) }) - }, ctxMenu(status) { @@ -1255,9 +1323,16 @@ }, ctxMenuFollow() { + let id = this.ctxMenuStatus.account.id; axios.post('/i/follow', { - item: this.ctxMenuStatus.account.id + item: id }).then(res => { + this.feed.forEach(s => { + if(s.account.id == id) { + s.account.relationship.following = !s.account.relationship.following; + } + }); + let username = this.ctxMenuStatus.account.acct; this.closeCtxMenu(); setTimeout(function() { @@ -1267,10 +1342,21 @@ }, ctxMenuUnfollow() { + let id = this.ctxMenuStatus.account.id; axios.post('/i/follow', { - item: this.ctxMenuStatus.account.id + item: id }).then(res => { + this.feed.forEach(s => { + if(s.account.id == id) { + s.account.relationship.following = !s.account.relationship.following; + } + }); let username = this.ctxMenuStatus.account.acct; + if(this.scope == 'home') { + this.feed = this.feed.filter(s => { + return s.account.id != this.ctxMenuStatus.account.id; + }); + } this.closeCtxMenu(); setTimeout(function() { swal('Unfollow successful!', 'You are no longer following ' + username, 'success'); @@ -1300,6 +1386,26 @@ ctxCopyEmbed() { navigator.clipboard.writeText(this.ctxEmbedPayload); this.$refs.ctxEmbedModal.hide(); + }, + + ctxModMenuShow() { + this.$refs.ctxModal.hide(); + this.$refs.ctxModModal.show(); + }, + + ctxModMenu() { + this.$refs.ctxModal.hide(); + }, + + ctxModMenuClose() { + this.$refs.ctxModal.hide(); + this.$refs.ctxModModal.hide(); + }, + + hideTips() { + this.showTips = false; + let ls = window.localStorage; + ls.setItem('metro-tips', false); } }