Skip to content

Commit

Permalink
Remove deleted authors from history feed
Browse files Browse the repository at this point in the history
  • Loading branch information
AntonKhorev committed Sep 18, 2024
1 parent 5e1e31f commit 9296094
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 2 deletions.
4 changes: 2 additions & 2 deletions app/views/changesets/index.atom.builder
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
entry.title t(".feed.title", :id => changeset.id)
end

if changeset.user.data_public?
if changeset.user.data_public? && changeset.user.status != "deleted"
entry.author do |author|
author.name changeset.user.display_name
author.uri user_url(changeset.user, :only_path => false)
Expand All @@ -48,7 +48,7 @@ atom_feed(:language => I18n.locale, :schema_date => 2009,
tr.th t(".feed.closed")
tr.td l(changeset.closed_at)
end
if changeset.user.data_public?
if changeset.user.data_public? && changeset.user.status != "deleted"
table.tr do |tr|
tr.th t(".feed.belongs_to")
tr.td do |td|
Expand Down
22 changes: 22 additions & 0 deletions test/controllers/changesets_controller_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -484,6 +484,28 @@ def test_feed_max_id
assert_redirected_to :action => :feed
end

##
# Checks if author fields are visible only for non-deleted users
def test_feed_author
user = create(:user)
create(:changeset, :user => user, :num_changes => 1)

get history_feed_path(:format => :atom, :display_name => user.display_name)
assert_response :success
assert_select "feed entry", :count => 1 do
assert_select "author", :count => 1
assert_select "content xhtml|table xhtml|th", :text => "Author", :count => 1
end

user.hide!
get history_feed_path(:format => :atom, :display_name => user.display_name)
assert_response :success
assert_select "feed entry", :count => 1 do
assert_select "author", :count => 0
assert_select "content xhtml|table xhtml|th", :text => "Author", :count => 0
end
end

def test_subscribe_page
user = create(:user)
other_user = create(:user)
Expand Down

0 comments on commit 9296094

Please sign in to comment.