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
|
|
@ -25,6 +25,7 @@ hmac = "0.12"
|
|||
sha2 = "0.10"
|
||||
hex = "0.4"
|
||||
camino = { version = "1.2", features = ["serde1"] }
|
||||
chrono = { version = "0.4", default-features = false }
|
||||
|
||||
[patch.crates-io]
|
||||
forgejo-hooks = { path = "forgejo-hooks" }
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ Version NEXT:
|
|||
- Add 'rejoin' command to rejoin (leave/join) all rooms
|
||||
* Added:
|
||||
- Add PartialEq on hook types.
|
||||
- Add `updated_at` parameter to `MergeRequest` and `Issue` hook types.
|
||||
|
||||
Version 0.2.0:
|
||||
2023-08-23 Maxime “pep” Buquet <pep@bouah.net>
|
||||
|
|
|
|||
|
|
@ -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