Skip to content

Commit

Permalink
Merge pull request #236 from ndijkstra/dont-log-when-vote
Browse files Browse the repository at this point in the history
Don't log when voting on a comment
  • Loading branch information
Cannonb4ll authored Jul 22, 2023
2 parents 1e309fe + 16e4d5c commit 0f0e5c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 4 additions & 1 deletion app/Models/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,10 @@ public function mentions()

public function getActivitylogOptions(): LogOptions
{
return LogOptions::defaults()->logOnly(['content'])->logOnlyDirty();
return LogOptions::defaults()
->logOnly(['content'])
->dontLogIfAttributesChangedOnly(['total_votes', 'updated_at'])
->logOnlyDirty();
}

public function scopePublic($query)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@
</thead>
<tbody class="divide-y whitespace-nowrap">
@foreach($comment->activities()->latest()->get() as $activity)
@unless(isset($activity->changes['old']['content']))
@continue
@endunless

<tr class="divide-x">
<td class="px-4 py-3">{{ $activity->created_at->isoFormat('L LTS') }}</td>
<td class="px-4 py-3 break-words whitespace-pre-line prose">{!! str($activity->changes['old']['content'])->markdown()->sanitizeHtml() !!}</td>
Expand Down

0 comments on commit 0f0e5c2

Please sign in to comment.