1
0

ActivitySettings.php 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * SPDX-FileCopyrightText: 2020 Nextcloud GmbH and Nextcloud contributors
  5. * SPDX-License-Identifier: AGPL-3.0-or-later
  6. */
  7. namespace OCP\Activity;
  8. /**
  9. * @since 20.0.0
  10. */
  11. abstract class ActivitySettings implements ISetting {
  12. /**
  13. * @return string Lowercase a-z and underscore only identifier
  14. * @since 20.0.0
  15. */
  16. abstract public function getIdentifier();
  17. /**
  18. * @return string A translated string
  19. * @since 20.0.0
  20. */
  21. abstract public function getName();
  22. /**
  23. * @return string Lowercase a-z and underscore only group identifier
  24. * @since 20.0.0
  25. */
  26. abstract public function getGroupIdentifier();
  27. /**
  28. * @return string A translated string for the settings group
  29. * @since 20.0.0
  30. */
  31. abstract public function getGroupName();
  32. /**
  33. * @return int whether the filter should be rather on the top or bottom of
  34. * the admin section. The filters are arranged in ascending order of the
  35. * priority values. It is required to return a value between 0 and 100.
  36. * @since 20.0.0
  37. */
  38. abstract public function getPriority();
  39. /**
  40. * @return bool True when the option can be changed for the mail
  41. * @since 20.0.0
  42. */
  43. public function canChangeMail() {
  44. return true;
  45. }
  46. /**
  47. * @return bool True when the option can be changed for the notification
  48. * @since 20.0.0
  49. */
  50. public function canChangeNotification() {
  51. return true;
  52. }
  53. /**
  54. * @return bool Whether or not an activity email should be send by default
  55. * @since 20.0.0
  56. */
  57. public function isDefaultEnabledMail() {
  58. return false;
  59. }
  60. /**
  61. * @return bool Whether or not an activity notification should be send by default
  62. * @since 20.0.0
  63. */
  64. public function isDefaultEnabledNotification() {
  65. return $this->isDefaultEnabledMail() && !$this->canChangeMail();
  66. }
  67. /**
  68. * Left in for backwards compatibility
  69. *
  70. * @return bool
  71. * @since 20.0.0
  72. */
  73. public function canChangeStream() {
  74. return false;
  75. }
  76. /**
  77. * Left in for backwards compatibility
  78. *
  79. * @return bool
  80. * @since 20.0.0
  81. */
  82. public function isDefaultEnabledStream() {
  83. return true;
  84. }
  85. }