From 14377933a73eab02ce2b03b2901786f0e9723a8e Mon Sep 17 00:00:00 2001 From: Shyam Sunder Date: Sat, 6 Oct 2018 12:00:48 -0400 Subject: [PATCH] server/func/posts: transfer flags on merge --- server/szurubooru/func/posts.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/server/szurubooru/func/posts.py b/server/szurubooru/func/posts.py index 97a69f8a..fe81d05d 100644 --- a/server/szurubooru/func/posts.py +++ b/server/szurubooru/func/posts.py @@ -736,6 +736,11 @@ def merge_posts( .values(child_id=target_post_id)) db.session.execute(update_stmt) + def transfer_flags(source_post_id: int, target_post_id: int) -> None: + target = get_post_by_id(target_post_id) + source = get_post_by_id(source_post_id) + target.flags = source.flags + merge_tags(source_post.post_id, target_post.post_id) merge_comments(source_post.post_id, target_post.post_id) merge_scores(source_post.post_id, target_post.post_id) @@ -745,6 +750,7 @@ def merge_posts( content = None if replace_content: content = files.get(get_post_content_path(source_post)) + transfer_flags(source_post.post_id, target_post.post_id) delete(source_post) db.session.flush()