You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

116 lines
2.7 KiB

3 years ago
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * @copyright Copyright (c) 2020 Robin Appelman <robin@icewind.nl>
  5. *
  6. * @author Robin Appelman <robin@icewind.nl>
  7. *
  8. * @license GNU AGPL version 3 or any later version
  9. *
  10. * This program is free software: you can redistribute it and/or modify
  11. * it under the terms of the GNU Affero General Public License as
  12. * published by the Free Software Foundation, either version 3 of the
  13. * License, or (at your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful,
  16. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. * GNU Affero General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU Affero General Public License
  21. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  22. *
  23. */
  24. namespace OCP\Activity;
  25. /**
  26. * @since 20.0.0
  27. */
  28. abstract class ActivitySettings implements ISetting {
  29. /**
  30. * @return string Lowercase a-z and underscore only identifier
  31. * @since 20.0.0
  32. */
  33. abstract public function getIdentifier();
  34. /**
  35. * @return string A translated string
  36. * @since 20.0.0
  37. */
  38. abstract public function getName();
  39. /**
  40. * @return string Lowercase a-z and underscore only group identifier
  41. * @since 20.0.0
  42. */
  43. abstract public function getGroupIdentifier();
  44. /**
  45. * @return string A translated string for the settings group
  46. * @since 20.0.0
  47. */
  48. abstract public function getGroupName();
  49. /**
  50. * @return int whether the filter should be rather on the top or bottom of
  51. * the admin section. The filters are arranged in ascending order of the
  52. * priority values. It is required to return a value between 0 and 100.
  53. * @since 20.0.0
  54. */
  55. abstract public function getPriority();
  56. /**
  57. * @return bool True when the option can be changed for the mail
  58. * @since 20.0.0
  59. */
  60. public function canChangeMail() {
  61. return true;
  62. }
  63. /**
  64. * @return bool True when the option can be changed for the notification
  65. * @since 20.0.0
  66. */
  67. public function canChangeNotification() {
  68. return true;
  69. }
  70. /**
  71. * @return bool Whether or not an activity email should be send by default
  72. * @since 20.0.0
  73. */
  74. public function isDefaultEnabledMail() {
  75. return false;
  76. }
  77. /**
  78. * @return bool Whether or not an activity notification should be send by default
  79. * @since 20.0.0
  80. */
  81. public function isDefaultEnabledNotification() {
  82. return $this->isDefaultEnabledMail() && !$this->canChangeMail();
  83. }
  84. /**
  85. * Left in for backwards compatibility
  86. *
  87. * @return bool
  88. * @since 20.0.0
  89. */
  90. public function canChangeStream() {
  91. return false;
  92. }
  93. /**
  94. * Left in for backwards compatibility
  95. *
  96. * @return bool
  97. * @since 20.0.0
  98. */
  99. public function isDefaultEnabledStream() {
  100. return true;
  101. }
  102. }