Skip to content

Commit

Permalink
Merge pull request #362 from codeforjapan/develop
Browse files Browse the repository at this point in the history
Fix error in /debates/versions
  • Loading branch information
ayuki-joto authored Apr 11, 2022
2 parents f381ae2 + a28bdf7 commit 52fd425
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion app/controllers/decidim/debates/versions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def versioned_resource

def show
description = current_version.object_changes
if description.size > OBJECT_CHANGE_SIZE_LIMIT
if description && description.size > OBJECT_CHANGE_SIZE_LIMIT
flash[:alert] = I18n.t("debates.versions.too_large_changeset", scope: "decidim.debates")
redirect_to action: :index
end
Expand Down
6 changes: 5 additions & 1 deletion app/models/decidim/user_base_entity.rb
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,11 @@ def only_public(klass, ids)
scope = klass.where(id: ids)
scope = scope.public_spaces if klass.try(:participatory_space?)
scope = scope.includes(:component) if klass.try(:has_component?)
scope = scope.filter(&:visible?) if klass.method_defined?(:visible?)
begin
scope = scope.filter(&:visible?) if klass.method_defined?(:visible?)
rescue StandardError => _e
# Ignore `undefined local variable or method 'component'` error
end
scope
end
end
Expand Down

0 comments on commit 52fd425

Please sign in to comment.