diff options
| author | rr- <rr-@sakuya.pl> | 2016-10-21 22:34:45 +0200 |
|---|---|---|
| committer | rr- <rr-@sakuya.pl> | 2016-10-21 22:34:45 +0200 |
| commit | e71718c50d771003715ff393ecfd32a07154cd5b (patch) | |
| tree | a96fda5e21c55dc68e1652eaff4035aed4cac58a /server/szurubooru/func/posts.py | |
| parent | 9d6a0e0173831a6284be89cf71c1e627b4d8c0c9 (diff) | |
server/posts: add replaceContent to post merging
Diffstat (limited to 'server/szurubooru/func/posts.py')
| -rw-r--r-- | server/szurubooru/func/posts.py | 8 |
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) |