删除笔记时删除历史
This commit is contained in:
@ -85,6 +85,9 @@ func (this *TrashService) DeleteTrash(noteId, userId string) bool {
|
|||||||
// delete content
|
// delete content
|
||||||
ok = db.DeleteByIdAndUserId(db.NoteContents, noteId, userId)
|
ok = db.DeleteByIdAndUserId(db.NoteContents, noteId, userId)
|
||||||
|
|
||||||
|
// 删除content history
|
||||||
|
ok = db.DeleteByIdAndUserId(db.NoteContentHistories, noteId, userId)
|
||||||
|
|
||||||
// 重新统计tag's count
|
// 重新统计tag's count
|
||||||
// TODO 这里会改变tag's Usn
|
// TODO 这里会改变tag's Usn
|
||||||
tagService.reCountTagCount(userId, note.Tags)
|
tagService.reCountTagCount(userId, note.Tags)
|
||||||
@ -115,6 +118,13 @@ func (this *TrashService) DeleteTrashApi(noteId, userId string, usn int) (bool,
|
|||||||
// delete content
|
// delete content
|
||||||
ok = db.DeleteByIdAndUserId(db.NoteContents, noteId, userId)
|
ok = db.DeleteByIdAndUserId(db.NoteContents, noteId, userId)
|
||||||
|
|
||||||
|
// 删除content history
|
||||||
|
ok = db.DeleteByIdAndUserId(db.NoteContentHistories, noteId, userId)
|
||||||
|
|
||||||
|
// 一个BUG, iOS删除直接调用这个API, 结果没有重新recount
|
||||||
|
// recount notebooks' notes number
|
||||||
|
notebookService.ReCountNotebookNumberNotes(note.NotebookId.Hex())
|
||||||
|
|
||||||
return ok, "", afterUsn
|
return ok, "", afterUsn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user