From f92b25923244a30a13a56737a1a015e0375b11bb Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 3 May 2019 19:18:47 -0600 Subject: [PATCH 1/3] Update LikePipeline --- app/Jobs/LikePipeline/LikePipeline.php | 10 ++-------- app/Like.php | 11 ++++++----- resources/lang/en/notification.php | 3 ++- 3 files changed, 10 insertions(+), 14 deletions(-) diff --git a/app/Jobs/LikePipeline/LikePipeline.php b/app/Jobs/LikePipeline/LikePipeline.php index e14047830..f8aeb5c0a 100644 --- a/app/Jobs/LikePipeline/LikePipeline.php +++ b/app/Jobs/LikePipeline/LikePipeline.php @@ -69,19 +69,13 @@ class LikePipeline implements ShouldQueue $notification->profile_id = $status->profile_id; $notification->actor_id = $actor->id; $notification->action = 'like'; - $notification->message = $like->toText(); - $notification->rendered = $like->toHtml(); + $notification->message = $like->toText($status->in_reply_to_id ? 'comment' : 'post'); + $notification->rendered = $like->toHtml($status->in_reply_to_id ? 'comment' : 'post'); $notification->item_id = $status->id; $notification->item_type = "App\Status"; $notification->save(); - Cache::forever('notification.'.$notification->id, $notification); - - $redis = Redis::connection(); - $key = config('cache.prefix').':user.'.$status->profile_id.'.notifications'; - $redis->lpush($key, $notification->id); } catch (Exception $e) { - Log::error($e); } } } diff --git a/app/Like.php b/app/Like.php index 94d8d57b9..8b45b60cb 100644 --- a/app/Like.php +++ b/app/Like.php @@ -27,19 +27,20 @@ class Like extends Model return $this->belongsTo(Status::class); } - public function toText() + public function toText($type = 'post') { $actorName = $this->actor->username; + $msg = $type == 'post' ? __('notification.likedPhoto') : __('notification.likedComment'); - return "{$actorName} ".__('notification.likedPhoto'); + return "{$actorName} ".$msg; } - public function toHtml() + public function toHtml($type = 'post') { $actorName = $this->actor->username; $actorUrl = $this->actor->url(); + $msg = $type == 'post' ? __('notification.likedPhoto') : __('notification.likedComment'); - return "{$actorName} ". - __('notification.likedPhoto'); + return "{$actorName} ".$msg; } } diff --git a/resources/lang/en/notification.php b/resources/lang/en/notification.php index d737167ae..2478224f8 100644 --- a/resources/lang/en/notification.php +++ b/resources/lang/en/notification.php @@ -2,7 +2,8 @@ return [ - 'likedPhoto' => 'liked your photo.', + 'likedPhoto' => 'liked your post.', + 'likedComment' => 'liked your comment.', 'startedFollowingYou' => 'started following you.', 'commented' => 'commented on your post.', 'mentionedYou' => 'mentioned you.', From 1b601a91b990ef2c53c3e7c5ffbefed0216618dc Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 3 May 2019 20:01:31 -0600 Subject: [PATCH 2/3] Update Timeline --- resources/assets/js/components/Timeline.vue | 20 +++++++++++-- resources/views/settings/labs.blade.php | 31 ++++++++++++++++++++- 2 files changed, 47 insertions(+), 4 deletions(-) diff --git a/resources/assets/js/components/Timeline.vue b/resources/assets/js/components/Timeline.vue index 79fad584a..0270d4959 100644 --- a/resources/assets/js/components/Timeline.vue +++ b/resources/assets/js/components/Timeline.vue @@ -220,10 +220,12 @@ -
+
-
+
+
Suggestions
+
@@ -386,7 +388,8 @@ following: [], followingCursor: 1, followingMore: true, - lightboxMedia: false + lightboxMedia: false, + showSuggestions: false } }, @@ -406,6 +409,12 @@ this.modes.dark = true; } + if(localStorage.getItem('pf_metro_ui.exp.rec') == 'false') { + this.showSuggestions = false; + } else { + this.showSuggestions = true; + } + this.$nextTick(function () { $('[data-toggle="tooltip"]').tooltip() }); @@ -1006,6 +1015,11 @@ ownerOrAdmin(status) { return this.owner(status) || this.admin(); + }, + + hideSuggestions() { + localStorage.setItem('pf_metro_ui.exp.rec', false); + this.showSuggestions = false; } } } diff --git a/resources/views/settings/labs.blade.php b/resources/views/settings/labs.blade.php index 47613a8ec..c7dcae813 100644 --- a/resources/views/settings/labs.blade.php +++ b/resources/views/settings/labs.blade.php @@ -38,6 +38,15 @@

Use dark mode theme.

+ @if(config('exp.rec') == true) +
+ + +

Show Profile Suggestions

+
+ @endif

Discovery


@@ -58,4 +67,24 @@
- @endsection \ No newline at end of file + @endsection + +@push('scripts') + +@endpush \ No newline at end of file From 7a34a0b140cb4c8b2fe269190f3ce6f1d3da9e67 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Fri, 3 May 2019 20:01:51 -0600 Subject: [PATCH 3/3] Update compiled assets --- public/js/timeline.js | Bin 59003 -> 59387 bytes public/mix-manifest.json | Bin 845 -> 845 bytes 2 files changed, 0 insertions(+), 0 deletions(-) diff --git a/public/js/timeline.js b/public/js/timeline.js index 0868a3b8b732cd59df7c08c359d54aa4ce785372..555e3f964b7b243a84ce44e2a47020d7fffc1e64 100644 GIT binary patch delta 623 zcmex;hWYn-<_(jWH`}u)^0Ii87#U7pFQ&fvun;4cfKG8netB?ddU|ScNoIat@#KRt zzfzRa5_5`Em27Qu@{<#Df=lv?64O)l(o;)3OHy++lnT<~b5l!-^5aW0^-?Pe^omlG zl{D>3GBS(x&`h&cG_=AlZm@ZmthQRcPDW-*Dw6e9X{C9|ActsZR-;&6jL&i%MMF&; z?DiPe*4FCe+iDbRCC$%YMblYP55SwP<29M#p%xLL9{T4A&Nx;vHt9KB>+ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 0cc43901d33d7cfa42df6427edf315d9aada4689..c5796c5741f2ee1eea0b5f4da8913fffcf612483 100644 GIT binary patch delta 32 ncmX@hc9v~}DYJyBxv_DYWpZk&Wr~qevXMcexuKa7S1lI+pHK+B delta 32 ncmX@hc9v~}DYHaMYKn<@s*#0Js%4U~v9V>cVOok3S1lI+r6~y`