From ea943333a50ee6a579165a715abb489b2adb6b57 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Sat, 13 May 2023 00:43:46 -0600 Subject: [PATCH] Update models, remove deprecated toText and toHtml methods --- app/DirectMessage.php | 16 ---------------- app/Follower.php | 16 ---------------- app/Like.php | 17 ----------------- app/Mention.php | 16 ---------------- app/Services/ModLogService.php | 6 +----- app/Status.php | 32 -------------------------------- 6 files changed, 1 insertion(+), 102 deletions(-) diff --git a/app/DirectMessage.php b/app/DirectMessage.php index 2f4ea7872..ee109aee2 100644 --- a/app/DirectMessage.php +++ b/app/DirectMessage.php @@ -31,20 +31,4 @@ class DirectMessage extends Model { return Auth::user()->profile->id === $this->from_id; } - - public function toText() - { - $actorName = $this->author->username; - - return "{$actorName} sent a direct message."; - } - - public function toHtml() - { - $actorName = $this->author->username; - $actorUrl = $this->author->url(); - $url = $this->url(); - - return "{$actorName} sent a direct message."; - } } diff --git a/app/Follower.php b/app/Follower.php index 9ec6d9f65..7415a7fe8 100644 --- a/app/Follower.php +++ b/app/Follower.php @@ -32,20 +32,4 @@ class Follower extends Model $path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}"); return url($path); } - - public function toText() - { - $actorName = $this->actor->username; - - return "{$actorName} ".__('notification.startedFollowingYou'); - } - - public function toHtml() - { - $actorName = $this->actor->username; - $actorUrl = $this->actor->url(); - - return "{$actorName} ". - __('notification.startedFollowingYou'); - } } diff --git a/app/Like.php b/app/Like.php index 2c2cd80f9..c5b000c66 100644 --- a/app/Like.php +++ b/app/Like.php @@ -31,21 +31,4 @@ class Like extends Model { return $this->belongsTo(Status::class); } - - public function toText($type = 'post') - { - $actorName = $this->actor->username; - $msg = $type == 'post' ? __('notification.likedPhoto') : __('notification.likedComment'); - - return "{$actorName} ".$msg; - } - - public function toHtml($type = 'post') - { - $actorName = $this->actor->username; - $actorUrl = $this->actor->url(); - $msg = $type == 'post' ? __('notification.likedPhoto') : __('notification.likedComment'); - - return "{$actorName} ".$msg; - } } diff --git a/app/Mention.php b/app/Mention.php index e0c30d35c..fab8d9c86 100644 --- a/app/Mention.php +++ b/app/Mention.php @@ -29,20 +29,4 @@ class Mention extends Model { return $this->belongsTo(Status::class, 'status_id', 'id'); } - - public function toText() - { - $actorName = $this->status->profile->username; - - return "{$actorName} ".__('notification.mentionedYou'); - } - - public function toHtml() - { - $actorName = $this->status->profile->username; - $actorUrl = $this->status->profile->url(); - - return "{$actorName} ". - __('notification.mentionedYou'); - } } diff --git a/app/Services/ModLogService.php b/app/Services/ModLogService.php index e8e44465f..2f4674610 100644 --- a/app/Services/ModLogService.php +++ b/app/Services/ModLogService.php @@ -108,8 +108,6 @@ class ModLogService { { $log = $this->log; - $msg = "{$log->user_username} commented on a modlog"; - $rendered = "{$log->user_username} commented on a modlog"; $item_id = $log->id; $item_type = 'App\ModLog'; $action = 'admin.user.modlog.comment'; @@ -127,8 +125,6 @@ class ModLogService { $n->item_id = $item_id; $n->item_type = $item_type; $n->action = $action; - $n->message = $msg; - $n->rendered = $rendered; $n->save(); } } @@ -139,4 +135,4 @@ class ModLogService { ->whereItemId($this->log->id) ->delete(); } -} \ No newline at end of file +} diff --git a/app/Status.php b/app/Status.php index ae4ea299d..183c18023 100644 --- a/app/Status.php +++ b/app/Status.php @@ -285,38 +285,6 @@ class Status extends Model return $obj; } - public function replyToText() - { - $actorName = $this->profile->username; - - return "{$actorName} ".__('notification.commented'); - } - - public function replyToHtml() - { - $actorName = $this->profile->username; - $actorUrl = $this->profile->url(); - - return "{$actorName} ". - __('notification.commented'); - } - - public function shareToText() - { - $actorName = $this->profile->username; - - return "{$actorName} ".__('notification.shared'); - } - - public function shareToHtml() - { - $actorName = $this->profile->username; - $actorUrl = $this->profile->url(); - - return "{$actorName} ". - __('notification.shared'); - } - public function recentComments() { return $this->comments()->orderBy('created_at', 'desc')->take(3);