summaryrefslogtreecommitdiff
path: root/server/szurubooru/func/posts.py
diff options
context:
space:
mode:
authorrr- <rr-@sakuya.pl>2016-10-21 22:34:45 +0200
committerrr- <rr-@sakuya.pl>2016-10-21 22:34:45 +0200
commite71718c50d771003715ff393ecfd32a07154cd5b (patch)
treea96fda5e21c55dc68e1652eaff4035aed4cac58a /server/szurubooru/func/posts.py
parent9d6a0e0173831a6284be89cf71c1e627b4d8c0c9 (diff)
server/posts: add replaceContent to post merging
Diffstat (limited to 'server/szurubooru/func/posts.py')
-rw-r--r--server/szurubooru/func/posts.py8
1 files changed, 7 insertions, 1 deletions
diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py
index f3725e5..1ca70fc 100644
--- a/server/szurubooru/func/posts.py
+++ b/server/szurubooru/func/posts.py
@@ -442,7 +442,7 @@ def delete(post):
db.session.delete(post)
-def merge_posts(source_post, target_post):
+def merge_posts(source_post, target_post, replace_content):
assert source_post
assert target_post
if source_post.post_id == target_post.post_id:
@@ -515,3 +515,9 @@ def merge_posts(source_post, target_post):
merge_relations(source_post.post_id, target_post.post_id)
delete(source_post)
+
+ db.session.flush()
+
+ if replace_content:
+ content = files.get(get_post_content_path(source_post))
+ update_post_content(target_post, content)