Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
canifa_note
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Vũ Hoàng Anh
canifa_note
Commits
339fecbf
Commit
339fecbf
authored
Apr 18, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: allow search comments
parent
2cdcd17b
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
11 additions
and
3 deletions
+11
-3
memo_service.go
server/route/api/v2/memo_service.go
+8
-0
CreateMemoRelationDialog.tsx
web/src/components/CreateMemoRelationDialog.tsx
+1
-1
EmbeddedMemo.tsx
...c/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
+1
-1
ReferencedMemo.tsx
...mponents/MemoContent/ReferencedContent/ReferencedMemo.tsx
+1
-1
No files found.
server/route/api/v2/memo_service.go
View file @
339fecbf
...
...
@@ -667,6 +667,9 @@ func (s *APIV2Service) buildMemoFindWithFilter(ctx context.Context, find *store.
if
filter
.
Limit
!=
nil
{
find
.
Limit
=
filter
.
Limit
}
if
filter
.
IncludeComments
{
find
.
ExcludeComments
=
false
}
}
// If the user is not authenticated, only public memos are visible.
...
...
@@ -703,6 +706,7 @@ var SearchMemosFilterCELAttributes = []cel.EnvOption{
cel
.
Variable
(
"row_status"
,
cel
.
StringType
),
cel
.
Variable
(
"random"
,
cel
.
BoolType
),
cel
.
Variable
(
"limit"
,
cel
.
IntType
),
cel
.
Variable
(
"include_comments"
,
cel
.
BoolType
),
}
type
SearchMemosFilter
struct
{
...
...
@@ -716,6 +720,7 @@ type SearchMemosFilter struct {
RowStatus
*
store
.
RowStatus
Random
bool
Limit
*
int
IncludeComments
bool
}
func
parseSearchMemosFilter
(
expression
string
)
(
*
SearchMemosFilter
,
error
)
{
...
...
@@ -779,6 +784,9 @@ func findSearchMemosField(callExpr *expr.Expr_Call, filter *SearchMemosFilter) {
}
else
if
idExpr
.
Name
==
"limit"
{
limit
:=
int
(
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetInt64Value
())
filter
.
Limit
=
&
limit
}
else
if
idExpr
.
Name
==
"include_comments"
{
value
:=
callExpr
.
Args
[
1
]
.
GetConstExpr
()
.
GetBoolValue
()
filter
.
IncludeComments
=
value
}
return
}
...
...
web/src/components/CreateMemoRelationDialog.tsx
View file @
339fecbf
...
...
@@ -30,7 +30,7 @@ const CreateMemoRelationDialog: React.FC<Props> = (props: Props) => {
async
()
=>
{
setIsFetching
(
true
);
try
{
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
];
const
filters
=
[
`creator == "
${
user
.
name
}
"`
,
`row_status == "NORMAL"`
,
`include_comments == true`
];
if
(
searchText
)
{
filters
.
push
(
`content_search == [
${
JSON
.
stringify
(
searchText
)}
]`
);
}
...
...
web/src/components/MemoContent/EmbeddedContent/EmbeddedMemo.tsx
View file @
339fecbf
...
...
@@ -21,7 +21,7 @@ const EmbeddedMemo = ({ resourceId, params: paramsStr }: Props) => {
const
resourceName
=
`memos/
${
resourceId
}
`
;
useEffect
(()
=>
{
memoStore
.
searchMemos
(
`uid == "
${
resourceId
}
"`
).
finally
(()
=>
loadingState
.
setFinish
());
memoStore
.
searchMemos
(
`uid == "
${
resourceId
}
"
&& include_comments == true
`
).
finally
(()
=>
loadingState
.
setFinish
());
},
[
resourceId
]);
if
(
loadingState
.
isLoading
)
{
...
...
web/src/components/MemoContent/ReferencedContent/ReferencedMemo.tsx
View file @
339fecbf
...
...
@@ -17,7 +17,7 @@ const ReferencedMemo = ({ resourceId, params: paramsStr }: Props) => {
const
params
=
new
URLSearchParams
(
paramsStr
);
useEffect
(()
=>
{
memoStore
.
searchMemos
(
`uid == "
${
resourceId
}
"`
).
finally
(()
=>
loadingState
.
setFinish
());
memoStore
.
searchMemos
(
`uid == "
${
resourceId
}
"
&& include_comments == true
`
).
finally
(()
=>
loadingState
.
setFinish
());
},
[
resourceId
]);
if
(
loadingState
.
isLoading
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment