Skip to content

Commit

Permalink
Support importing original claim with fact check
Browse files Browse the repository at this point in the history
  • Loading branch information
jayjay-w committed Jun 19, 2024
1 parent 94394bb commit 7d427c6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions app/graph/mutations/project_media_mutations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ class Create < Mutations::CreateMutation
argument :set_tags, JsonStringType, required: false, camelize: false
argument :set_title, GraphQL::Types::String, required: false, camelize: false
argument :set_status, GraphQL::Types::String, required: false, camelize: false # Status identifier (for example, "in_progress")
argument :set_original_claim, GraphQL::Types::String, required: false, camelize: false
end

class Update < Mutations::UpdateMutation
Expand Down
4 changes: 4 additions & 0 deletions app/models/concerns/project_media_creators.rb
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ def set_media_type
end
end

def create_original_claim

end

def set_jsonld_response(task)
jsonld = self.media.metadata['raw']['json+ld'] if self.media.metadata.has_key?('raw')
unless jsonld.nil?
Expand Down
3 changes: 2 additions & 1 deletion app/models/project_media.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class ProjectMedia < ApplicationRecord
attr_accessor :quote, :quote_attributions, :file, :media_type, :set_annotation, :set_tasks_responses, :previous_project_id, :cached_permissions, :is_being_created, :related_to_id, :skip_rules, :set_claim_description, :set_claim_context, :set_fact_check, :set_tags, :set_title, :set_status
attr_accessor :quote, :quote_attributions, :file, :media_type, :set_annotation, :set_tasks_responses, :previous_project_id, :cached_permissions, :is_being_created, :related_to_id, :skip_rules, :set_claim_description, :set_claim_context, :set_fact_check, :set_tags, :set_title, :set_status, :set_original_claim

belongs_to :media
has_one :claim_description
Expand Down Expand Up @@ -32,6 +32,7 @@ class ProjectMedia < ApplicationRecord
validates_presence_of :custom_title, if: proc { |pm| pm.title_field == 'custom_title' }

before_validation :set_team_id, :set_channel, :set_project_id, on: :create
before_validation :create_original_claim, on: :create
after_create :create_annotation, :create_metrics_annotation, :send_slack_notification, :create_relationship, :create_team_tasks, :create_claim_description_and_fact_check, :create_tags
after_create :add_source_creation_log, unless: proc { |pm| pm.source_id.blank? }
after_commit :apply_rules_and_actions_on_create, :set_quote_metadata, :notify_team_bots_create, on: [:create]
Expand Down

0 comments on commit 7d427c6

Please sign in to comment.