Refactors how mentions are collected
This should be quicker, because it queries the users in one go instead of jumping straight to iterating over them, and it checks if a user blocks the poster before allowing them to be tagged.
This commit is contained in:
parent
bdf563748c
commit
5c3bb2da13
4 changed files with 96 additions and 53 deletions
|
@ -4,7 +4,7 @@ DOMAIN = r"[\w_\-\.]+\.[a-z\-]{2,}"
|
|||
LOCALNAME = r"@?[a-zA-Z_\-\.0-9]+"
|
||||
STRICT_LOCALNAME = r"@[a-zA-Z_\-\.0-9]+"
|
||||
USERNAME = rf"{LOCALNAME}(@{DOMAIN})?"
|
||||
STRICT_USERNAME = rf"\B{STRICT_LOCALNAME}(@{DOMAIN})?\b"
|
||||
STRICT_USERNAME = rf"(\B{STRICT_LOCALNAME}(@{DOMAIN})?\b)"
|
||||
FULL_USERNAME = rf"{LOCALNAME}@{DOMAIN}\b"
|
||||
SLUG = r"/s/(?P<slug>[-_a-z0-9]*)"
|
||||
# should match (BookWyrm/1.0.0; or (BookWyrm/99.1.2;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue