mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	integrations: Improve GitHub issue milestoned notifications.
Earlier, the notifications had no information about the milestone that was added or removed.
This commit is contained in:
		
				
					committed by
					
						
						Tim Abbott
					
				
			
			
				
	
			
			
			
						parent
						
							1c567ae616
						
					
				
				
					commit
					34f31ab9d2
				
			@@ -29,6 +29,7 @@ from zerver.lib.webhooks.git import (
 | 
			
		||||
    get_commits_comment_action_message,
 | 
			
		||||
    get_issue_event_message,
 | 
			
		||||
    get_issue_labeled_or_unlabeled_event_message,
 | 
			
		||||
    get_issue_milestoned_or_demilestoned_event_message,
 | 
			
		||||
    get_pull_request_event_message,
 | 
			
		||||
    get_push_commits_event_message,
 | 
			
		||||
    get_push_tag_event_message,
 | 
			
		||||
@@ -161,6 +162,10 @@ def get_issue_body(helper: Helper) -> str:
 | 
			
		||||
    action = payload["action"].tame(check_string)
 | 
			
		||||
    issue = payload["issue"]
 | 
			
		||||
    has_assignee = "assignee" in payload
 | 
			
		||||
 | 
			
		||||
    if action in ("milestoned", "demilestoned"):
 | 
			
		||||
        return get_issue_milestoned_or_demilestoned_body(helper)
 | 
			
		||||
 | 
			
		||||
    base_message = get_issue_event_message(
 | 
			
		||||
        user_name=get_sender_name(payload),
 | 
			
		||||
        action=action,
 | 
			
		||||
@@ -221,6 +226,23 @@ def get_issue_labeled_or_unlabeled_body(helper: Helper) -> str:
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_issue_milestoned_or_demilestoned_body(helper: Helper) -> str:
 | 
			
		||||
    payload = helper.payload
 | 
			
		||||
    include_title = helper.include_title
 | 
			
		||||
    issue = payload["issue"]
 | 
			
		||||
 | 
			
		||||
    return get_issue_milestoned_or_demilestoned_event_message(
 | 
			
		||||
        user_name=get_sender_name(payload),
 | 
			
		||||
        action="added" if payload["action"].tame(check_string) == "milestoned" else "removed",
 | 
			
		||||
        url=issue["html_url"].tame(check_string),
 | 
			
		||||
        number=issue["number"].tame(check_int),
 | 
			
		||||
        milestone_name=payload["milestone"]["title"].tame(check_string),
 | 
			
		||||
        milestone_url=payload["milestone"]["html_url"].tame(check_string),
 | 
			
		||||
        user_url=get_sender_url(payload),
 | 
			
		||||
        title=issue["title"].tame(check_string) if include_title else None,
 | 
			
		||||
    )
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def get_fork_body(helper: Helper) -> str:
 | 
			
		||||
    payload = helper.payload
 | 
			
		||||
    forkee = payload["forkee"]
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user