diff --git a/includes/Models/Paste.php b/includes/Models/Paste.php index 550aba6..f3c2321 100644 --- a/includes/Models/Paste.php +++ b/includes/Models/Paste.php @@ -14,8 +14,9 @@ class Paste extends Model { protected $guarded = []; protected $casts = [ - 'visible' => 'integer', - 'encrypt' => 'boolean' + 'visible' => 'integer', + 'encrypt' => 'boolean', + 'deleted_at' => 'datetime', ]; public $timestamps = false; @@ -23,6 +24,10 @@ class Paste extends Model { return $this->belongsTo(User::class); } + public function deletedBy() { + return $this->belongsTo(User::class, 'deleted_by_id'); + } + public function tags() { return $this->belongsToMany(Tag::class, 'paste_taggings'); } diff --git a/public/admin/paste_action.php b/public/admin/paste_action.php index 019b4b2..334b5a8 100644 --- a/public/admin/paste_action.php +++ b/public/admin/paste_action.php @@ -31,6 +31,11 @@ if (isset($_POST['hide'])) { if ($is_hidden) { $paste->reports()->update(['open' => false]); + $paste->deleted_at = date_create(); + $paste->deleted_by_id = $current_user->id; + } else { + $paste->deleted_at = null; + $paste->deleted_by_id = null; } $paste->is_hidden = $is_hidden; diff --git a/public/transparency.php b/public/transparency.php new file mode 100644 index 0000000..24b526d --- /dev/null +++ b/public/transparency.php @@ -0,0 +1,18 @@ +with(['user' => function($q) { $q->select('id', 'username'); }]) + ->where('is_hidden', true) + ->orderBy('deleted_at', 'desc') + ->limit(20) + ->get(); + +$page_template = 'transparency'; +$page_title = 'Transparency'; + +require_once(__DIR__ . '/../theme/' . $default_theme . '/common.php'); diff --git a/theme/bulma/common.php b/theme/bulma/common.php index 5a77389..8f9c738 100644 --- a/theme/bulma/common.php +++ b/theme/bulma/common.php @@ -295,7 +295,7 @@ $flashes = getFlashes();
diff --git a/theme/bulma/transparency.php b/theme/bulma/transparency.php new file mode 100644 index 0000000..c10f183 --- /dev/null +++ b/theme/bulma/transparency.php @@ -0,0 +1,31 @@ +
+
+
+
+

Transparency

+

These are the most recently deleted pastes on the site.

+

For pastes deleted on or before October 30, 2024, pastes will show as deleted on October 30, 2024.

+ + + + + + + + + + + + + + + + + + + +
IDAuthorTitleDeleted At
id ?>user->username) ?>title) ?>deleted_at ?: 'Unknown') ?>
+
+
+
+
\ No newline at end of file