* Add: #406 ユーザーのカスタムCSS * Fix lint * Fix lint * カスタムCSSの保存先を変更 * キャッシュを考慮して別URLに変更
This commit is contained in:
parent
5ffd7593f1
commit
665c632d66
28 changed files with 283 additions and 4 deletions
|
@ -101,6 +101,8 @@ class User < ApplicationRecord
|
|||
accepts_nested_attributes_for :invite_request, reject_if: ->(attributes) { attributes['text'].blank? && !Setting.require_invite_text }
|
||||
validates :invite_request, presence: true, on: :create, if: :invite_text_required?
|
||||
|
||||
has_one :custom_css, inverse_of: :user, dependent: :destroy
|
||||
|
||||
validates :email, presence: true, email_address: true
|
||||
|
||||
validates_with UserEmailValidator, if: -> { ENV['EMAIL_DOMAIN_LISTS_APPLY_AFTER_CONFIRMATION'] == 'true' || !confirmed? }
|
||||
|
@ -227,6 +229,22 @@ class User < ApplicationRecord
|
|||
prepare_returning_user!
|
||||
end
|
||||
|
||||
def disable_css
|
||||
false
|
||||
end
|
||||
|
||||
def custom_css_text
|
||||
custom_css&.css.to_s
|
||||
end
|
||||
|
||||
def custom_css_text=(val)
|
||||
if custom_css.present?
|
||||
custom_css.update!(css: val)
|
||||
else
|
||||
CustomCss.create!(user: self, css: val)
|
||||
end
|
||||
end
|
||||
|
||||
def pending?
|
||||
!approved?
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue