hooks: Add updated_at parameter to MergeRequest and Issue hooks
Signed-off-by: pep <pep@bouah.net>
This commit is contained in:
parent
0a02d85563
commit
990829d72c
5 changed files with 10 additions and 0 deletions
|
|
@ -19,6 +19,7 @@ use crate::hooks::types::{
|
|||
};
|
||||
|
||||
pub use ::forgejo_hooks::{Hook as ForgejoHook, Issue as FjIssue, IssueAction as FjIssueAction};
|
||||
use chrono::Utc;
|
||||
|
||||
impl From<FjIssueAction> for IssueAction {
|
||||
fn from(other: FjIssueAction) -> IssueAction {
|
||||
|
|
@ -43,6 +44,7 @@ impl From<FjIssue> for Issue {
|
|||
name: other.repository.name,
|
||||
},
|
||||
url: Some(other.issue.html_url),
|
||||
updated_at: other.issue.updated_at.unwrap_or(Utc::now()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -79,6 +79,7 @@ impl From<GlIssueHook> for Issue {
|
|||
id: other.object_attributes.iid,
|
||||
title: other.object_attributes.title,
|
||||
url: other.object_attributes.url,
|
||||
updated_at: other.object_attributes.updated_at.as_ref().clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -121,6 +122,7 @@ impl From<GlMergeRequestHook> for MergeRequest {
|
|||
id: other.object_attributes.iid,
|
||||
title: other.object_attributes.title,
|
||||
url: other.object_attributes.url,
|
||||
updated_at: other.object_attributes.updated_at.as_ref().clone(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,6 +13,8 @@
|
|||
// You should have received a copy of the GNU Affero General Public License
|
||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
|
||||
use chrono::{DateTime, Utc};
|
||||
|
||||
/// Defines a generic user that can be used for many purposes.
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
pub struct User {
|
||||
|
|
@ -66,6 +68,7 @@ pub struct Issue {
|
|||
pub id: u64,
|
||||
pub title: String,
|
||||
pub url: Option<String>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
@ -95,6 +98,7 @@ pub struct MergeRequest {
|
|||
pub id: u64,
|
||||
pub title: String,
|
||||
pub url: Option<String>,
|
||||
pub updated_at: DateTime<Utc>,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, PartialEq)]
|
||||
|
|
|
|||
Loading…
Reference in a new issue