mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
public_export: Add support for deleting export after access.
The RealmAuditLog object ID was stored in the event sent to the deferred_work queue as a means to update the row's extra_data field. The extra_data field then stores the location of the export.
This commit is contained in:
@@ -43,7 +43,7 @@ from zerver.lib.db import reset_queries
|
||||
from zerver.lib.redis_utils import get_redis_client
|
||||
from zerver.context_processors import common_context
|
||||
from zerver.lib.outgoing_webhook import do_rest_call, get_outgoing_webhook_service_handler
|
||||
from zerver.models import get_bot_services
|
||||
from zerver.models import get_bot_services, RealmAuditLog
|
||||
from zulip_bots.lib import extract_query_without_mention
|
||||
from zerver.lib.bot_lib import EmbeddedBotHandler, get_bot_handler, EmbeddedBotQuitException
|
||||
from zerver.lib.exceptions import RateLimited
|
||||
@@ -620,6 +620,11 @@ class DeferredWorker(QueueProcessingWorker):
|
||||
delete_after_upload=True)
|
||||
assert public_url is not None
|
||||
|
||||
# TODO: This enables support for delete after access, and needs to be tested.
|
||||
export_event = RealmAuditLog.objects.get(id=event['id'])
|
||||
export_event.extra_data = public_url
|
||||
export_event.save(update_fields=['extra_data'])
|
||||
|
||||
# Send a private message notification letting the user who
|
||||
# triggered the export know the export finished.
|
||||
user_profile = get_user_profile_by_id(event['user_profile_id'])
|
||||
|
||||
Reference in New Issue
Block a user