Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 34db6bb

Browse files
authored
Warn users trying to use the deprecated spam checker interface (#10210)
So admins aren't surprised if things break when we remove this code in a couple of months.
1 parent 96f6293 commit 34db6bb

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

changelog.d/10210.removal

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
The current spam checker interface is deprecated in favour of a new generic modules system. See the [upgrade notes](https://github.com/matrix-org/synapse/blob/master/UPGRADE.rst#deprecation-of-the-current-spam-checker-interface) for more information on how to update to the new system.

synapse/config/spam_checker.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,23 @@
1212
# See the License for the specific language governing permissions and
1313
# limitations under the License.
1414

15+
import logging
1516
from typing import Any, Dict, List, Tuple
1617

1718
from synapse.config import ConfigError
1819
from synapse.util.module_loader import load_module
1920

2021
from ._base import Config
2122

23+
logger = logging.getLogger(__name__)
24+
25+
LEGACY_SPAM_CHECKER_WARNING = """
26+
This server is using a spam checker module that is implementing the deprecated spam
27+
checker interface. Please check with the module's maintainer to see if a new version
28+
supporting Synapse's generic modules system is available.
29+
For more information, please see https://matrix-org.github.io/synapse/develop/modules.html
30+
---------------------------------------------------------------------------------------"""
31+
2232

2333
class SpamCheckerConfig(Config):
2434
section = "spamchecker"
@@ -42,3 +52,8 @@ def read_config(self, config, **kwargs):
4252
self.spam_checkers.append(load_module(spam_checker, config_path))
4353
else:
4454
raise ConfigError("spam_checker syntax is incorrect")
55+
56+
# If this configuration is being used in any way, warn the admin that it is going
57+
# away soon.
58+
if self.spam_checkers:
59+
logger.warning(LEGACY_SPAM_CHECKER_WARNING)

0 commit comments

Comments
 (0)