Skip to content

Commit

Permalink
fix: update author_metadata to handle author as UserGroup
Browse files Browse the repository at this point in the history
  • Loading branch information
Stef-Rousset committed Oct 10, 2024
1 parent 2796db2 commit ec114d6
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,11 @@ def author_metadata
phone_number: ""
}
if proposal.creator.decidim_author_type == "Decidim::UserBaseEntity"
user = Decidim::User.find proposal.creator_author.id
begin
user = Decidim::User.find proposal.creator_author.id
rescue ActiveRecord::RecordNotFound
user = Decidim::UserGroup.find proposal.creator_author.id
end

author_metadata[:name] = user.try(:name).presence || ""
author_metadata[:nickname] = user.try(:nickname).presence || ""
Expand Down

0 comments on commit ec114d6

Please sign in to comment.