mirror of
https://github.com/Xtao-Labs/QQ-GitHub-Bot.git
synced 2025-01-30 15:08:54 +00:00
🚧 add events
This commit is contained in:
parent
91461dcf1e
commit
e69ade0823
@ -4,7 +4,7 @@
|
||||
@Author : yanyongyu
|
||||
@Date : 2021-03-11 16:57:04
|
||||
@LastEditors : yanyongyu
|
||||
@LastEditTime : 2021-05-16 22:47:53
|
||||
@LastEditTime : 2021-05-21 01:02:36
|
||||
@Description : None
|
||||
@GitHub : https://github.com/yanyongyu
|
||||
"""
|
||||
@ -22,8 +22,8 @@ from .label import Label
|
||||
from .comment import Comment
|
||||
from .timeline import (TimelineEvent, TimelineEventCommited,
|
||||
TimelineEventCommented, TimelineEventReviewed,
|
||||
TimelineEventRenamed, TimelineEventMerged,
|
||||
TimelineEventClosed)
|
||||
TimelineEventReviewRequested, TimelineEventRenamed,
|
||||
TimelineEventMerged, TimelineEventClosed)
|
||||
|
||||
|
||||
class IssuePullRequest(_BaseModel):
|
||||
@ -92,9 +92,10 @@ class Issue(BaseModel):
|
||||
}
|
||||
return PaginatedList(Union[TimelineEventCommited,
|
||||
TimelineEventCommented,
|
||||
TimelineEventReviewed, TimelineEventRenamed,
|
||||
TimelineEventMerged, TimelineEventClosed,
|
||||
TimelineEvent],
|
||||
TimelineEventReviewed,
|
||||
TimelineEventReviewRequested,
|
||||
TimelineEventRenamed, TimelineEventMerged,
|
||||
TimelineEventClosed, TimelineEvent],
|
||||
self.requester,
|
||||
"GET",
|
||||
self.timeline_url,
|
||||
|
@ -4,7 +4,7 @@
|
||||
@Author : yanyongyu
|
||||
@Date : 2021-05-14 00:57:33
|
||||
@LastEditors : yanyongyu
|
||||
@LastEditTime : 2021-05-17 18:53:05
|
||||
@LastEditTime : 2021-05-21 02:24:18
|
||||
@Description : None
|
||||
@GitHub : https://github.com/yanyongyu
|
||||
"""
|
||||
@ -106,6 +106,19 @@ class TimelineEventReviewed(TimelineEvent):
|
||||
links: TimelineEventReviewedLinks = Field(alias="_links")
|
||||
|
||||
|
||||
class TimelineEventReviewRequested(TimelineEvent):
|
||||
event: Literal["review_requested"]
|
||||
id: int
|
||||
node_id: str
|
||||
url: str
|
||||
actor: User
|
||||
commit_id: Optional[str]
|
||||
commit_url: Optional[str]
|
||||
created_at: datetime
|
||||
review_requester: User
|
||||
requested_reviewer: User
|
||||
|
||||
|
||||
class TimelineEventRenamedDetail(_BaseModel):
|
||||
to: str
|
||||
from_: str = Field(alias="from")
|
||||
@ -134,6 +147,23 @@ class TimelineEventMerged(TimelineEvent):
|
||||
created_at: datetime
|
||||
|
||||
|
||||
class TimelineEventLabeledInfo(_BaseModel):
|
||||
name: str
|
||||
color: str
|
||||
|
||||
|
||||
class TimelineEventLabeled(TimelineEvent):
|
||||
event: Literal["labeled"]
|
||||
id: int
|
||||
node_id: str
|
||||
url: str
|
||||
actor: User
|
||||
commit_id: Optional[str]
|
||||
commit_url: Optional[str]
|
||||
created_at: datetime
|
||||
label: TimelineEventLabeledInfo
|
||||
|
||||
|
||||
class TimelineEventClosed(TimelineEvent):
|
||||
event: Literal["closed"]
|
||||
id: int
|
||||
|
@ -2,7 +2,7 @@
|
||||
* @Author : yanyongyu
|
||||
* @Date : 2021-05-15 15:08:50
|
||||
* @LastEditors : yanyongyu
|
||||
* @LastEditTime : 2021-05-16 12:21:39
|
||||
* @LastEditTime : 2021-05-21 01:22:12
|
||||
* @Description : None
|
||||
* @GitHub : https://github.com/yanyongyu
|
||||
-->
|
||||
@ -76,7 +76,8 @@
|
||||
<td
|
||||
class="d-block width-full p-3 overflow-visible f5 markdown-body"
|
||||
>
|
||||
{{event.body_html|default(event.body_text)|default(event.body)}}
|
||||
{{event.body_html or (event.body_text|escape) or
|
||||
(event.body|escape) or ("<em>No description provided.</em>")}}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
|
@ -37,6 +37,9 @@
|
||||
{% elif event|classname == "TimelineEventReviewed" -%}
|
||||
{% include "review.html" %}
|
||||
|
||||
{% elif event|classname == "TimelineEventReviewRequested" -%}
|
||||
{% include "review_request.html" %}
|
||||
|
||||
{% elif event|classname == "TimelineEventRenamed" -%}
|
||||
{% include "rename.html" %}
|
||||
|
||||
@ -54,7 +57,7 @@
|
||||
{% include "close.html" %}
|
||||
{%- endif %}
|
||||
|
||||
{% else %}
|
||||
{%- else -%}
|
||||
<!-- TODO: other events -->
|
||||
<!-- prettier-ignore -->
|
||||
{%- endif %}
|
||||
|
52
src/plugins/github/libs/issue/templates/review_request.html
Normal file
52
src/plugins/github/libs/issue/templates/review_request.html
Normal file
@ -0,0 +1,52 @@
|
||||
<!--
|
||||
* @Author : yanyongyu
|
||||
* @Date : 2021-05-21 01:06:07
|
||||
* @LastEditors : yanyongyu
|
||||
* @LastEditTime : 2021-05-21 01:19:04
|
||||
* @Description : None
|
||||
* @GitHub : https://github.com/yanyongyu
|
||||
-->
|
||||
|
||||
<div class="TimelineItem">
|
||||
<div class="TimelineItem-badge">
|
||||
<svg
|
||||
class="octicon octicon-eye"
|
||||
viewBox="0 0 16 16"
|
||||
version="1.1"
|
||||
width="16"
|
||||
height="16"
|
||||
aria-hidden="true"
|
||||
>
|
||||
<path
|
||||
fill-rule="evenodd"
|
||||
d="M1.679 7.932c.412-.621 1.242-1.75 2.366-2.717C5.175 4.242 6.527 3.5 8 3.5c1.473 0 2.824.742 3.955 1.715 1.124.967 1.954 2.096 2.366 2.717a.119.119 0 010 .136c-.412.621-1.242 1.75-2.366 2.717C10.825 11.758 9.473 12.5 8 12.5c-1.473 0-2.824-.742-3.955-1.715C2.92 9.818 2.09 8.69 1.679 8.068a.119.119 0 010-.136zM8 2c-1.981 0-3.67.992-4.933 2.078C1.797 5.169.88 6.423.43 7.1a1.619 1.619 0 000 1.798c.45.678 1.367 1.932 2.637 3.024C4.329 13.008 6.019 14 8 14c1.981 0 3.67-.992 4.933-2.078 1.27-1.091 2.187-2.345 2.637-3.023a1.619 1.619 0 000-1.798c-.45-.678-1.367-1.932-2.637-3.023C11.671 2.992 9.981 2 8 2zm0 8a2 2 0 100-4 2 2 0 000 4z"
|
||||
></path>
|
||||
</svg>
|
||||
</div>
|
||||
<div class="TimelineItem-body">
|
||||
{% set self_request = event.review_requester.login ==
|
||||
event.requested_reviewer.login %}
|
||||
<a class="d-inline-block">
|
||||
<img
|
||||
class="avatar avatar-user"
|
||||
height="20"
|
||||
width="20"
|
||||
src="{{ event.review_requester.avatar_url }}"
|
||||
/>
|
||||
</a>
|
||||
<a class="author Link--primary text-bold">
|
||||
{{ event.review_requester.login }}
|
||||
</a>
|
||||
<!-- prettier-ignore -->
|
||||
{% if self_request -%}
|
||||
self-requested a review
|
||||
{%- else -%}
|
||||
requested a review from
|
||||
<a class="author Link--primary text-bold">
|
||||
{{ event.requested_reviewer.login }}
|
||||
</a>
|
||||
<!-- prettier-ignore -->
|
||||
{%- endif %}
|
||||
{{event.created_at|relative_time}}
|
||||
</div>
|
||||
</div>
|
Loading…
Reference in New Issue
Block a user