1 | <?php |
||
25 | trait QueueTrait |
||
26 | { |
||
27 | /** |
||
28 | * Insert add comment to message queue. |
||
29 | * |
||
30 | * @param Comment $comment |
||
31 | * @param int|User $changeBy |
||
32 | * |
||
33 | * @return void |
||
34 | */ |
||
35 | 9 | public function queueAdd(Comment $comment, $changeBy) |
|
44 | |||
45 | /** |
||
46 | * Insert update comment to message queue. |
||
47 | * |
||
48 | * @param Comment $comment |
||
49 | * @param int|User $changeBy |
||
50 | * |
||
51 | * @return void |
||
52 | */ |
||
53 | 1 | public function queueUpdate(Comment $comment, $changeBy) |
|
54 | { |
||
55 | // Skip message if issue closed or nothing changed in comment |
||
56 | 1 | if (!$comment->issue->isOpen() || !$comment->isDirty()) { |
|
57 | return; |
||
58 | } |
||
59 | |||
60 | 1 | return (new Message\Queue())->queue(Queue::UPDATE_COMMENT, $comment, $changeBy); |
|
61 | } |
||
62 | |||
63 | /** |
||
64 | * Insert delete comment to message queue. |
||
65 | * |
||
66 | * @param Comment $comment |
||
67 | * @param int|User $changeBy |
||
68 | * |
||
69 | * @return void |
||
70 | */ |
||
71 | 1 | public function queueDelete(Comment $comment, $changeBy) |
|
80 | } |
||
81 |