Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
foreign
/
customer-service
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
00d93de0
authored
Dec 22, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
u
parent
2b323c6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
3 additions
and
12 deletions
store/index.ts
store/index.ts
View file @
00d93de0
...
@@ -419,7 +419,7 @@ export default {
...
@@ -419,7 +419,7 @@ export default {
},
},
},
},
actions
:
{
actions
:
{
async
[
ChatStore
.
ACTION_GET_MY_CHAT_LIST
]({
commit
,
state
})
{
async
[
ChatStore
.
ACTION_GET_MY_CHAT_LIST
]({
commit
,
dispatch
})
{
commit
(
ChatStore
.
MUTATION_SAVE_MYSELF_ID
);
commit
(
ChatStore
.
MUTATION_SAVE_MYSELF_ID
);
if
(
loadingChatList
)
{
if
(
loadingChatList
)
{
...
@@ -453,15 +453,6 @@ export default {
...
@@ -453,15 +453,6 @@ export default {
}
}
}
}
const
buildUnreadMessage
=
(
items
:
ChatType
[])
=>
{
let
sum
=
0
;
items
.
forEach
((
i
)
=>
(
sum
+=
i
.
unread_msg_count
));
state
[
ChatStore
.
STATE_CURRENT_UNREAD_MESSAGE_COUNT
]
=
sum
;
return
items
.
sort
((
x
,
y
)
=>
x
.
last_msg_ts
<
y
.
last_msg_ts
?
1
:
-
1
);
};
if
(
cache
&&
cache
.
length
)
{
if
(
cache
&&
cache
.
length
)
{
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
cache
);
commit
(
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
cache
);
const
ts
=
cache
const
ts
=
cache
...
@@ -485,7 +476,7 @@ export default {
...
@@ -485,7 +476,7 @@ export default {
items
items
);
);
}
}
resolve
(
buildUnreadMessage
(
cache
)
);
dispatch
(
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
).
finally
(
resolve
);
})
})
.
catch
(
reject
);
.
catch
(
reject
);
});
});
...
@@ -513,7 +504,7 @@ export default {
...
@@ -513,7 +504,7 @@ export default {
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
ChatStore
.
MUTATION_SAVE_CHAT_LIST
,
items
items
);
);
resolve
(
buildUnreadMessage
(
items
)
);
dispatch
(
ChatStore
.
ACTION_REBUILD_UNREAD_MESSAGE_COUNT
).
finally
(
resolve
);
})
})
.
catch
(
reject
);
.
catch
(
reject
);
});
});
...
...
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