1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
/** |
4
|
|
|
* Handles mentioning for watched topics with new posts. |
5
|
|
|
* |
6
|
|
|
* @package ElkArte Forum |
7
|
|
|
* @copyright ElkArte Forum contributors |
8
|
|
|
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file) |
9
|
|
|
* |
10
|
|
|
* @version 2.0 dev |
11
|
|
|
* |
12
|
|
|
*/ |
13
|
|
|
|
14
|
|
|
namespace ElkArte\Mentions\MentionType\Notification; |
15
|
|
|
|
16
|
|
|
use ElkArte\Mentions\MentionType\AbstractNotificationMessage; |
17
|
|
|
|
18
|
|
|
/** |
19
|
|
|
* Class WatchedBoard |
20
|
|
|
* |
21
|
|
|
* Handles notifying of members whose watched topics have received new posts |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
class Watchedboard extends AbstractNotificationMessage |
25
|
|
|
{ |
26
|
|
|
/** {@inheritDoc} */ |
27
|
|
|
protected static $_type = 'watchedboard'; |
28
|
|
|
|
29
|
|
|
/** |
30
|
|
|
* {@inheritDoc} |
31
|
|
|
*/ |
32
|
|
|
public function getNotificationBody($lang_data, $members) |
33
|
|
|
{ |
34
|
|
|
// Email is handled elsewhere, this is only for on-site mentions |
35
|
|
|
return $this->_getNotificationStrings('', [ |
36
|
|
|
'subject' => static::$_type, |
37
|
|
|
'body' => static::$_type, |
38
|
|
|
], $members, $this->_task); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
* We only use the mentions interface to allow on-site mention for new topics on watched boards |
43
|
|
|
* Email and digests are handled in a separate process due to all the complications |
44
|
|
|
*/ |
45
|
|
|
public static function isNotAllowed($method) |
46
|
|
|
{ |
47
|
|
|
// Don't let watched be allowed to use email, that is handled by PostNotificaions |
48
|
|
|
if (in_array($method, ['email', 'emaildaily', 'emailweekly'])) |
49
|
|
|
{ |
50
|
|
|
return true; |
51
|
|
|
} |
52
|
|
|
|
53
|
|
|
return false; |
54
|
|
|
} |
55
|
|
|
|
56
|
|
|
/** |
57
|
|
|
* There is no interface for this, its always available as an on-site mention and members set |
58
|
|
|
* from profile options notifications |
59
|
|
|
* |
60
|
|
|
* @return true |
61
|
|
|
*/ |
62
|
|
|
public static function hasHiddenInterface() |
63
|
|
|
{ |
64
|
|
|
return true; |
65
|
|
|
} |
66
|
|
|
|
67
|
|
|
/** |
68
|
|
|
* Only called when hasHiddenInterface is true. Returns the application settings as if |
69
|
|
|
* they had been selected in the ACP notifications area |
70
|
|
|
* |
71
|
|
|
* @return array Returns an array containing the settings. |
72
|
|
|
*/ |
73
|
|
|
public static function getSettings() |
74
|
|
|
{ |
75
|
|
|
return ['enable' => 1, 'notification' => 1, 'default' => [0 => 'notification']]; |
76
|
|
|
} |
77
|
|
|
} |
78
|
|
|
|