mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
The posts rebake task should regenerate links too.
This commit is contained in:
parent
526f2af69a
commit
f268b882fd
@ -139,7 +139,7 @@ class TopicLink < ActiveRecord::Base
|
|||||||
if topic_id.present?
|
if topic_id.present?
|
||||||
topic = Topic.where(id: topic_id).first
|
topic = Topic.where(id: topic_id).first
|
||||||
|
|
||||||
if topic && post.topic.archetype != 'private_message' && topic.archetype != 'private_message'
|
if topic && post.topic && post.topic.archetype != 'private_message' && topic.archetype != 'private_message'
|
||||||
|
|
||||||
prefix = Discourse.base_url
|
prefix = Discourse.base_url
|
||||||
|
|
||||||
|
@ -3,11 +3,13 @@ task "posts:rebake" => :environment do
|
|||||||
RailsMultisite::ConnectionManagement.each_connection do |db|
|
RailsMultisite::ConnectionManagement.each_connection do |db|
|
||||||
puts "Re baking post markdown for #{db} , changes are denoted with # , no change with ."
|
puts "Re baking post markdown for #{db} , changes are denoted with # , no change with ."
|
||||||
i = 0
|
i = 0
|
||||||
Post.select([:id, :cooked, :raw, :topic_id]).each do |p|
|
Post.select([:id, :user_id, :cooked, :raw, :topic_id, :post_number]).each do |p|
|
||||||
i += 1
|
i += 1
|
||||||
cooked = p.cook(p.raw, topic_id: p.topic_id)
|
cooked = p.cook(p.raw, topic_id: p.topic_id)
|
||||||
if cooked != p.cooked
|
if cooked != p.cooked
|
||||||
Post.exec_sql('update posts set cooked = ? where id = ?', cooked, p.id)
|
Post.exec_sql('update posts set cooked = ? where id = ?', cooked, p.id)
|
||||||
|
p.cooked = cooked
|
||||||
|
TopicLink.extract_from(p)
|
||||||
putc "#"
|
putc "#"
|
||||||
else
|
else
|
||||||
putc "."
|
putc "."
|
||||||
|
Loading…
Reference in New Issue
Block a user