From d1bafd66c89201fc6cae502194c50a7b02579617 Mon Sep 17 00:00:00 2001 From: Zeng1998 Date: Tue, 7 Mar 2023 19:36:36 +0800 Subject: [PATCH] feat: allow to filter memos with resources (#1299) --- web/src/helpers/filter.ts | 6 ++++++ web/src/locales/en.json | 3 ++- web/src/locales/zh.json | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/web/src/helpers/filter.ts b/web/src/helpers/filter.ts index f41a1eb1..29ccbc1c 100644 --- a/web/src/helpers/filter.ts +++ b/web/src/helpers/filter.ts @@ -43,6 +43,10 @@ export const filterConsts = { text: "filter.value.linked", value: "LINKED", }, + { + text: "filter.value.has-attachment", + value: "HAS_ATTACHMENT", + }, ], }, TEXT: { @@ -179,6 +183,8 @@ export const checkShouldShowMemo = (memo: Memo, filter: Filter) => { matched = true; } else if (value === "LINKED" && memo.content.match(LINK_REG) !== null) { matched = true; + } else if (value === "HAS_ATTACHMENT" && memo.resourceList.length > 0) { + matched = true; } if (operator === "IS_NOT") { matched = !matched; diff --git a/web/src/locales/en.json b/web/src/locales/en.json index 1c01a6e0..b9cdb42c 100644 --- a/web/src/locales/en.json +++ b/web/src/locales/en.json @@ -136,7 +136,8 @@ }, "value": { "not-tagged": "No tags", - "linked": "Has links" + "linked": "Has links", + "has-attachment": "Has attachments" }, "text-placeholder": "Starts with ^ to use regex" }, diff --git a/web/src/locales/zh.json b/web/src/locales/zh.json index f7f4bde1..6c323ea6 100644 --- a/web/src/locales/zh.json +++ b/web/src/locales/zh.json @@ -136,7 +136,8 @@ }, "value": { "not-tagged": "无标签", - "linked": "包含链接" + "linked": "包含链接", + "has-attachment": "包含附件" }, "text-placeholder": "以 ^ 开头使用正则表达式" },