Skip to content

Commit

Permalink
WIP Prevent editing of erased comments
Browse files Browse the repository at this point in the history
  • Loading branch information
garethrees committed Jul 11, 2024
1 parent 86efc1b commit 3b93bba
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/models/comment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,10 @@ def erase(**kwargs)
Comment::Erasure.new(self, **kwargs).erase
end

def erased?
info_request_events.erase_comment_events.any?
end

def cached_urls
[
request_path(info_request),
Expand Down
4 changes: 2 additions & 2 deletions app/views/admin_comment/edit.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
<%= form_tag admin_comment_path(@comment), :method => 'put' do %>

<p><label for="comment_body">Body of annotation</label><br/>
<%= text_area 'comment', 'body', :rows => 10, :cols => 60 %></p>
<%= text_area 'comment', 'body', :rows => 10, :cols => 60, disabled: @comment.erased? %></p>

<p><label for="comment_visible">Visible</label>
<%= select('comment', "visible", [["Yes – show comment",true],["No – hide comment",false]]) %>
<%= select('comment', "visible", [["Yes – show comment",true],["No – hide comment",false]], disabled: @comment.erased?) %>
</p>

<p><label for="comment_attention_requested">Admin attention requested</label>
Expand Down

0 comments on commit 3b93bba

Please sign in to comment.