mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	logging_util: Remove dependence on get_current_request.
Pass the HttpRequest explicitly through the two webhooks that log to the webhook loggers. get_current_request is now unused, so remove it (in the same commit for test coverage reasons). Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							f66e2c3112
						
					
				
				
					commit
					63be67af80
				
			@@ -48,17 +48,17 @@ DISCUSSION_COMMENT_TEMPLATE = "{author} [commented]({comment_url}) on [discussio
 | 
			
		||||
class Helper:
 | 
			
		||||
    def __init__(
 | 
			
		||||
        self,
 | 
			
		||||
        request: HttpRequest,
 | 
			
		||||
        payload: WildValue,
 | 
			
		||||
        include_title: bool,
 | 
			
		||||
    ) -> None:
 | 
			
		||||
        self.request = request
 | 
			
		||||
        self.payload = payload
 | 
			
		||||
        self.include_title = include_title
 | 
			
		||||
 | 
			
		||||
    def log_unsupported(self, event: str) -> None:
 | 
			
		||||
        summary = f"The '{event}' event isn't currently supported by the GitHub webhook; ignoring"
 | 
			
		||||
        log_unsupported_webhook_event(
 | 
			
		||||
            summary=summary,
 | 
			
		||||
        )
 | 
			
		||||
        log_unsupported_webhook_event(request=self.request, summary=summary)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_opened_or_update_pull_request_body(helper: Helper) -> str:
 | 
			
		||||
@@ -836,6 +836,7 @@ def api_github_webhook(
 | 
			
		||||
    body_function = EVENT_FUNCTION_MAPPER[event]
 | 
			
		||||
 | 
			
		||||
    helper = Helper(
 | 
			
		||||
        request=request,
 | 
			
		||||
        payload=payload,
 | 
			
		||||
        include_title=user_specified_topic is not None,
 | 
			
		||||
    )
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user