瀏覽代碼

Update models, remove deprecated toText and toHtml methods

Daniel Supernault 2 年之前
父節點
當前提交
ea943333a5
共有 6 個文件被更改,包括 1 次插入102 次删除
  1. 0 16
      app/DirectMessage.php
  2. 0 16
      app/Follower.php
  3. 0 17
      app/Like.php
  4. 0 16
      app/Mention.php
  5. 1 5
      app/Services/ModLogService.php
  6. 0 32
      app/Status.php

+ 0 - 16
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.";
-    }
 }

+ 0 - 16
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 "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> ".
-          __('notification.startedFollowingYou');
-    }
 }

+ 0 - 17
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 "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> ".$msg;
-    }
 }

+ 0 - 16
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 "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> ".
-          __('notification.mentionedYou');
-    }
 }

+ 1 - 5
app/Services/ModLogService.php

@@ -108,8 +108,6 @@ class ModLogService {
 	{
 		$log = $this->log;
 
-		$msg = "{$log->user_username} commented on a modlog";
-		$rendered = "<span class='font-weight-bold'>{$log->user_username}</span> commented on a <a href='/i/admin/users/modlogs/{$log->user_id}}' class='font-weight-bold text-decoration-none'>modlog</a>";
 		$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();
 	}
-}
+}

+ 0 - 32
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 "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> ".
-		  __('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 "<a href='{$actorUrl}' class='profile-link'>{$actorName}</a> ".
-		  __('notification.shared');
-	}
-
 	public function recentComments()
 	{
 		return $this->comments()->orderBy('created_at', 'desc')->take(3);