A privacy-first, self-hosted, fully open source personal knowledge management software, written in typescript and golang. (PERSONAL FORK)

:art: API `getTag` add an optional parameter `ignoreMaxListHint` https://github.com/siyuan-note/siyuan/issues/16000

Signed-off-by: Daniel <845765@qq.com>

Daniel 9f3cd7ca 53f0467f

+31 -8
+6 -2
app/src/layout/dock/Files.ts
··· 751 751 fetchPost("/api/filetree/listDocsByPath", { 752 752 notebook: toURL, 753 753 path: toDir === "/" ? "/" : toDir + ".sy", 754 + app: Constants.SIYUAN_APPID, 754 755 }, response => { 755 756 if (response.data.path === "/" && response.data.files.length === 0) { 756 757 showMessage(window.siyuan.languages.emptyContent); ··· 1123 1124 } else if (filePath.startsWith(item.path.replace(".sy", ""))) { 1124 1125 const response = await fetchSyncPost("/api/filetree/listDocsByPath", { 1125 1126 notebook: data.box, 1126 - path: item.path 1127 + path: item.path, 1128 + app: Constants.SIYUAN_APPID, 1127 1129 }); 1128 1130 newLiElement = await this.selectItem(response.data.box, filePath, response.data, setStorage, isSetCurrent); 1129 1131 } ··· 1160 1162 fetchPost("/api/filetree/listDocsByPath", { 1161 1163 notebook: notebookId, 1162 1164 path: liElement.getAttribute("data-path"), 1165 + app: Constants.SIYUAN_APPID, 1163 1166 }, response => { 1164 1167 if (response.data.path === "/" && response.data.files.length === 0) { 1165 1168 newFile({ ··· 1215 1218 } else { 1216 1219 const response = await fetchSyncPost("/api/filetree/listDocsByPath", { 1217 1220 notebook: notebookId, 1218 - path: currentPath 1221 + path: currentPath, 1222 + app: Constants.SIYUAN_APPID, 1219 1223 }); 1220 1224 liElement = await this.onLsSelect(response.data, filePath, setStorage, isSetCurrent); 1221 1225 }
+5 -2
app/src/mobile/dock/MobileFiles.ts
··· 603 603 } else if (filePath.startsWith(item.path.replace(".sy", ""))) { 604 604 const response = await fetchSyncPost("/api/filetree/listDocsByPath", { 605 605 notebook: data.box, 606 - path: item.path 606 + path: item.path, 607 + app: Constants.SIYUAN_APPID, 607 608 }); 608 609 newLiElement = await this.selectItem(response.data.box, filePath, response.data, setStorage, isSetCurrent); 609 610 } ··· 640 641 fetchPost("/api/filetree/listDocsByPath", { 641 642 notebook: notebookId, 642 643 path: liElement.getAttribute("data-path"), 644 + app: Constants.SIYUAN_APPID, 643 645 }, response => { 644 646 if (response.data.path === "/" && response.data.files.length === 0) { 645 647 newFile({ ··· 695 697 } else { 696 698 const response = await fetchSyncPost("/api/filetree/listDocsByPath", { 697 699 notebook: notebookId, 698 - path: currentPath 700 + path: currentPath, 701 + app: Constants.SIYUAN_APPID, 699 702 }); 700 703 liElement = await this.onLsSelect(response.data, filePath, setStorage, isSetCurrent); 701 704 }
+1
app/src/util/pathName.ts
··· 607 607 notebook: notebookId, 608 608 path: liElement.getAttribute("data-path"), 609 609 flashcard, 610 + app: Constants.SIYUAN_APPID, 610 611 }, response => { 611 612 if (response.data.files.length === 0) { 612 613 showMessage(window.siyuan.languages.emptyContent);
+5 -1
kernel/api/filetree.go
··· 1075 1075 // API `listDocsByPath` add an optional parameter `ignoreMaxListHint` https://github.com/siyuan-note/siyuan/issues/10290 1076 1076 ignoreMaxListHintArg := arg["ignoreMaxListHint"] 1077 1077 if nil == ignoreMaxListHintArg || !ignoreMaxListHintArg.(bool) { 1078 - util.PushMsg(fmt.Sprintf(model.Conf.Language(48), len(files)), 7000) 1078 + var app string 1079 + if nil != arg["app"] { 1080 + app = arg["app"].(string) 1081 + } 1082 + util.PushMsgWithApp(app, fmt.Sprintf(model.Conf.Language(48), len(files)), 7000) 1079 1083 } 1080 1084 } 1081 1085
+2 -1
kernel/api/tag.go
··· 50 50 ignoreMaxListHint = ignoreMaxListHintArg.(bool) 51 51 } 52 52 53 - ret.Data = model.BuildTags(ignoreMaxListHint) 53 + app := arg["app"].(string) 54 + ret.Data = model.BuildTags(ignoreMaxListHint, app) 54 55 } 55 56 56 57 func renameTag(c *gin.Context) {
+2 -2
kernel/model/tag.go
··· 236 236 237 237 type Tags []*Tag 238 238 239 - func BuildTags(ignoreMaxListHintArg bool) (ret *Tags) { 239 + func BuildTags(ignoreMaxListHintArg bool, appID string) (ret *Tags) { 240 240 FlushTxQueue() 241 241 sql.FlushQueue() 242 242 ··· 255 255 *tmp = append(*tmp, tag) 256 256 countTag(tag, &total) 257 257 if Conf.FileTree.MaxListCount < total && !ignoreMaxListHintArg { 258 - util.PushMsg(fmt.Sprintf(Conf.Language(243), Conf.FileTree.MaxListCount), 7000) 258 + util.PushMsgWithApp(appID, fmt.Sprintf(Conf.Language(243), Conf.FileTree.MaxListCount), 7000) 259 259 break 260 260 } 261 261 }
+10
kernel/util/websocket.go
··· 163 163 return 164 164 } 165 165 166 + func PushMsgWithApp(app, msg string, timeout int) (msgId string) { 167 + msgId = gulu.Rand.String(7) 168 + if "" == app { 169 + BroadcastByType("main", "msg", 0, msg, map[string]interface{}{"id": msgId, "closeTimeout": timeout}) 170 + return 171 + } 172 + BroadcastByTypeAndApp("main", app, "msg", 0, msg, map[string]interface{}{"id": msgId, "closeTimeout": timeout}) 173 + return 174 + } 175 + 166 176 func PushErrMsg(msg string, timeout int) (msgId string) { 167 177 msgId = gulu.Rand.String(7) 168 178 BroadcastByType("main", "msg", -1, msg, map[string]interface{}{"id": msgId, "closeTimeout": timeout})