mirror of
https://github.com/muerwre/vault-frontend.git
synced 2025-04-25 12:56:41 +07:00
fixed last seen message bug
This commit is contained in:
parent
b064c88943
commit
0eae79ec08
3 changed files with 9 additions and 9 deletions
|
@ -56,9 +56,9 @@ const NotificationsUnconnected: FC<IProps> = ({
|
||||||
const hideList = useCallback(() => setVisible(false), [setVisible]);
|
const hideList = useCallback(() => setVisible(false), [setVisible]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (!visible || !has_new) return;
|
if (!visible || !has_new || !last) return;
|
||||||
authSetLastSeenMessages(new Date().toISOString());
|
authSetLastSeenMessages(last);
|
||||||
}, [visible]);
|
}, [visible, last]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div
|
<div
|
||||||
|
|
|
@ -228,7 +228,7 @@ function* getUpdates() {
|
||||||
const { error, data }: IResultWithStatus<{ notifications: INotification[] }> = yield call(
|
const { error, data }: IResultWithStatus<{ notifications: INotification[] }> = yield call(
|
||||||
reqWrapper,
|
reqWrapper,
|
||||||
apiAuthGetUpdates,
|
apiAuthGetUpdates,
|
||||||
{ exclude_dialogs, last }
|
{ exclude_dialogs, last: last || user.last_seen_messages }
|
||||||
);
|
);
|
||||||
|
|
||||||
if (error || !data || !data.notifications || !data.notifications.length) return;
|
if (error || !data || !data.notifications || !data.notifications.length) return;
|
||||||
|
@ -246,16 +246,14 @@ function* getUpdates() {
|
||||||
function* startPollingSaga() {
|
function* startPollingSaga() {
|
||||||
while (true) {
|
while (true) {
|
||||||
yield call(getUpdates);
|
yield call(getUpdates);
|
||||||
yield delay(60000);
|
yield delay(10000);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function* setLastSeenMessages({ last_seen_messages }: ReturnType<typeof authSetLastSeenMessages>) {
|
function* setLastSeenMessages({ last_seen_messages }: ReturnType<typeof authSetLastSeenMessages>) {
|
||||||
if (!Date.parse(last_seen_messages)) return;
|
if (!Date.parse(last_seen_messages)) return;
|
||||||
|
|
||||||
const { data, error } = yield call(reqWrapper, apiUpdateUser, { user: { last_seen_messages } });
|
yield call(reqWrapper, apiUpdateUser, { user: { last_seen_messages } });
|
||||||
|
|
||||||
console.log({ data, error });
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function* authSaga() {
|
function* authSaga() {
|
||||||
|
|
|
@ -92,10 +92,12 @@ function* onNodeSave({ node }: ReturnType<typeof nodeSave>) {
|
||||||
|
|
||||||
function* onNodeGoto({ id, node_type }: ReturnType<typeof nodeGotoNode>) {
|
function* onNodeGoto({ id, node_type }: ReturnType<typeof nodeGotoNode>) {
|
||||||
if (node_type) yield put(nodeSetCurrent({ ...EMPTY_NODE, type: node_type }));
|
if (node_type) yield put(nodeSetCurrent({ ...EMPTY_NODE, type: node_type }));
|
||||||
|
|
||||||
yield put(nodeLoadNode(id));
|
yield put(nodeLoadNode(id));
|
||||||
yield put(push(URLS.NODE_URL(id)));
|
|
||||||
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
yield put(nodeSetCommentData(0, { ...EMPTY_COMMENT }));
|
||||||
yield put(nodeSetRelated(null));
|
yield put(nodeSetRelated(null));
|
||||||
|
|
||||||
|
yield put(push(URLS.NODE_URL(id)));
|
||||||
}
|
}
|
||||||
|
|
||||||
function* onNodeLoad({ id, order = 'ASC' }: ReturnType<typeof nodeLoadNode>) {
|
function* onNodeLoad({ id, order = 'ASC' }: ReturnType<typeof nodeLoadNode>) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue