1
0
Fork 0
forked from gitea/nas

Add markdown selection support

This commit is contained in:
KMY 2023-04-12 10:16:46 +09:00
parent d4e0ef254d
commit 25c3915728
15 changed files with 76 additions and 7 deletions

View file

@ -15,6 +15,7 @@ class UpdateStatusService < BaseService
# @option options [String] :text
# @option options [String] :spoiler_text
# @option options [Boolean] :sensitive
# @option options [Boolean] :markdown
# @option options [String] :language
def call(status, account_id, options = {})
@status = status
@ -112,6 +113,7 @@ class UpdateStatusService < BaseService
def update_immediate_attributes!
@status.text = @options[:text].presence || @options.delete(:spoiler_text) || '' if @options.key?(:text)
@status.spoiler_text = @options[:spoiler_text] || '' if @options.key?(:spoiler_text)
@status.markdown = !!@options[:markdown]
@status.sensitive = @options[:sensitive] || @options[:spoiler_text].present? if @options.key?(:sensitive) || @options.key?(:spoiler_text)
@status.language = valid_locale_cascade(@options[:language], @status.language, @status.account.user&.preferred_posting_language, I18n.default_locale)