内容的IsBlog没有note IsBlog一致, 导致前端判断有问题
This commit is contained in:
@ -430,7 +430,7 @@ func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bso
|
|||||||
if isBlog, ok := needUpdate["IsBlog"]; ok {
|
if isBlog, ok := needUpdate["IsBlog"]; ok {
|
||||||
isBlog2 := isBlog.(bool)
|
isBlog2 := isBlog.(bool)
|
||||||
if note.IsBlog != isBlog2 {
|
if note.IsBlog != isBlog2 {
|
||||||
db.UpdateByIdAndUserIdMap(db.NoteContents, noteId, userId, bson.M{"IsBlog": isBlog2})
|
this.UpdateNoteContentIsBlog(noteId, userId, isBlog2);
|
||||||
|
|
||||||
// 重新发布成博客
|
// 重新发布成博客
|
||||||
if !note.IsBlog {
|
if !note.IsBlog {
|
||||||
@ -471,6 +471,11 @@ func (this *NoteService) UpdateNote(updatedUserId, noteId string, needUpdate bso
|
|||||||
return true, "", afterUsn
|
return true, "", afterUsn
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 当设置/取消了笔记为博客
|
||||||
|
func (this *NoteService) UpdateNoteContentIsBlog(noteId, userId string, isBlog bool) {
|
||||||
|
db.UpdateByIdAndUserIdMap(db.NoteContents, noteId, userId, bson.M{"IsBlog": isBlog})
|
||||||
|
}
|
||||||
|
|
||||||
// 附件修改, 增加noteIncr
|
// 附件修改, 增加noteIncr
|
||||||
func (this *NoteService) IncrNoteUsn(noteId, userId string) int {
|
func (this *NoteService) IncrNoteUsn(noteId, userId string) int {
|
||||||
afterUsn := userService.IncrUsn(userId)
|
afterUsn := userService.IncrUsn(userId)
|
||||||
@ -584,6 +589,8 @@ func (this *NoteService) ToBlog(userId, noteId string, isBlog, isTop bool) bool
|
|||||||
ok := db.UpdateByIdAndUserIdMap(db.Notes, noteId, userId, noteUpdate)
|
ok := db.UpdateByIdAndUserIdMap(db.Notes, noteId, userId, noteUpdate)
|
||||||
// 重新计算tags
|
// 重新计算tags
|
||||||
go (func() {
|
go (func() {
|
||||||
|
this.UpdateNoteContentIsBlog(noteId, userId, isBlog);
|
||||||
|
|
||||||
blogService.ReCountBlogTags(userId)
|
blogService.ReCountBlogTags(userId)
|
||||||
})()
|
})()
|
||||||
return ok
|
return ok
|
||||||
|
Reference in New Issue
Block a user