Always get the bug commenter name from the user if there is one
This commit is contained in:
parent
a2495c843e
commit
63e9c4771a
3 changed files with 11 additions and 15 deletions
|
@ -9,4 +9,12 @@ class MapBugComment < ActiveRecord::Base
|
||||||
validates_uniqueness_of :id
|
validates_uniqueness_of :id
|
||||||
validates_presence_of :visible
|
validates_presence_of :visible
|
||||||
validates_presence_of :date_created
|
validates_presence_of :date_created
|
||||||
|
|
||||||
|
def commenter_name
|
||||||
|
if self.commenter_id.nil?
|
||||||
|
self.read_attribute(:commenter_name)
|
||||||
|
else
|
||||||
|
self.user.display_name
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -12,14 +12,8 @@ xml.bug("lon" => bug.lon, "lat" => bug.lat) do
|
||||||
bug.map_bug_comment.each do |comment|
|
bug.map_bug_comment.each do |comment|
|
||||||
xml.comment do
|
xml.comment do
|
||||||
xml.date comment.date_created
|
xml.date comment.date_created
|
||||||
|
xml.uid comment.commenter_id unless comment.commenter_id.nil?
|
||||||
unless comment.commenter_id.nil?
|
xml.user comment.commenter_name
|
||||||
xml.uid comment.commenter_id
|
|
||||||
xml.user comment.user.display_name
|
|
||||||
else
|
|
||||||
xml.user comment.commenter_name
|
|
||||||
end
|
|
||||||
|
|
||||||
xml.text comment.comment
|
xml.text comment.comment
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -35,13 +35,7 @@ xml.rss("version" => "2.0",
|
||||||
description_text += comment.map_bug.flatten_comment("<br>", comment.date_created)
|
description_text += comment.map_bug.flatten_comment("<br>", comment.date_created)
|
||||||
|
|
||||||
xml.description description_text
|
xml.description description_text
|
||||||
|
xml.author comment.commenter_name
|
||||||
if comment.user.nil?
|
|
||||||
xml.author comment.commenter_name
|
|
||||||
else
|
|
||||||
xml.author comment.user.display_name
|
|
||||||
end
|
|
||||||
|
|
||||||
xml.pubDate comment.date_created.to_s(:rfc822)
|
xml.pubDate comment.date_created.to_s(:rfc822)
|
||||||
xml.geo :lat, comment.map_bug.lat
|
xml.geo :lat, comment.map_bug.lat
|
||||||
xml.geo :long, comment.map_bug.lon
|
xml.geo :long, comment.map_bug.lon
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue