docbrown/app/models/settings/community.rb
Jeremy Friesen 25f0681c4f
Validating community does not include < nor > (#15482)
If a community name has a < or > it may cause havoc when the community
attempts to send an email.

Closes #15274
2021-11-29 10:55:02 -05:00

25 lines
835 B
Ruby

module Settings
class Community < Base
self.table_name = :settings_communities
setting :copyright_start_year,
type: :integer,
default: ApplicationConfig["COMMUNITY_COPYRIGHT_START_YEAR"] || Time.zone.today.year
setting :community_description, type: :string
setting :community_emoji, type: :string, default: "🌱", validates: { emoji_only: true }
setting(
:community_name,
type: :string,
default: ApplicationConfig["COMMUNITY_NAME"] || "New Forem",
validates: {
format: {
with: /\A[^[<|>]]+\Z/,
message: "may not include the \"<\" nor \">\" character"
}
},
)
setting :member_label, type: :string, default: "user"
setting :staff_user_id, type: :integer, default: 1
setting :tagline, type: :string
end
end