Update column references to be compatible with Trace 2024-02-05
This commit is contained in:
parent
cb8925463f
commit
845cb82a95
@ -18,12 +18,12 @@ class ModeratorAction extends Model
|
|||||||
/**
|
/**
|
||||||
* Return a human-readable version of the action
|
* Return a human-readable version of the action
|
||||||
*
|
*
|
||||||
|
* @param bool $asHtml If true then the returned string will be outputted as raw HTML. Defaults to false.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function formatted($asHtml = false) : string
|
public function formatted($asHtml = false) : string
|
||||||
{
|
{
|
||||||
$cmd = $this->action;
|
$cmd = $this->action;
|
||||||
$discriminator = $this->discriminator;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Only bans, unbans will be implicitly handled by default format.
|
* Only bans, unbans will be implicitly handled by default format.
|
||||||
@ -46,12 +46,14 @@ public function formatted($asHtml = false) : string
|
|||||||
return sprintf('/%s %s %s %s', $cmd, $this->targetName($asHtml), $message, $this->message_id);
|
return sprintf('/%s %s %s %s', $cmd, $this->targetName($asHtml), $message, $this->message_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
if ($cmd === 'slow') {
|
||||||
* Timeouts
|
$duration = $this->duration;
|
||||||
*/
|
return sprintf('/%s %s', $cmd, $duration);
|
||||||
|
}
|
||||||
|
|
||||||
if ($cmd === 'timeout') {
|
if ($cmd === 'timeout') {
|
||||||
$duration = $this->timeout_duration;
|
$duration = $this->duration;
|
||||||
$reason = $this->timeout_reason;
|
$reason = $this->reason;
|
||||||
if ($asHtml) {
|
if ($asHtml) {
|
||||||
$reason = htmlspecialchars($reason);
|
$reason = htmlspecialchars($reason);
|
||||||
}
|
}
|
||||||
@ -59,8 +61,14 @@ public function formatted($asHtml = false) : string
|
|||||||
return sprintf('/%s %s %s %s', $cmd, $this->targetName($asHtml), $duration, $reason ?? '');
|
return sprintf('/%s %s %s %s', $cmd, $this->targetName($asHtml), $duration, $reason ?? '');
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($discriminator === 'TermAction') {
|
if (str_contains($cmd, 'unban_request')) {
|
||||||
$text = $this->text;
|
$message = $this->moderator_message ?? '';
|
||||||
|
return sprintf('/%s %s %s', $cmd, $this->targetName($asHtml), $message);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Added / blocked terms via Automod
|
||||||
|
if (str_contains($cmd, '_term')) {
|
||||||
|
$text = $this->term_text;
|
||||||
if ($asHtml) {
|
if ($asHtml) {
|
||||||
$text = htmlspecialchars($text);
|
$text = htmlspecialchars($text);
|
||||||
}
|
}
|
||||||
@ -74,7 +82,7 @@ public function formatted($asHtml = false) : string
|
|||||||
/**
|
/**
|
||||||
* Get the target name of the action, if any
|
* Get the target name of the action, if any
|
||||||
*
|
*
|
||||||
* @param bool $linkToViewerPage Returns an HTML link to the viewer page
|
* @param bool $linkToViewerPage Returns an HTML link to the viewer page instead of just the plaintext name. Defaults to false.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function targetName($linkToViewerPage = false) : ?string
|
public function targetName($linkToViewerPage = false) : ?string
|
||||||
@ -92,17 +100,6 @@ public function targetName($linkToViewerPage = false) : ?string
|
|||||||
return sprintf($format, route('viewer', ['viewer' => $id]), $name);
|
return sprintf($format, route('viewer', ['viewer' => $id]), $name);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!empty($this->targeted_moderator_action_target_name)) {
|
|
||||||
$name = $this->targeted_moderator_action_target_name;
|
|
||||||
|
|
||||||
if (!$linkToViewerPage) {
|
|
||||||
return $name;
|
|
||||||
}
|
|
||||||
|
|
||||||
$id = $this->target_id ?? $name;
|
|
||||||
return sprintf($format, route('viewer', ['viewer' => $id]), $name);
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user