Add profile bio markdown option
This commit is contained in:
parent
fc87e18044
commit
ebb0dec334
6 changed files with 18 additions and 3 deletions
|
@ -20,7 +20,7 @@ class Settings::ProfilesController < Settings::BaseController
|
|||
private
|
||||
|
||||
def account_params
|
||||
params.require(:account).permit(:display_name, :note, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value])
|
||||
params.require(:account).permit(:display_name, :note, :bio_markdown, :avatar, :header, :locked, :my_actor_type, :searchability, :dissubscribable, :group_allow_private_message, :discoverable, :hide_collections, fields_attributes: [:name, :value])
|
||||
end
|
||||
|
||||
def set_account
|
||||
|
|
|
@ -54,7 +54,7 @@ module FormattingHelper
|
|||
end
|
||||
|
||||
def account_bio_format(account)
|
||||
html_aware_format(account.note, account.local?, markdown: true)
|
||||
html_aware_format(account.note, account.local?, markdown: account.user&.setting_bio_markdown)
|
||||
end
|
||||
|
||||
def account_field_value_format(field, with_rel_me: true)
|
||||
|
|
|
@ -107,6 +107,10 @@ module HasUserSettings
|
|||
settings['theme']
|
||||
end
|
||||
|
||||
def setting_bio_markdown
|
||||
settings['bio_markdown']
|
||||
end
|
||||
|
||||
def setting_display_media
|
||||
settings['web.display_media']
|
||||
end
|
||||
|
|
|
@ -12,6 +12,7 @@ class UserSettings
|
|||
setting :theme, default: -> { ::Setting.theme }
|
||||
setting :noindex, default: -> { ::Setting.noindex }
|
||||
setting :noai, default: true
|
||||
setting :bio_markdown, default: false
|
||||
setting :hide_statuses_count, default: false
|
||||
setting :hide_following_count, default: false
|
||||
setting :hide_followers_count, default: false
|
||||
|
|
|
@ -5,6 +5,12 @@ class UpdateAccountService < BaseService
|
|||
was_locked = account.locked
|
||||
update_method = raise_error ? :update! : :update
|
||||
|
||||
if account.user && params.key?(:bio_markdown)
|
||||
user_params = { settings_attributes: { bio_markdown: params['bio_markdown'] } }
|
||||
params.delete(:bio_markdown)
|
||||
account.user.send(update_method, user_params)
|
||||
end
|
||||
|
||||
account.send(update_method, params).tap do |ret|
|
||||
next unless ret
|
||||
|
||||
|
|
|
@ -18,7 +18,11 @@
|
|||
= f.input :display_name, wrapper: :with_block_label, input_html: { maxlength: 30, data: { default: @account.username } }
|
||||
|
||||
.fields-group
|
||||
= f.input :note, wrapper: :with_block_label, input_html: { maxlength: 500 }
|
||||
= f.input :note, wrapper: :with_block_label, input_html: { maxlength: 500, rows: 8 }
|
||||
|
||||
= f.simple_fields_for :settings, current_user.settings do |ff|
|
||||
.fields-group
|
||||
= ff.input :bio_markdown, input_html: { name: 'account[bio_markdown]' }, wrapper: :with_label, kmyblue: true, label: I18n.t('simple_form.labels.defaults.setting_bio_markdown')
|
||||
|
||||
.fields-row__column.fields-group.fields-row__column-6
|
||||
.input.with_block_label
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue