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
2b7d7c95
Commit
2b7d7c95
authored
Oct 28, 2023
by
Steven
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
chore: update inbox detect
parent
0ee938c3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
6 deletions
+41
-6
memo.go
api/v1/memo.go
+1
-1
Header.tsx
web/src/components/Header.tsx
+29
-2
MemoCommentMessage.tsx
web/src/components/Inbox/MemoCommentMessage.tsx
+11
-3
No files found.
api/v1/memo.go
View file @
2b7d7c95
...
@@ -338,7 +338,7 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error {
...
@@ -338,7 +338,7 @@ func (s *APIV1Service) CreateMemo(c echo.Context) error {
});
err
!=
nil
{
});
err
!=
nil
{
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to upsert memo relation"
)
.
SetInternal
(
err
)
return
echo
.
NewHTTPError
(
http
.
StatusInternalServerError
,
"Failed to upsert memo relation"
)
.
SetInternal
(
err
)
}
}
if
memoRelationUpsert
.
Type
==
MemoRelationComment
{
if
memo
.
Visibility
!=
store
.
Private
&&
memo
RelationUpsert
.
Type
==
MemoRelationComment
{
relatedMemo
,
err
:=
s
.
Store
.
GetMemo
(
ctx
,
&
store
.
FindMemo
{
relatedMemo
,
err
:=
s
.
Store
.
GetMemo
(
ctx
,
&
store
.
FindMemo
{
ID
:
&
memoRelationUpsert
.
RelatedMemoID
,
ID
:
&
memoRelationUpsert
.
RelatedMemoID
,
})
})
...
...
web/src/components/Header.tsx
View file @
2b7d7c95
...
@@ -3,6 +3,8 @@ import { useEffect } from "react";
...
@@ -3,6 +3,8 @@ import { useEffect } from "react";
import
{
NavLink
,
useLocation
}
from
"react-router-dom"
;
import
{
NavLink
,
useLocation
}
from
"react-router-dom"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
useCurrentUser
from
"@/hooks/useCurrentUser"
;
import
{
useLayoutStore
}
from
"@/store/module"
;
import
{
useLayoutStore
}
from
"@/store/module"
;
import
useInboxStore
from
"@/store/v1/inbox"
;
import
{
Inbox_Status
}
from
"@/types/proto/api/v2/inbox_service"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
useTranslate
}
from
"@/utils/i18n"
;
import
{
resolution
}
from
"@/utils/layout"
;
import
{
resolution
}
from
"@/utils/layout"
;
import
Icon
from
"./Icon"
;
import
Icon
from
"./Icon"
;
...
@@ -19,8 +21,26 @@ const Header = () => {
...
@@ -19,8 +21,26 @@ const Header = () => {
const
t
=
useTranslate
();
const
t
=
useTranslate
();
const
location
=
useLocation
();
const
location
=
useLocation
();
const
layoutStore
=
useLayoutStore
();
const
layoutStore
=
useLayoutStore
();
const
showHeader
=
layoutStore
.
state
.
showHeader
;
const
user
=
useCurrentUser
();
const
user
=
useCurrentUser
();
const
inboxStore
=
useInboxStore
();
const
showHeader
=
layoutStore
.
state
.
showHeader
;
const
hasUnreadInbox
=
inboxStore
.
inboxes
.
some
((
inbox
)
=>
inbox
.
status
===
Inbox_Status
.
UNREAD
);
useEffect
(()
=>
{
if
(
!
user
)
{
return
;
}
inboxStore
.
fetchInboxes
();
// Fetch inboxes every 5 minutes.
const
timer
=
setInterval
(
async
()
=>
{
await
inboxStore
.
fetchInboxes
();
},
1000
*
60
*
5
);
return
()
=>
{
clearInterval
(
timer
);
};
},
[]);
useEffect
(()
=>
{
useEffect
(()
=>
{
const
handleWindowResize
=
()
=>
{
const
handleWindowResize
=
()
=>
{
...
@@ -56,7 +76,14 @@ const Header = () => {
...
@@ -56,7 +76,14 @@ const Header = () => {
id
:
"header-inbox"
,
id
:
"header-inbox"
,
path
:
"/inbox"
,
path
:
"/inbox"
,
title
:
t
(
"common.inbox"
),
title
:
t
(
"common.inbox"
),
icon
:
<
Icon
.
Bell
className=
"mr-3 w-6 h-auto opacity-70"
/>,
icon
:
(
<>
<
div
className=
"relative"
>
<
Icon
.
Bell
className=
"mr-3 w-6 h-auto opacity-70"
/>
{
hasUnreadInbox
&&
<
div
className=
"absolute top-0 left-5 w-2 h-2 rounded-full bg-blue-500"
></
div
>
}
</
div
>
</>
),
};
};
const
exploreNavLink
:
NavLinkItem
=
{
const
exploreNavLink
:
NavLinkItem
=
{
id
:
"header-explore"
,
id
:
"header-explore"
,
...
...
web/src/components/Inbox/MemoCommentMessage.tsx
View file @
2b7d7c95
...
@@ -37,9 +37,12 @@ const MemoCommentMessage = ({ inbox }: Props) => {
...
@@ -37,9 +37,12 @@ const MemoCommentMessage = ({ inbox }: Props) => {
return
;
return
;
}
}
navigateTo
(
`/m/
${
activity
?.
payload
?.
memoComment
?.
relatedMemoId
}
`);
navigateTo
(
`/m/
${
activity
?.
payload
?.
memoComment
?.
relatedMemoId
}
`);
if (inbox.status === Inbox_Status.UNREAD) {
handleArchiveMessage(true);
}
};
};
const handleArchiveMessage = async () => {
const handleArchiveMessage = async (
silence = false
) => {
await inboxStore.updateInbox(
await inboxStore.updateInbox(
{
{
name: inbox.name,
name: inbox.name,
...
@@ -47,7 +50,9 @@ const MemoCommentMessage = ({ inbox }: Props) => {
...
@@ -47,7 +50,9 @@ const MemoCommentMessage = ({ inbox }: Props) => {
},
},
["status"]
["status"]
);
);
toast.success("Archived");
if (!silence) {
toast.success("Archived");
}
};
};
return (
return (
...
@@ -73,7 +78,10 @@ const MemoCommentMessage = ({ inbox }: Props) => {
...
@@ -73,7 +78,10 @@ const MemoCommentMessage = ({ inbox }: Props) => {
<div>
<div>
{inbox.status === Inbox_Status.UNREAD && (
{inbox.status === Inbox_Status.UNREAD && (
<Tooltip title="Archive" placement="top">
<Tooltip title="Archive" placement="top">
<Icon.Inbox className="w-4 h-auto cursor-pointer text-gray-400 hover:text-blue-600" onClick={handleArchiveMessage} />
<Icon.Inbox
className="w-4 h-auto cursor-pointer text-gray-400 hover:text-blue-600"
onClick={() => handleArchiveMessage()}
/>
</Tooltip>
</Tooltip>
)}
)}
</div>
</div>
...
...
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