editHistory.blade.php
1.16 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php
$edits = [];
if (isset($comment->meta['edited'])) {
foreach ($comment->meta['edited'] as $edit) {
$edit = json_decode($edit, true);
if ($edit['action'] === 'edit') {
$edits[] = $edit;
} elseif ($edit['action'] == 'delete' && $user() && $user()->getRole() >= 20) {
$edits[] = $edit;
} elseif ($edit['action'] == 'undelete' && $user() && $user()->getRole() >= 20) {
$edits[] = $edit;
}
}
}
?>
@if ($edits)
<ul class="comment-edit-history">
@foreach ($edits as $edit)
@if ($edit['action'] === 'edit')
<li>{!! date('M j, Y \a\t H:i', strtotime($edit['created_at'])) !!} · comment edited by {!! $edit['username'] !!}</li>
@elseif ($edit['action'] == 'delete')
<li>
{!! date('M j, Y \a\t H:i', strtotime($edit['created_at'])) !!} · comment deleted by {!! $edit['username'] !!}
@if (!empty($edit['reason']))
for "{!! $edit['reason'] !!}"
@endif
</li>
@elseif ($edit['action'])
<li>{!! date('M j, Y \a\t H:i', strtotime($edit['created_at'])) !!} · comment approved by {!! $edit['username'] !!}</li>
@endif
@endforeach
</ul>
@endif