mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow posting a link with topics
This commit is contained in:
@@ -95,6 +95,23 @@ class PostRevisor
|
||||
end
|
||||
end
|
||||
|
||||
track_topic_field(:featured_link) do |topic_changes, featured_link|
|
||||
if SiteSetting.topic_featured_link_enabled &&
|
||||
featured_link.present? &&
|
||||
topic_changes.guardian.can_edit_featured_link?(topic_changes.topic.category_id)
|
||||
|
||||
topic_changes.record_change('featured_link', topic_changes.topic.featured_link, featured_link)
|
||||
topic_changes.topic.featured_link = featured_link
|
||||
|
||||
if SiteSetting.topic_featured_link_onebox
|
||||
post = topic_changes.topic.first_post
|
||||
post.raw = DiscourseFeaturedLink.cache_onebox_link(featured_link)
|
||||
post.save!
|
||||
post.rebake!
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# AVAILABLE OPTIONS:
|
||||
# - revised_at: changes the date of the revision
|
||||
# - force_new_version: bypass ninja-edit window
|
||||
|
||||
Reference in New Issue
Block a user