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
9904992d
authored
Nov 30, 2021
by
Sixong.Zhu
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
type
parent
e2bb38a9
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
16 deletions
store/index.ts
store/index.ts
View file @
9904992d
...
...
@@ -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
);
});
}
...
...
@@ -332,7 +332,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
,
...
...
@@ -480,7 +480,7 @@ export default {
},
async
[
ChatStore
.
ACTION_GET_CHAT_MESSAGES
]({
state
,
commit
,
getters
})
{
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
const
isMember
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_IS_CHAT_MEMBER
];
if
(
chatId
==
null
)
return
;
let
data
:
Message
[]
=
[];
...
...
@@ -520,7 +520,7 @@ export default {
)
{
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
if
(
chatId
==
null
)
return
;
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
const
o
=
{
model
:
chat
.
model_name
,
obj
:
chat
.
obj_id
,
...
...
@@ -543,7 +543,7 @@ export default {
)
{
const
chatId
=
state
[
ChatStore
.
STATE_CHAT_CURRENT_CHAT_ID
];
if
(
chatId
==
null
)
return
;
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
const
o
=
{
model
:
chat
.
model_name
,
obj
:
chat
.
obj_id
,
...
...
@@ -570,7 +570,7 @@ export default {
}
}
try
{
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
const
data
=
await
Chat
.
getSdk
()
.
model
(
chat
.
model_name
)
.
chat
(
chat
.
obj_id
,
orgId
())
...
...
@@ -665,7 +665,7 @@ export default {
if
(
msgs
==
null
)
return
;
const
oldestMsgId
=
msgs
[
0
].
id
-
1
;
const
lastMsgId
=
msgs
[
msgs
.
length
-
1
].
id
+
1
;
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
chat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
const
o
=
{
model
:
chat
.
model_name
,
obj
:
chat
.
obj_id
,
...
...
@@ -820,7 +820,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
);
})
);
...
...
@@ -854,7 +854,7 @@ export default {
);
},
async
[
ChatStore
.
ACTION_CHAT_START_RECEPTION
]({
getters
,
dispatch
})
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -869,7 +869,7 @@ export default {
.
finally
(()
=>
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
));
},
async
[
ChatStore
.
ACTION_CHAT_FINISH_RECEPTION
]({
getters
,
dispatch
})
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -884,7 +884,7 @@ export default {
.
finally
(()
=>
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
));
},
async
[
ChatStore
.
ACTION_CHAT_USER_EXIT
]({
getters
,
dispatch
})
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -892,6 +892,7 @@ export default {
)
{
return
Promise
.
reject
();
}
await
dbController
.
removeChatFromList
(
currentChat
.
id
);
return
await
Chat
.
getSdk
()
.
model
(
currentChat
.
model_name
)
.
chat
(
currentChat
.
obj_id
,
orgId
())
...
...
@@ -899,7 +900,7 @@ export default {
.
finally
(()
=>
dispatch
(
ChatStore
.
ACTION_GET_CHAT_MEMBERS
));
},
async
[
ChatStore
.
ACTION_CHAT_CS_EXIT
]({
getters
,
dispatch
})
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -917,7 +918,7 @@ export default {
{
getters
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_ADD_MEMBERS
>
[
0
]
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -935,7 +936,7 @@ export default {
{
getters
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_REMOVE_MEMBER
>
[
0
]
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -953,7 +954,7 @@ export default {
{
getters
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_ADD_CS
>
[
0
]
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
@@ -971,7 +972,7 @@ export default {
{
getters
,
dispatch
},
uids
:
Parameters
<
ChatStore
.
ACTION_CHAT_REMOVE_CS
>
[
0
]
)
{
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
];
const
currentChat
=
getters
[
ChatStore
.
GETTER_CURRENT_CURRENT_CHAT
]
as
ChatType
;
if
(
!
currentChat
||
!
currentChat
.
model_name
||
...
...
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