mirror of
https://github.com/zulip/zulip.git
synced 2025-11-05 06:23:38 +00:00
Document realm filter regexp oddities
(imported from commit 987d8ea679f40c31f2fe2280b6d585f82b20e606)
This commit is contained in:
@@ -2284,6 +2284,10 @@ def notify_realm_filters(realm):
|
||||
notice = dict(event=dict(type="realm_filters", realm_filters=realm_filters), users=user_ids)
|
||||
tornado_callbacks.send_notification(notice)
|
||||
|
||||
# NOTE: Regexes must be simple enough that they can be easily translated to JavaScript
|
||||
# RegExp syntax. In addition to JS-compatible syntax, the following features are available:
|
||||
# * Named groups will be converted to numbered groups automatically
|
||||
# * Inline-regex flags will be stripped, and where possible translated to RegExp-wide flags
|
||||
def do_add_realm_filter(realm, pattern, url_format_string):
|
||||
RealmFilter(realm=realm, pattern=pattern,
|
||||
url_format_string=url_format_string).save()
|
||||
|
||||
@@ -11,6 +11,12 @@ class Command(BaseCommand):
|
||||
|
||||
Usage: python manage.py realm_filters foo.com PATTERN URLPATTERN
|
||||
|
||||
NOTE: Regexes must be simple enough that they can be easily translated to JavaScript
|
||||
RegExp syntax. In addition to JS-compatible syntax, the following features are available:
|
||||
|
||||
* Named groups will be converted to numbered groups automatically
|
||||
* Inline-regex flags will be stripped, and where possible translated to RegExp-wide flags
|
||||
|
||||
Example: python manage.py realm_filters --realm=zulip.com --op=add '#(?P<id>[0-9]{2,8})' 'https://trac.humbughq.com/ticket/%(id)s'
|
||||
Example: python manage.py realm_filters --realm=zulip.com --op=remove '#(?P<id>[0-9]{2,8})'
|
||||
Example: python manage.py realm_filters --realm=zulip.com --op=show
|
||||
|
||||
Reference in New Issue
Block a user