mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 04:53:17 +00:00
Update models, remove deprecated toText and toHtml methods
This commit is contained in:
parent
58ec49fd57
commit
ea943333a5
6 changed files with 1 additions and 102 deletions
|
@ -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.";
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
17
app/Like.php
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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue