Migrate user mentions in lithium import
This commit is contained in:
parent
37ad2dd936
commit
bb12fa3fdc
|
@ -944,6 +944,21 @@ SQL
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# for user mentions
|
||||||
|
doc.css("li-user").each do |l|
|
||||||
|
uid = l["uid"]
|
||||||
|
|
||||||
|
if uid.present?
|
||||||
|
user = UserCustomField.find_by(name: 'import_id', value: uid).try(:user)
|
||||||
|
if user.present?
|
||||||
|
username = user.username
|
||||||
|
span = doc.create_element "span"
|
||||||
|
span.inner_html = "@#{username}"
|
||||||
|
l.replace span
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
raw = ReverseMarkdown.convert(doc.to_s)
|
raw = ReverseMarkdown.convert(doc.to_s)
|
||||||
raw.gsub!(/^\s* \s*$/, "")
|
raw.gsub!(/^\s* \s*$/, "")
|
||||||
# ugly quotes
|
# ugly quotes
|
||||||
|
|
Loading…
Reference in New Issue