1<?php 2/** 3 * DokuWiki Plugin structtasks 4 * 5 * @license GPL 2 http://www.gnu.org/licenses/gpl-2.0.html 6 * @author Chris MacMackin <cmacmackin@gmail.com> 7 * 8 */ 9 10namespace dokuwiki\plugin\structtasks\meta; 11 12/** 13 * Notifies a user when they are assigned to a task. 14 * 15 * @package dokuwiki\plugin\structtasks\meta 16 */ 17class AssignedNotifier extends AbstractNotifier 18{ 19 const lang_key_prefix = 'assigned'; 20 public function getNotifiableUsers($page, $editor_email, $new_data, $old_data) { 21 // Handle case of page creation; struct ends up returning 22 // identical metadata in that case, so need to over-ride it 23 if ($old_data['content'] == '') $old_data['assignees'] = []; 24 return array_filter( 25 array_diff($new_data['assignees'], $old_data['assignees']), 26 function ($val) use ($editor_email) {return $val !== $editor_email;} 27 ); 28 } 29} 30