mirror of
https://github.com/leanote/desktop-app.git
synced 2025-10-16 08:01:53 +00:00
<- sync tag ok
This commit is contained in:
22
node_modules/tag.js
generated
vendored
22
node_modules/tag.js
generated
vendored
@@ -19,7 +19,7 @@ Count 笔记数
|
||||
var Tag = {
|
||||
|
||||
// 添加或更新标签
|
||||
addOrUpdateTag: function(title, callback) {
|
||||
addOrUpdateTag: function(title, callback, isForce) {
|
||||
var userId = User.getCurActiveUserId();
|
||||
Tags.findOne({UserId: userId, Tag: title}, function(err, tag) {
|
||||
// 存在, 则更新该tag下的笔记数量
|
||||
@@ -38,7 +38,7 @@ var Tag = {
|
||||
TagId: Common.objectId(),
|
||||
UserId: userId,
|
||||
Tag: title,
|
||||
IsDirty: true, // 新添加的
|
||||
IsDirty: !isForce, // 新添加的
|
||||
Count: 1,
|
||||
LocalIsDelete: false,
|
||||
CreatedTime: date,
|
||||
@@ -64,24 +64,34 @@ var Tag = {
|
||||
},
|
||||
|
||||
// 删除标签, 更新为LocaleIsDelete = true
|
||||
deleteTag: function(title, callback) {
|
||||
deleteTag: function(title, callback, isForce) {
|
||||
var me = this;
|
||||
Tags.update({UserId: User.getCurActiveUserId(), Tag: title}, {$set: {LocalIsDelete: true, UpdatedTime: new Date()}}, function() {
|
||||
Tags.update({UserId: User.getCurActiveUserId(), Tag: title}, {$set: {LocalIsDelete: true, IsDirty: !isForce, UpdatedTime: new Date()}}, function() {
|
||||
});
|
||||
// 笔记本
|
||||
//
|
||||
Note.updateNoteToDeleteTag(title, function(updates) {
|
||||
callback(updates);
|
||||
callback && callback(updates);
|
||||
});
|
||||
},
|
||||
|
||||
// 更新标签的数量, 在彻底删除笔记时调用
|
||||
updateTagCount: function(title, count) {
|
||||
userId = User.getCurActiveUserId();
|
||||
// 更新Tag's Count
|
||||
Tags.update({UserId: userId, Tag: title}, {$set: {Count: cnt}});
|
||||
// 更新web
|
||||
Web.updateTagCount({Tag: title, Count: cnt});
|
||||
},
|
||||
|
||||
getTag: function(title, callback) {
|
||||
userId = User.getCurActiveUserId();
|
||||
Tags.findOne({UserId: userId, Tag: title}, function(err, tag) {
|
||||
if(err || !tag) {
|
||||
return callback && callback(false);
|
||||
}
|
||||
callback && callback(tag);
|
||||
});
|
||||
}
|
||||
/*
|
||||
// 添加多个标签
|
||||
addTags: function(titles) {
|
||||
|
Reference in New Issue
Block a user