⚗️ add assigned event

Fix QQ-GITHUB-BOT-1Q
This commit is contained in:
yanyongyu 2021-08-20 23:41:13 +08:00
parent 5a95e809a1
commit 8b0c4618c7
4 changed files with 81 additions and 11 deletions

View File

@ -4,7 +4,7 @@
@Author : yanyongyu
@Date : 2021-03-11 16:57:04
@LastEditors : yanyongyu
@LastEditTime : 2021-08-20 23:24:08
@LastEditTime : 2021-08-20 23:32:41
@Description : None
@GitHub : https://github.com/yanyongyu
"""
@ -23,7 +23,7 @@ from .comment import Comment
from .timeline import (
TimelineEvent, TimelineEventCommited, TimelineEventForcePushed,
TimelineEventHeadDeleted, TimelineEventReferenced, TimelineEventCommented,
TimelineEventCommentDeleted, TimelineEventMentioned,
TimelineEventCommentDeleted, TimelineEventAssigned, TimelineEventMentioned,
TimelineEventSubscribed, TimelineEventUnsubscribed, TimelineEventReviewed,
TimelineEventReviewRequested, TimelineEventReviewRemoved,
TimelineEventReviewDismissed, TimelineEventRenamed, TimelineEventLabeled,
@ -102,13 +102,14 @@ class Issue(BaseModel):
Union[TimelineEventCommited, TimelineEventForcePushed,
TimelineEventHeadDeleted, TimelineEventReferenced,
TimelineEventCommented, TimelineEventCommentDeleted,
TimelineEventMentioned, TimelineEventSubscribed,
TimelineEventUnsubscribed, TimelineEventReviewed,
TimelineEventReviewRequested, TimelineEventReviewRemoved,
TimelineEventReviewDismissed, TimelineEventRenamed,
TimelineEventLabeled, TimelineEventUnlabeled,
TimelineEventMerged, TimelineEventDeployed,
TimelineEventClosed, TimelineEventAddedToProject,
TimelineEventAssigned, TimelineEventMentioned,
TimelineEventSubscribed, TimelineEventUnsubscribed,
TimelineEventReviewed, TimelineEventReviewRequested,
TimelineEventReviewRemoved, TimelineEventReviewDismissed,
TimelineEventRenamed, TimelineEventLabeled,
TimelineEventUnlabeled, TimelineEventMerged,
TimelineEventDeployed, TimelineEventClosed,
TimelineEventAddedToProject,
TimelineEventMovedColumnsInProject,
TimelineEventRemovedFromProject, TimelineEventMilestoned,
TimelineEventDemilestoned, TimelineEvent],

View File

@ -4,7 +4,7 @@
@Author : yanyongyu
@Date : 2021-05-14 00:57:33
@LastEditors : yanyongyu
@LastEditTime : 2021-08-20 23:23:33
@LastEditTime : 2021-08-20 23:31:52
@Description : None
@GitHub : https://github.com/yanyongyu
"""
@ -131,6 +131,20 @@ class TimelineEventCommentDeleted(TimelineEvent):
created_at: datetime
# Issue assigned to Person
class TimelineEventAssigned(TimelineEvent):
type: Literal["assigned"]
id: int
node_id: str
url: str
actor: Actor
commit_id: Optional[str]
commit_url: Optional[str]
created_at: datetime
assignee: Actor
assigner: Actor
# Issue Mentioned Person
class TimelineEventMentioned(TimelineEvent):
event: Literal["mentioned"]

View File

@ -0,0 +1,52 @@
<!--
* @Author : yanyongyu
* @Date : 2021-08-20 23:33:46
* @LastEditors : yanyongyu
* @LastEditTime : 2021-08-20 23:37:56
* @Description : None
* @GitHub : https://github.com/yanyongyu
-->
<div class="TimelineItem">
<div class="TimelineItem-badge">
<svg
aria-hidden="true"
height="16"
viewBox="0 0 16 16"
version="1.1"
width="16"
data-view-component="true"
class="octicon octicon-person"
>
<path
fill-rule="evenodd"
d="M10.5 5a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0zm.061 3.073a4 4 0 10-5.123 0 6.004 6.004 0 00-3.431 5.142.75.75 0 001.498.07 4.5 4.5 0 018.99 0 .75.75 0 101.498-.07 6.005 6.005 0 00-3.432-5.142z"
></path>
</svg>
</div>
<div class="TimelineItem-body">
{% set self_request = event.assigner.login == event.assignee.login %}
<a class="d-inline-block">
<img
class="avatar avatar-user"
height="20"
width="20"
src="{{ event.assigner.avatar_url }}"
/>
</a>
<a class="author Link--primary text-bold">
{{ event.assigner.login|escape }}
</a>
<!-- prettier-ignore -->
{% if self_request -%}
self-assigned this
{%- else -%}
assigned
<a class="author Link--primary text-bold">
{{ event.assignee.login|escape }}
</a>
<!-- prettier-ignore -->
{%- endif %}
<a class="Link--secondary">{{ event.created_at|relative_time }}</a>
</div>
</div>

View File

@ -2,7 +2,7 @@
* @Author : yanyongyu
* @Date : 2021-05-14 17:11:26
* @LastEditors : yanyongyu
* @LastEditTime : 2021-08-20 23:25:47
* @LastEditTime : 2021-08-20 23:33:11
* @Description : None
* @GitHub : https://github.com/yanyongyu
-->
@ -36,6 +36,9 @@
{% elif event|classname == "TimelineEventCommentDeleted" -%}
{% include "comment-delete.html" %}
{% elif event|classname == "TimelineEventAssigned" -%}
{% include "assigned.html" %}
{% elif event|classname == "TimelineEventCommited" -%}
{% include "commit.html" %}