Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improvements for notes with deleted authors #5627

Merged
merged 2 commits into from
Feb 6, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/notes_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def show

@note_includes_anonymous = @note.author.nil? || @note_comments.find { |comment| comment.author.nil? }

@note_comments = @note_comments.drop(1) unless !@note.author.nil? && @note.author.status == "deleted"
@note_comments = @note_comments.drop(1) if @note.author.nil? || @note.author.active?
rescue ActiveRecord::RecordNotFound
render :template => "browse/not_found", :status => :not_found
end
Expand Down
9 changes: 9 additions & 0 deletions test/controllers/notes_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,15 @@ def test_read_note_hidden_user_comment
assert_select "div.note-comments ul li", :count => 1
end

def test_read_note_hidden_opener
hidden_user = create(:user, :deleted)
note_with_hidden_opener = create(:note)
create(:note_comment, :author => hidden_user, :note => note_with_hidden_opener)

sidebar_browse_check :note_path, note_with_hidden_opener.id, "notes/show"
assert_select "div.note-comments ul li", :count => 0
end

def test_read_closed_note
user = create(:user)
closed_note = create(:note_with_comments, :closed, :closed_by => user, :comments_count => 2)
Expand Down