FIX: compatibility after allowlist rewording in Discourse

This commit is contained in:
Krzysztof Kotlarek 2020-07-15 09:34:02 +10:00
parent 075883ba5a
commit 10c31ffbd5
1 changed files with 10 additions and 2 deletions

View File

@ -250,9 +250,17 @@ SQL
mount ::DiscourseSolved::Engine, at: "solution" mount ::DiscourseSolved::Engine, at: "solution"
end end
# TODO Drop after Discourse 2.6.0 release
if TopicView.respond_to?(:add_post_custom_fields_whitelister)
TopicView.add_post_custom_fields_whitelister do |user| TopicView.add_post_custom_fields_whitelister do |user|
["is_accepted_answer"] ["is_accepted_answer"]
end end
else
TopicView.add_post_custom_fields_allowlister do |user|
["is_accepted_answer"]
end
end
def get_schema_text(post) def get_schema_text(post)
post.excerpt(nil, keep_onebox_body: true).presence || post.excerpt(nil, keep_onebox_body: true, keep_quotes: true) post.excerpt(nil, keep_onebox_body: true).presence || post.excerpt(nil, keep_onebox_body: true, keep_quotes: true)