FEATURE: Update the topic excerpt when the OP is rebaked (#9852)

* We now have a site setting "topic_excerpt_maxlength" that is used when the OP is created or revised to generate a topic excerpt.
* However, posts created before this setting was introduced cannot benefit from this change unless they are revised, and if the topic excerpt length setting is changed that situation is also not covererd.
* This PR makes a change to rebake! to update the topic excerpt IF the post is the OP.
This commit is contained in:
Martin Brennan
2020-05-22 13:04:15 +10:00
committed by GitHub
parent c0779df99d
commit f9d55b4941
4 changed files with 31 additions and 5 deletions

View File

@@ -1476,6 +1476,13 @@ class Topic < ActiveRecord::Base
private_topic
end
def update_excerpt(excerpt)
update_column(:excerpt, excerpt)
if archetype == "banner"
ApplicationController.banner_json_cache.clear
end
end
def pm_with_non_human_user?
sql = <<~SQL
SELECT 1 FROM topics