Add markdown selection support
This commit is contained in:
parent
d4e0ef254d
commit
25c3915728
15 changed files with 76 additions and 7 deletions
|
@ -24,6 +24,7 @@ class PostStatusService < BaseService
|
|||
# @option [String] :visibility
|
||||
# @option [String] :searchability
|
||||
# @option [String] :spoiler_text
|
||||
# @option [Boolean] :markdown
|
||||
# @option [String] :language
|
||||
# @option [String] :scheduled_at
|
||||
# @option [Hash] :poll Optional poll to attach
|
||||
|
@ -69,6 +70,7 @@ class PostStatusService < BaseService
|
|||
@visibility = :unlisted if (@visibility&.to_sym == :public || @visibility&.to_sym == :public_unlisted) && @account.silenced?
|
||||
@visibility = :public_unlisted if @visibility&.to_sym == :public && !@options[:application]&.superapp && @account.user&.setting_public_post_to_unlisted
|
||||
@searchability= searchability
|
||||
@markdown = !!@options[:markdown]
|
||||
@scheduled_at = @options[:scheduled_at]&.to_datetime
|
||||
@scheduled_at = nil if scheduled_in_the_past?
|
||||
rescue ArgumentError
|
||||
|
@ -214,6 +216,7 @@ class PostStatusService < BaseService
|
|||
poll_attributes: poll_attributes,
|
||||
sensitive: @sensitive,
|
||||
spoiler_text: @options[:spoiler_text] || '',
|
||||
markdown: @markdown,
|
||||
visibility: @visibility,
|
||||
searchability: @searchability,
|
||||
language: valid_locale_cascade(@options[:language], @account.user&.preferred_posting_language, I18n.default_locale),
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue