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
c81c9fb5
authored
Nov 09, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
update sort
parent
153f4070
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
24 additions
and
13 deletions
store/index.ts
store/index.ts
View file @
c81c9fb5
...
...
@@ -31,7 +31,7 @@ function uniqueMessages(
messages
:
NonNullable
<
ChatStore
.
STATE_CHAT_MSG_HISTORY
>
)
{
const
arr
=
[...
messages
];
return
unique
(
arr
,
function
(
item
,
all
)
{
return
unique
(
arr
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
id
===
item
.
id
);
});
}
...
...
@@ -334,7 +334,7 @@ export default {
state
[
ChatStore
.
STATE_CHAT_SENDING_MESSAGES
]
=
[...
current
];
}
},
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
[
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_INPUTING
]:
(
function
()
{
const
setTimeoutId
:
{
[
key
:
string
]:
number
}
=
{};
return
(
state
:
ChatStoreState
,
...
...
@@ -393,6 +393,8 @@ export default {
async
[
ChatStore
.
ACTION_GET_MY_CHAT_LIST
]({
commit
,
state
})
{
let
cache
=
await
dbController
.
getChatList
();
cache
.
sort
((
x
,
y
)
=>
(
x
.
last_msg_ts
<
y
.
last_msg_ts
?
1
:
-
1
));
for
(
const
item
of
cache
)
{
if
(
item
.
business_data
&&
!
item
.
detail_name
)
{
const
d
=
JSON
.
parse
(
...
...
@@ -836,7 +838,7 @@ export default {
}
commit
(
ChatStore
.
MUTATION_SAVE_CURRENT_CHAT_MEMBERS
,
unique
(
newChatMembers
,
function
(
item
,
all
)
{
unique
(
newChatMembers
,
function
(
item
,
all
)
{
return
all
.
findIndex
((
k
)
=>
k
.
eid
===
item
.
eid
);
})
);
...
...
@@ -1054,16 +1056,25 @@ export default {
if
(
cache
[
id
])
{
return
Promise
.
resolve
({
id
,
name
:
cache
[
id
]
});
}
return
new
Promise
<
{
id
:
string
;
name
:
string
}
>
((
resolve
,
reject
)
=>
{
Chat
.
getSdk
().
model
(
"user"
)
.
detail
(
id
)
.
query
()
.
then
((
userInfo
:
any
)
=>
{
const
name
=
userInfo
.
row
.
first_name
.
display
as
string
;
Vue
.
set
(
state
[
ChatStore
.
STATE_CHAT_USERNAME
],
id
,
name
);
resolve
({
id
,
name
});
}).
catch
(
reject
);
});
return
new
Promise
<
{
id
:
string
;
name
:
string
}
>
(
(
resolve
,
reject
)
=>
{
Chat
.
getSdk
()
.
model
(
"user"
)
.
detail
(
id
)
.
query
()
.
then
((
userInfo
:
any
)
=>
{
const
name
=
userInfo
.
row
.
first_name
.
display
as
string
;
Vue
.
set
(
state
[
ChatStore
.
STATE_CHAT_USERNAME
],
id
,
name
);
resolve
({
id
,
name
});
})
.
catch
(
reject
);
}
);
},
},
getters
:
{
...
...
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