diff --git a/app/models/user.rb b/app/models/user.rb index ff7535669..3c39bfb34 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -132,6 +132,7 @@ class User < ApplicationRecord length: { maximum: 500 } validates :inbox_type, inclusion: { in: %w[open private] } validates :currently_streaming_on, inclusion: { in: %w[twitch] }, allow_nil: true + validates :feed_referential_link, inclusion: [true, false] validate :conditionally_validate_summary validate :validate_mastodon_url validate :validate_feed_url, if: :feed_url_changed? diff --git a/app/policies/user_policy.rb b/app/policies/user_policy.rb index 0772ef18d..cabcfe69b 100644 --- a/app/policies/user_policy.rb +++ b/app/policies/user_policy.rb @@ -48,64 +48,67 @@ class UserPolicy < ApplicationPolicy end def permitted_attributes - %i[available_for - behance_url - bg_color_hex - config_theme - config_font - contact_consent - currently_hacking_on - currently_learning - display_sponsors - dribbble_url - education - email - email_badge_notifications - email_comment_notifications - email_digest_periodic - email_follower_notifications - email_membership_newsletter - email_tag_mod_newsletter - email_community_mod_newsletter - email_mention_notifications - email_connect_messages - email_newsletter - email_public - editor_version - email_unread_notifications - mobile_comment_notifications - employer_name - employer_url - employment_title - experience_level - facebook_url - feed_admin_publish_permission - feed_mark_canonical - feed_url - gitlab_url - inbox_guidelines - instagram_url - linkedin_url - location - looking_for_work - looking_for_work_publicly - mastodon_url - medium_url - mostly_work_with - name - inbox_type - permit_adjacent_sponsors - password - password_confirmation - profile_image - stackoverflow_url - summary - text_color_hex - twitch_url - twitch_username - username - website_url - export_requested] + %i[ + available_for + behance_url + bg_color_hex + config_font + config_theme + contact_consent + currently_hacking_on + currently_learning + display_sponsors + dribbble_url + editor_version + education + email + email_badge_notifications + email_comment_notifications + email_community_mod_newsletter + email_connect_messages + email_digest_periodic + email_follower_notifications + email_membership_newsletter + email_mention_notifications + email_newsletter + email_public + email_tag_mod_newsletter + email_unread_notifications + employer_name + employer_url + employment_title + experience_level + export_requested + facebook_url + feed_admin_publish_permission + feed_mark_canonical + feed_referential_link + feed_url + gitlab_url + inbox_guidelines + inbox_type + instagram_url + linkedin_url + location + looking_for_work + looking_for_work_publicly + mastodon_url + medium_url + mobile_comment_notifications + mostly_work_with + name + password + password_confirmation + permit_adjacent_sponsors + profile_image + stackoverflow_url + summary + text_color_hex + twitch_url + twitch_username + username + website_url + ] end private diff --git a/app/services/rss_reader/assembler.rb b/app/services/rss_reader/assembler.rb index e56e1df20..71e3ce7f0 100644 --- a/app/services/rss_reader/assembler.rb +++ b/app/services/rss_reader/assembler.rb @@ -56,7 +56,7 @@ class RssReader def thorough_parsing(content, feed_url) html_doc = Nokogiri::HTML(content) - find_and_replace_possible_links!(html_doc) + find_and_replace_possible_links!(html_doc) if @user.feed_referential_link if feed_url.include?("medium.com") parse_and_translate_gist_iframe!(html_doc) parse_and_translate_youtube_iframe!(html_doc) diff --git a/app/views/users/_publishing_from_rss.html.erb b/app/views/users/_publishing_from_rss.html.erb index 7ca5699dd..663e97d82 100644 --- a/app/views/users/_publishing_from_rss.html.erb +++ b/app/views/users/_publishing_from_rss.html.erb @@ -47,6 +47,14 @@ If you check this box, the post will automatically mark the feed source as the canonical URL. + +