mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	uploads: Show used upload space in attachments UI.
This commit is contained in:
		@@ -8,8 +8,10 @@ from zerver.lib.attachments import user_attachments, remove_attachment, \
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def list_by_user(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
 | 
			
		||||
    return json_success({"attachments": user_attachments(user_profile)})
 | 
			
		||||
 | 
			
		||||
    return json_success({
 | 
			
		||||
        "attachments": user_attachments(user_profile),
 | 
			
		||||
        "upload_space_used": user_profile.realm.currently_used_upload_space_bytes(),
 | 
			
		||||
    })
 | 
			
		||||
 | 
			
		||||
def remove(request: HttpRequest, user_profile: UserProfile, attachment_id: str) -> HttpResponse:
 | 
			
		||||
    attachment = access_attachment_by_id(user_profile, int(attachment_id),
 | 
			
		||||
@@ -17,6 +19,3 @@ def remove(request: HttpRequest, user_profile: UserProfile, attachment_id: str)
 | 
			
		||||
    remove_attachment(user_profile, attachment)
 | 
			
		||||
    notify_attachment_update(user_profile, "remove", {"id": int(attachment_id)})
 | 
			
		||||
    return json_success()
 | 
			
		||||
 | 
			
		||||
def upload_space_used(request: HttpRequest, user_profile: UserProfile) -> HttpResponse:
 | 
			
		||||
    return json_success({"upload_space_used": user_profile.realm.currently_used_upload_space_bytes()})
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user