diff --git a/app/graph/types/fact_check_type.rb b/app/graph/types/fact_check_type.rb index 9c02e75aff..0befd82e5b 100644 --- a/app/graph/types/fact_check_type.rb +++ b/app/graph/types/fact_check_type.rb @@ -13,4 +13,5 @@ class FactCheckType < DefaultObject field :tags, [GraphQL::Types::String, null: true], null: true field :rating, GraphQL::Types::String, null: true field :imported, GraphQL::Types::Boolean, null: true + field :report_status, GraphQL::Types::String, null: true end diff --git a/app/models/fact_check.rb b/app/models/fact_check.rb index 3c4514fe19..20e1988d8d 100644 --- a/app/models/fact_check.rb +++ b/app/models/fact_check.rb @@ -22,17 +22,17 @@ def text_fields end def project_media - self.claim_description&.project_media + self.claim_description.project_media end def team_id - self.project_media&.team_id + self.claim_description.team_id end private def set_language - languages = self.project_media&.team&.get_languages || ['en'] + languages = self.claim_description.team.get_languages || ['en'] self.language = languages.length == 1 ? languages.first : 'und' end @@ -41,7 +41,7 @@ def set_imported end def language_in_allowed_values - allowed_languages = self.project_media&.team&.get_languages || ['en'] + allowed_languages = self.claim_description.team.get_languages || ['en'] allowed_languages << 'und' errors.add(:language, I18n.t(:"errors.messages.invalid_article_language_value")) unless allowed_languages.include?(self.language) end diff --git a/db/migrate/20240714051039_add_unique_index_to_explainer_items.rb b/db/migrate/20240714051039_add_unique_index_to_explainer_items.rb new file mode 100644 index 0000000000..2778977a6a --- /dev/null +++ b/db/migrate/20240714051039_add_unique_index_to_explainer_items.rb @@ -0,0 +1,5 @@ +class AddUniqueIndexToExplainerItems < ActiveRecord::Migration[6.1] + def change + add_index :explainer_items, [:explainer_id, :project_media_id], unique: true + end +end diff --git a/db/schema.rb b/db/schema.rb index 4ce248bdca..93d2c2d614 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -10,7 +10,7 @@ # # It's strongly recommended that you check this file into your version control system. -ActiveRecord::Schema.define(version: 2024_07_13_012502) do +ActiveRecord::Schema.define(version: 2024_07_14_051039) do # These are extensions that must be enabled in order to support this database enable_extension "plpgsql" @@ -309,6 +309,7 @@ t.bigint "project_media_id" t.datetime "created_at", precision: 6, null: false t.datetime "updated_at", precision: 6, null: false + t.index ["explainer_id", "project_media_id"], name: "index_explainer_items_on_explainer_id_and_project_media_id", unique: true t.index ["explainer_id"], name: "index_explainer_items_on_explainer_id" t.index ["project_media_id"], name: "index_explainer_items_on_project_media_id" end diff --git a/lib/relay.idl b/lib/relay.idl index e5bb936d78..739bd21531 100644 --- a/lib/relay.idl +++ b/lib/relay.idl @@ -8388,6 +8388,7 @@ type FactCheck implements Node { language: String permissions: String rating: String + report_status: String summary: String tags: [String] title: String diff --git a/lib/rss_feed.rb b/lib/rss_feed.rb index 767a0eb413..76255bc003 100644 --- a/lib/rss_feed.rb +++ b/lib/rss_feed.rb @@ -18,7 +18,9 @@ def get_articles(count = 3) feed = RSS::Parser.parse(rss, false) unless feed.nil? feed.items.first(count).each do |item| - output << item.title.strip + "\n" + item.link.strip + title = item.title.kind_of?(String) ? item.title : item.title.content + link = item.link.kind_of?(String) ? item.link : item.link.href + output << title.to_s.strip + "\n" + link.to_s.strip end end end diff --git a/public/relay.json b/public/relay.json index 52fec3d85a..c65add1375 100644 --- a/public/relay.json +++ b/public/relay.json @@ -45423,6 +45423,20 @@ "isDeprecated": false, "deprecationReason": null }, + { + "name": "report_status", + "description": null, + "args": [ + + ], + "type": { + "kind": "SCALAR", + "name": "String", + "ofType": null + }, + "isDeprecated": false, + "deprecationReason": null + }, { "name": "summary", "description": null,