Allow editing comments

This commit is contained in:
David Hoppenbrouwers
2022-10-08 14:11:28 +02:00
parent 47f92b2d83
commit bba6bee92c
5 changed files with 62 additions and 2 deletions

View File

@@ -268,5 +268,20 @@ class DB:
return True
return False
def modify_comment(self, comment_id, user_id, text, time):
db = self._db()
c = db.cursor()
c.execute('''
update comments
set text = ?, modify_time = ?
where comment_id = ? and author_id = ?
''',
(text, time, comment_id, user_id)
)
if c.rowcount > 0:
db.commit()
return True
return False
def _db(self):
return sqlite3.connect(self.conn)