Skip to content

Commit

Permalink
adds original_claim to Media object
Browse files Browse the repository at this point in the history
  • Loading branch information
vasconsaurus committed Jan 22, 2025
1 parent ac32e83 commit 18d07c9
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions app/models/concerns/project_media_creators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ def create_media_from_url(type, url, ext)
klass = type.constantize
file = download_file(url, ext)
m = klass.new
m.original_claim = url
m.file = file
m.save!
m
Expand All @@ -99,14 +100,14 @@ def download_file(url, ext)
end

def create_claim_media(text)
Claim.create!(quote: text)
Claim.create!(quote: text, original_claim: text)
end

def create_link_media(url)
team = self.team || Team.current
pender_key = team.get_pender_key if team
url_from_pender = Link.normalized(url, pender_key)
Link.find_by(url: url_from_pender) || Link.create!(url: url, pender_key: pender_key)
Link.find_by(url: url_from_pender) || Link.create!(url: url, pender_key: pender_key, original_claim: url)
end

def set_quote_metadata
Expand Down

0 comments on commit 18d07c9

Please sign in to comment.