mirror of
https://github.com/Mibew/design.git
synced 2025-01-22 18:10:33 +03:00
Update pluginMessageIndex event
Add ability for plugins to alter sender name and operator ID during message indexing.
This commit is contained in:
parent
dfd3b9e615
commit
ff3bfa545f
@ -37,6 +37,10 @@
|
||||
* - 'kind': int, indexed message kind. It must be one of the core messages
|
||||
* kinds, not Thread::KIND_PLUGIN.
|
||||
* - 'message': string, text of indexed message.
|
||||
* - 'sender_name': string, name of person who sent the message. This field is
|
||||
* arbitrary and do not use for some messages kinds.
|
||||
* - 'operator_id': int, ID of the operator who send the message. This field is
|
||||
* arbitrary and do not use for some messages kinds.
|
||||
*
|
||||
* If the 'result' element equals to boolean false message will be skipped.
|
||||
*
|
||||
@ -120,6 +124,14 @@ function cron_index_messages() {
|
||||
// Update message
|
||||
$messages[$key]['ikind'] = $event_args['result']['kind'];
|
||||
$messages[$key]['tmessage'] = $event_args['result']['message'];
|
||||
|
||||
if (array_key_exists('sender_name', $event_args['result'])) {
|
||||
$messages[$key]['tname'] = $event_args['result']['sender_name'];
|
||||
}
|
||||
|
||||
if (array_key_exists('operator_id', $event_args['result'])) {
|
||||
$messages[$key]['agentId'] = $event_args['result']['operator_id'];
|
||||
}
|
||||
}
|
||||
|
||||
// Check is there some messages that should be saved
|
||||
|
Loading…
Reference in New Issue
Block a user