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
174b1a03
Commit
174b1a03
authored
Jun 17, 2025
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: fix linter
parent
760c1643
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
20 deletions
+19
-20
activity_service.proto
proto/api/v1/activity_service.proto
+1
-3
test_helper.go
server/router/api/v1/test/test_helper.go
+1
-1
test_auth.go
server/router/api/v1/test_auth.go
+5
-5
webhook_service.go
server/router/api/v1/webhook_service.go
+12
-11
No files found.
proto/api/v1/activity_service.proto
View file @
174b1a03
...
...
@@ -122,8 +122,6 @@ message GetActivityRequest {
// Format: activities/{id}, id is the system generated auto-incremented id.
string
name
=
1
[
(
google.api.field_behavior
)
=
REQUIRED
,
(
google.api.resource_reference
)
=
{
type
:
"memos.api.v1/Activity"
}
(
google.api.resource_reference
)
=
{
type
:
"memos.api.v1/Activity"
}
];
}
server/router/api/v1/test/test_helper.go
View file @
174b1a03
...
...
@@ -75,7 +75,7 @@ func (ts *TestService) CreateRegularUser(ctx context.Context, username string) (
}
// CreateUserContext creates a context with the given username for authentication.
func
(
ts
*
TestService
)
CreateUserContext
(
ctx
context
.
Context
,
username
string
)
context
.
Context
{
func
(
*
TestService
)
CreateUserContext
(
ctx
context
.
Context
,
username
string
)
context
.
Context
{
// Use the real context key from the parent package
return
apiv1
.
CreateTestUserContext
(
ctx
,
username
)
}
server/router/api/v1/test_auth.go
View file @
174b1a03
...
...
@@ -6,14 +6,14 @@ import (
"github.com/usememos/memos/store"
)
// CreateTestUserContext creates a context with username for testing purposes
// This function is only intended for use in tests
// CreateTestUserContext creates a context with username for testing purposes
.
// This function is only intended for use in tests
.
func
CreateTestUserContext
(
ctx
context
.
Context
,
username
string
)
context
.
Context
{
return
context
.
WithValue
(
ctx
,
usernameContextKey
,
username
)
}
// CreateTestUserContextWithUser creates a context and ensures the user exists for testing
// This function is only intended for use in tests
func
CreateTestUserContextWithUser
(
ctx
context
.
Context
,
s
*
APIV1Service
,
user
*
store
.
User
)
context
.
Context
{
// CreateTestUserContextWithUser creates a context and ensures the user exists for testing
.
// This function is only intended for use in tests
.
func
CreateTestUserContextWithUser
(
ctx
context
.
Context
,
_
*
APIV1Service
,
user
*
store
.
User
)
context
.
Context
{
return
context
.
WithValue
(
ctx
,
usernameContextKey
,
user
.
Username
)
}
server/router/api/v1/webhook_service.go
View file @
174b1a03
...
...
@@ -25,19 +25,20 @@ func (s *APIV1Service) CreateWebhook(ctx context.Context, request *v1pb.CreateWe
return
nil
,
status
.
Errorf
(
codes
.
Unauthenticated
,
"user not authenticated"
)
}
// Only host users can create webhooks
if
!
isSuperUser
(
currentUser
)
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
// Only host users can create webhooks
if
!
isSuperUser
(
currentUser
)
{
return
nil
,
status
.
Errorf
(
codes
.
PermissionDenied
,
"permission denied"
)
}
// Validate required fields
if
request
.
Webhook
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"webhook is required"
)
}
if
strings
.
TrimSpace
(
request
.
Webhook
.
Url
)
==
""
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"webhook URL is required"
)
}
// Validate required fields
if
request
.
Webhook
==
nil
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"webhook is required"
)
}
if
strings
.
TrimSpace
(
request
.
Webhook
.
Url
)
==
""
{
return
nil
,
status
.
Errorf
(
codes
.
InvalidArgument
,
"webhook URL is required"
)
}
// TODO: Handle webhook_id, validate_only, and request_id fields
// TODO: Handle webhook_id, validate_only, and request_id fields
if
request
.
ValidateOnly
{
// Perform validation checks without actually creating the webhook
return
&
v1pb
.
Webhook
{
...
...
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