Skip to content

Commit 43dc12d

Browse files
committedAug 9, 2018
Don't trigger events on deleted comments
According to https://developer.github.com/v3/activity/events/types/#issuecommentevent we should just filter out delete actions. Closes #156
1 parent 1783e3a commit 43dc12d

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed
 

‎ofborg/src/ghevent/issuecomment.rs

+9
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,16 @@ use ofborg::ghevent::{Comment, Repository, Issue};
22

33
#[derive(Serialize, Deserialize, Debug)]
44
pub struct IssueComment {
5+
pub action: IssueCommentAction,
56
pub comment: Comment,
67
pub repository: Repository,
78
pub issue: Issue,
89
}
10+
11+
#[derive(Serialize, Deserialize, Debug, PartialEq)]
12+
#[serde(rename_all="snake_case")]
13+
pub enum IssueCommentAction {
14+
Created,
15+
Edited,
16+
Deleted,
17+
}

‎ofborg/src/ghevent/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ mod common;
22
mod issuecomment;
33
mod pullrequestevent;
44

5-
pub use self::issuecomment::IssueComment;
5+
pub use self::issuecomment::{IssueComment,IssueCommentAction};
66
pub use self::pullrequestevent::{PullRequest, PullRequestEvent, PullRequestAction, PullRequestState};
77
pub use self::common::{Issue, Repository, User, Comment};

‎ofborg/src/tasks/githubcommentfilter.rs

+4
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,10 @@ impl worker::SimpleWorker for GitHubCommentWorker {
5050
}
5151

5252
fn consumer(&mut self, job: &ghevent::IssueComment) -> worker::Actions {
53+
if job.action == ghevent::IssueCommentAction::Deleted {
54+
return vec![worker::Action::Ack];
55+
}
56+
5357
let instructions = commentparser::parse(&job.comment.body);
5458
if instructions == None {
5559
return vec![worker::Action::Ack];

0 commit comments

Comments
 (0)
Please sign in to comment.