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
33e9b136
Commit
33e9b136
authored
Mar 31, 2024
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: tweak linter
parent
b79f626a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
42 additions
and
12 deletions
+42
-12
inbox_service.go
server/route/api/v2/inbox_service.go
+4
-12
TagsSection.tsx
web/src/components/ExploreSidebar/TagsSection.tsx
+38
-0
No files found.
server/route/api/v2/inbox_service.go
View file @
33e9b136
...
@@ -30,11 +30,7 @@ func (s *APIV2Service) ListInboxes(ctx context.Context, _ *apiv2pb.ListInboxesRe
...
@@ -30,11 +30,7 @@ func (s *APIV2Service) ListInboxes(ctx context.Context, _ *apiv2pb.ListInboxesRe
Inboxes
:
[]
*
apiv2pb
.
Inbox
{},
Inboxes
:
[]
*
apiv2pb
.
Inbox
{},
}
}
for
_
,
inbox
:=
range
inboxes
{
for
_
,
inbox
:=
range
inboxes
{
inboxMessage
,
err
:=
s
.
convertInboxFromStore
(
ctx
,
inbox
)
response
.
Inboxes
=
append
(
response
.
Inboxes
,
convertInboxFromStore
(
inbox
))
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to convert inbox from store: %v"
,
err
)
}
response
.
Inboxes
=
append
(
response
.
Inboxes
,
inboxMessage
)
}
}
return
response
,
nil
return
response
,
nil
...
@@ -66,12 +62,8 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
...
@@ -66,12 +62,8 @@ func (s *APIV2Service) UpdateInbox(ctx context.Context, request *apiv2pb.UpdateI
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to update inbox: %v"
,
err
)
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to update inbox: %v"
,
err
)
}
}
inboxMessage
,
err
:=
s
.
convertInboxFromStore
(
ctx
,
inbox
)
if
err
!=
nil
{
return
nil
,
status
.
Errorf
(
codes
.
Internal
,
"failed to convert inbox from store: %v"
,
err
)
}
return
&
apiv2pb
.
UpdateInboxResponse
{
return
&
apiv2pb
.
UpdateInboxResponse
{
Inbox
:
inboxMessage
,
Inbox
:
convertInboxFromStore
(
inbox
)
,
},
nil
},
nil
}
}
...
@@ -89,7 +81,7 @@ func (s *APIV2Service) DeleteInbox(ctx context.Context, request *apiv2pb.DeleteI
...
@@ -89,7 +81,7 @@ func (s *APIV2Service) DeleteInbox(ctx context.Context, request *apiv2pb.DeleteI
return
&
apiv2pb
.
DeleteInboxResponse
{},
nil
return
&
apiv2pb
.
DeleteInboxResponse
{},
nil
}
}
func
(
s
*
APIV2Service
)
convertInboxFromStore
(
_
context
.
Context
,
inbox
*
store
.
Inbox
)
(
*
apiv2pb
.
Inbox
,
error
)
{
func
convertInboxFromStore
(
inbox
*
store
.
Inbox
)
*
apiv2pb
.
Inbox
{
return
&
apiv2pb
.
Inbox
{
return
&
apiv2pb
.
Inbox
{
Name
:
fmt
.
Sprintf
(
"%s%d"
,
InboxNamePrefix
,
inbox
.
ID
),
Name
:
fmt
.
Sprintf
(
"%s%d"
,
InboxNamePrefix
,
inbox
.
ID
),
Sender
:
fmt
.
Sprintf
(
"%s%d"
,
UserNamePrefix
,
inbox
.
SenderID
),
Sender
:
fmt
.
Sprintf
(
"%s%d"
,
UserNamePrefix
,
inbox
.
SenderID
),
...
@@ -98,7 +90,7 @@ func (s *APIV2Service) convertInboxFromStore(_ context.Context, inbox *store.Inb
...
@@ -98,7 +90,7 @@ func (s *APIV2Service) convertInboxFromStore(_ context.Context, inbox *store.Inb
CreateTime
:
timestamppb
.
New
(
time
.
Unix
(
inbox
.
CreatedTs
,
0
)),
CreateTime
:
timestamppb
.
New
(
time
.
Unix
(
inbox
.
CreatedTs
,
0
)),
Type
:
apiv2pb
.
Inbox_Type
(
inbox
.
Message
.
Type
),
Type
:
apiv2pb
.
Inbox_Type
(
inbox
.
Message
.
Type
),
ActivityId
:
inbox
.
Message
.
ActivityId
,
ActivityId
:
inbox
.
Message
.
ActivityId
,
}
,
nil
}
}
}
func
convertInboxStatusFromStore
(
status
store
.
InboxStatus
)
apiv2pb
.
Inbox_Status
{
func
convertInboxStatusFromStore
(
status
store
.
InboxStatus
)
apiv2pb
.
Inbox_Status
{
...
...
web/src/components/ExploreSidebar/TagsSection.tsx
0 → 100644
View file @
33e9b136
import
{
useEffect
,
useState
}
from
"react"
;
import
{
tagServiceClient
}
from
"@/grpcweb"
;
import
{
Tag
}
from
"@/types/proto/api/v2/tag_service"
;
import
Icon
from
"../Icon"
;
const
TagsSection
=
()
=>
{
const
[
tags
,
setTags
]
=
useState
<
Tag
[]
>
([]);
useEffect
(()
=>
{
(
async
()
=>
{
const
{
tags
}
=
await
tagServiceClient
.
listTags
({});
setTags
(
tags
);
})();
},
[]);
return
(
tags
.
length
>
0
&&
(
<
div
className=
"w-full mt-2 flex flex-col p-2 bg-gray-50 dark:bg-black rounded-lg"
>
<
div
className=
"w-full flex flex-row justify-between items-center"
>
<
span
className=
"text-gray-400 font-medium text-sm pl-1"
>
Tags
</
span
>
</
div
>
<
div
className=
"w-full flex flex-row justify-start items-center flex-wrap"
>
{
tags
.
map
((
tag
)
=>
(
<
div
key=
{
tag
.
name
}
className=
"w-auto max-w-full px-1 flex flex-row justify-start items-center text-gray-500 hover:bg-gray-100 dark:hover:bg-zinc-900 rounded-lg"
>
<
Icon
.
Hash
className=
"w-4 h-auto opacity-80"
/>
{
tag
.
name
}
</
div
>
))
}
</
div
>
</
div
>
)
);
};
export
default
TagsSection
;
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