diff --git a/common.py b/common.py index dd73f71..cb24249 100644 --- a/common.py +++ b/common.py @@ -13,6 +13,7 @@ import cachetools from Crypto.Util import number from flask import abort, g, has_request_context, make_response, request from google.cloud.error_reporting.util import build_flask_context +from google.cloud import ndb from google.cloud.ndb.global_cache import _InProcessGlobalCache, MemcacheCache from google.cloud.ndb.key import Key from google.protobuf.timestamp_pb2 import Timestamp @@ -108,6 +109,19 @@ else: global_cache = MemcacheCache(memcache) +@functools.cache +def protocol_user_copy_ids(): + """Returns all copy ids for protocol bot users.""" + ids = [] + + from web import Web + for user in ndb.get_multi(Web(id=domain).key for domain in PROTOCOL_DOMAINS): + if user: + ids.extend(copy.uri for copy in user.copies) + + return tuple(ids) + + def base64_to_long(x): """Converts from URL safe base64 encoding to long integer. diff --git a/protocol.py b/protocol.py index 7a6140a..324ca76 100644 --- a/protocol.py +++ b/protocol.py @@ -1614,9 +1614,10 @@ Hi! You recently replied