Update models, remove deprecated toText and toHtml methods

This commit is contained in:
Daniel Supernault 2023-05-13 00:43:46 -06:00
parent 58ec49fd57
commit ea943333a5
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
6 changed files with 1 additions and 102 deletions

View file

@ -31,20 +31,4 @@ class DirectMessage extends Model
{ {
return Auth::user()->profile->id === $this->from_id; 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.";
}
} }

View file

@ -32,20 +32,4 @@ class Follower extends Model
$path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}"); $path = $this->actor->permalink("#accepts/follows/{$this->id}{$append}");
return url($path); 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');
}
} }

View file

@ -31,21 +31,4 @@ class Like extends Model
{ {
return $this->belongsTo(Status::class); 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;
}
} }

View file

@ -29,20 +29,4 @@ class Mention extends Model
{ {
return $this->belongsTo(Status::class, 'status_id', 'id'); 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');
}
} }

View file

@ -108,8 +108,6 @@ class ModLogService {
{ {
$log = $this->log; $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_id = $log->id;
$item_type = 'App\ModLog'; $item_type = 'App\ModLog';
$action = 'admin.user.modlog.comment'; $action = 'admin.user.modlog.comment';
@ -127,8 +125,6 @@ class ModLogService {
$n->item_id = $item_id; $n->item_id = $item_id;
$n->item_type = $item_type; $n->item_type = $item_type;
$n->action = $action; $n->action = $action;
$n->message = $msg;
$n->rendered = $rendered;
$n->save(); $n->save();
} }
} }
@ -139,4 +135,4 @@ class ModLogService {
->whereItemId($this->log->id) ->whereItemId($this->log->id)
->delete(); ->delete();
} }
} }

View file

@ -285,38 +285,6 @@ class Status extends Model
return $obj; 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() public function recentComments()
{ {
return $this->comments()->orderBy('created_at', 'desc')->take(3); return $this->comments()->orderBy('created_at', 'desc')->take(3);