Skip to content

Commit

Permalink
Improve config serializer for Keybase (mastodon#10338)
Browse files Browse the repository at this point in the history
- Regex must no longer be surrounded by `/`
- Description must be short and cannot contain HTML tags
  • Loading branch information
Gargron authored and hiyuki2578 committed Oct 2, 2019
1 parent 1c54cc4 commit 0956060
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions app/lib/proof_provider/keybase/config_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

class ProofProvider::Keybase::ConfigSerializer < ActiveModel::Serializer
include RoutingHelper
include ActionView::Helpers::TextHelper

attributes :version, :domain, :display_name, :username,
:brand_color, :logo, :description, :prefill_url,
Expand Down Expand Up @@ -29,11 +30,11 @@ def brand_color
end

def description
Setting.site_short_description.presence || Setting.site_description.presence || I18n.t('about.about_mastodon_html')
strip_tags(Setting.site_short_description.presence || I18n.t('about.about_mastodon_html'))
end

def username
{ min: 1, max: 30, re: Account::USERNAME_RE.inspect }
{ min: 1, max: 30, re: '[a-z0-9_]+([a-z0-9_\.-]+[a-z0-9_]+)?' }
end

def prefill_url
Expand Down
2 changes: 1 addition & 1 deletion app/serializers/manifest_serializer.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ def short_name
end

def description
strip_tags(object.site_description.presence || I18n.t('about.about_mastodon_html'))
strip_tags(object.site_short_description.presence || I18n.t('about.about_mastodon_html'))
end

def icons
Expand Down

0 comments on commit 0956060

Please sign in to comment.