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
3b8bfe72
Commit
3b8bfe72
authored
Jul 27, 2025
by
Johnny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: linter
parent
c5d497a1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
user_service.go
server/router/api/v1/user_service.go
+10
-10
No files found.
server/router/api/v1/user_service.go
View file @
3b8bfe72
...
...
@@ -947,15 +947,15 @@ func (s *APIV1Service) DeleteUserWebhook(ctx context.Context, request *v1pb.Dele
// Helper functions for webhook operations
// generateUserWebhookID generates a unique ID for user webhooks
// generateUserWebhookID generates a unique ID for user webhooks
.
func
generateUserWebhookID
()
string
{
b
:=
make
([]
byte
,
8
)
rand
.
Read
(
b
)
return
hex
.
EncodeToString
(
b
)
}
// parseUserWebhookName parses a webhook name and returns the webhook ID and user ID
// Format: users/{user}/webhooks/{webhook}
// parseUserWebhookName parses a webhook name and returns the webhook ID and user ID
.
// Format: users/{user}/webhooks/{webhook}
.
func
parseUserWebhookName
(
name
string
)
(
string
,
int32
,
error
)
{
parts
:=
strings
.
Split
(
name
,
"/"
)
if
len
(
parts
)
!=
4
||
parts
[
0
]
!=
"users"
||
parts
[
2
]
!=
"webhooks"
{
...
...
@@ -970,7 +970,7 @@ func parseUserWebhookName(name string) (string, int32, error) {
return
parts
[
3
],
int32
(
userID
),
nil
}
// convertUserWebhookFromUserSetting converts a storepb webhook to a v1pb UserWebhook
// convertUserWebhookFromUserSetting converts a storepb webhook to a v1pb UserWebhook
.
func
convertUserWebhookFromUserSetting
(
webhook
*
storepb
.
WebhooksUserSetting_Webhook
,
userID
int32
)
*
v1pb
.
UserWebhook
{
return
&
v1pb
.
UserWebhook
{
Name
:
fmt
.
Sprintf
(
"users/%d/webhooks/%s"
,
userID
,
webhook
.
Id
),
...
...
@@ -1046,8 +1046,8 @@ func extractImageInfo(dataURI string) (string, string, error) {
// Helper functions for user settings
// ExtractUserIDAndSettingKeyFromName extracts user ID and setting key from resource name
// e.g., "users/123/settings/general" -> 123, "general"
// ExtractUserIDAndSettingKeyFromName extracts user ID and setting key from resource name
.
// e.g., "users/123/settings/general" -> 123, "general"
.
func
ExtractUserIDAndSettingKeyFromName
(
name
string
)
(
int32
,
string
,
error
)
{
// Expected format: users/{user}/settings/{setting}
parts
:=
strings
.
Split
(
name
,
"/"
)
...
...
@@ -1064,7 +1064,7 @@ func ExtractUserIDAndSettingKeyFromName(name string) (int32, string, error) {
return
userID
,
settingKey
,
nil
}
// convertSettingKeyToStore converts API setting key to store enum
// convertSettingKeyToStore converts API setting key to store enum
.
func
convertSettingKeyToStore
(
key
string
)
(
storepb
.
UserSetting_Key
,
error
)
{
switch
key
{
case
"general"
:
...
...
@@ -1082,7 +1082,7 @@ func convertSettingKeyToStore(key string) (storepb.UserSetting_Key, error) {
}
}
// convertSettingKeyFromStore converts store enum to API setting key
// convertSettingKeyFromStore converts store enum to API setting key
.
func
convertSettingKeyFromStore
(
key
storepb
.
UserSetting_Key
)
string
{
switch
key
{
case
storepb
.
UserSetting_GENERAL
:
...
...
@@ -1100,7 +1100,7 @@ func convertSettingKeyFromStore(key storepb.UserSetting_Key) string {
}
}
// convertUserSettingFromStore converts store UserSetting to API UserSetting
// convertUserSettingFromStore converts store UserSetting to API UserSetting
.
func
convertUserSettingFromStore
(
storeSetting
*
storepb
.
UserSetting
,
userID
int32
,
key
storepb
.
UserSetting_Key
)
*
v1pb
.
UserSetting
{
if
storeSetting
==
nil
{
// Return default setting if none exists
...
...
@@ -1238,7 +1238,7 @@ func convertUserSettingFromStore(storeSetting *storepb.UserSetting, userID int32
return
setting
}
// convertUserSettingToStore converts API UserSetting to store UserSetting
// convertUserSettingToStore converts API UserSetting to store UserSetting
.
func
convertUserSettingToStore
(
apiSetting
*
v1pb
.
UserSetting
,
userID
int32
,
key
storepb
.
UserSetting_Key
)
(
*
storepb
.
UserSetting
,
error
)
{
storeSetting
:=
&
storepb
.
UserSetting
{
UserId
:
userID
,
...
...
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