Bumped version to 8.4; move comments when moving post

This commit is contained in:
Jaakko Keränen 2024-02-02 07:42:39 +02:00
parent 2c53b11bbf
commit b3f14d09ad
No known key found for this signature in database
GPG Key ID: BACCFCFB98DB2EDC
3 changed files with 10 additions and 1 deletions

View File

@ -18,7 +18,7 @@ from utils import *
from worker import *
__version__ = '8.3'
__version__ = '8.4'
class Bubble:

View File

@ -343,7 +343,10 @@ def make_composer_page(session):
return 50, "Cannot move to an issue tracker subspace"
if dst_sub.owner and dst_sub.owner != post.user:
return 50, "Cannot move to another user's subspace"
oldsub_id = post.subspace
db.update_post(post, subspace_id=dst_sub.id)
db.move_comments(post, oldsub_id, dst_sub.id)
# Notify as if the post was new.
db.notify_followed_about_post(post)

View File

@ -2297,6 +2297,12 @@ class Database:
self.update_post_summary(post)
self.unpublish_if_empty(post)
def move_comments(self, post: Post, oldsub_id, newsub_id):
cur = self.conn.cursor()
cur.execute("UPDATE posts SET subspace=? WHERE subspace=? AND parent=?",
(newsub_id, oldsub_id, post.id))
self.commit()
def notify_mentioned(self, post, content, old_content=None):
names = parse_at_names(content)
post_user = self.get_user(id=post.user)