mirror of
https://github.com/Mibew/mibew.git
synced 2025-02-12 10:31:09 +03:00
Add "threadClose" event
This commit is contained in:
parent
53450ea9d6
commit
9b05509ec4
@ -186,6 +186,15 @@ final class Events
|
|||||||
*/
|
*/
|
||||||
const THREAD_DELETE = 'threadDelete';
|
const THREAD_DELETE = 'threadDelete';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A thread is closed.
|
||||||
|
*
|
||||||
|
* This event is triggered after a thread has been closed. An associative
|
||||||
|
* array with the following items is passed to the event handlers:
|
||||||
|
* - "thread": an instance of {@link \Mibew\Thread}.
|
||||||
|
*/
|
||||||
|
const THREAD_CLOSE = 'threadClose';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Threads list is ready to be sent to client.
|
* Threads list is ready to be sent to client.
|
||||||
*
|
*
|
||||||
|
@ -844,6 +844,8 @@ class Thread
|
|||||||
/**
|
/**
|
||||||
* Close thread and send closing messages to the conversation members
|
* Close thread and send closing messages to the conversation members
|
||||||
*
|
*
|
||||||
|
* Triggers {@link \Mibew\EventDispatcher\Events::THREAD_CLOSE} event.
|
||||||
|
*
|
||||||
* @param boolean $is_user Boolean TRUE if user initiate thread closing or
|
* @param boolean $is_user Boolean TRUE if user initiate thread closing or
|
||||||
* boolean FALSE otherwise
|
* boolean FALSE otherwise
|
||||||
*/
|
*/
|
||||||
@ -906,6 +908,9 @@ class Thread
|
|||||||
$this->closed = time();
|
$this->closed = time();
|
||||||
$this->messageCount = $message_count;
|
$this->messageCount = $message_count;
|
||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
|
$args = array('thread' => $this);
|
||||||
|
EventDispatcher::getInstance()->triggerEvent(Events::THREAD_CLOSE, $args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user