Skip to content

Commit 4abebd9

Browse files
committed
Removing maintainers, private words thing for now
Just reducing the scope of changes to get a faster merge
1 parent bbc600b commit 4abebd9

File tree

4 files changed

+15
-55
lines changed

4 files changed

+15
-55
lines changed

app/config/github.yml

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,24 +11,7 @@ parameters:
1111
symfony/symfony:
1212
subscribers:
1313
- app.subscriber.issue_subscriber
14-
maintainers:
15-
- fabpot
16-
- webmozart
17-
- Tobion
18-
- romainneutron
19-
- nicolas-grekas
20-
- stof
21-
- dunglas
22-
- aitboudad
23-
- jakzal
24-
- xabbuh
25-
- javiereguiluz
2614
secret: change_me
2715
symfony/symfony-docs:
2816
subscribers:
2917
- app.subscriber.issue_subscriber
30-
maintainers:
31-
- weaverryan
32-
- WouterJ
33-
- xabbuh
34-
- javiereguiluz

src/AppBundle/Event/GitHubEvent.php

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,11 @@ class GitHubEvent extends Event
1616

1717
private $data;
1818
private $repository;
19-
private $maintainers;
2019

21-
public function __construct(array $data, Repository $repository, array $maintainers = array())
20+
public function __construct(array $data, Repository $repository)
2221
{
2322
$this->data = $data;
2423
$this->repository = $repository;
25-
$this->maintainers = $maintainers;
2624
}
2725

2826
public function getData()
@@ -38,11 +36,6 @@ public function getRepository()
3836
return $this->repository;
3937
}
4038

41-
public function getMaintainers()
42-
{
43-
return $this->maintainers;
44-
}
45-
4639
public function getResponseData()
4740
{
4841
return $this->responseData;

src/AppBundle/Issues/IssueListener.php

Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,12 @@ class IssueListener implements EventSubscriberInterface
1717
'needs comments' => Status::NEEDS_COMMENTS,
1818
];
1919

20-
private static $privateTriggerWordToStatus = [
21-
'ready' => Status::READY,
22-
];
23-
2420
/**
2521
* @var StatusApi
2622
*/
2723
private $statusApi;
2824

29-
final public function __construct(StatusApi $statusApi)
25+
public function __construct(StatusApi $statusApi)
3026
{
3127
$this->statusApi = $statusApi;
3228
}
@@ -43,22 +39,16 @@ public function onIssueComment(GitHubEvent $event)
4339
$repository = $event->getRepository();
4440
$newStatus = null;
4541
$issueNumber = $data['issue']['number'];
46-
$user = $data['comment']['user']['login'];
47-
$statuses = static::$triggerWordToStatus;
48-
49-
if (in_array($user, $event->getMaintainers(), true)) {
50-
$statuses += static::$privateTriggerWordToStatus;
51-
}
5242

53-
$triggerWord = implode('|', array_keys($statuses));
43+
$triggerWord = implode('|', array_keys(static::$triggerWordToStatus));
5444
$formatting = '[\\s\\*]*';
5545
// Match first character after "status:"
5646
// Case insensitive ("i"), ignores formatting with "*" before or after the ":"
5747
$pattern = "~(?=\n|^)${formatting}status${formatting}:${formatting}[\"']?($triggerWord)[\"']?${formatting}[.!]?${formatting}(?<=\r\n|\n|$)~i";
5848

5949
if (preg_match_all($pattern, $data['comment']['body'], $matches)) {
6050
// Second subpattern = first status character
61-
$newStatus = $statuses[strtolower(end($matches[1]))];
51+
$newStatus = static::$triggerWordToStatus[strtolower(end($matches[1]))];
6252

6353
$this->setIssueStatus($issueNumber, $newStatus, $repository);
6454
}
@@ -79,20 +69,20 @@ public function onPullRequest(GitHubEvent $event)
7969
$data = $event->getData();
8070
$repository = $event->getRepository();
8171
if ('opened' !== $action = $data['action']) {
82-
$responseData = array('unsupported_action' => $action);
83-
} else {
84-
$pullRequestNumber = $data['pull_request']['number'];
85-
$newStatus = Status::NEEDS_REVIEW;
86-
87-
$this->setIssueStatus($pullRequestNumber, $newStatus, $repository);
72+
$event->setResponseData(array('unsupported_action' => $action));
8873

89-
$responseData = array(
90-
'pull_request' => $pullRequestNumber,
91-
'status_change' => $newStatus,
92-
);
74+
return;
9375
}
9476

95-
$event->setResponseData($responseData);
77+
$pullRequestNumber = $data['pull_request']['number'];
78+
$newStatus = Status::NEEDS_REVIEW;
79+
80+
$this->setIssueStatus($pullRequestNumber, $newStatus, $repository);
81+
82+
$event->setResponseData(array(
83+
'pull_request' => $pullRequestNumber,
84+
'status_change' => $newStatus,
85+
));
9686
}
9787

9888
/**

src/AppBundle/Repository/Repository.php

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -75,10 +75,4 @@ public function getSecret()
7575
{
7676
// todo - implement setting a secret
7777
}
78-
79-
public function getMaintainers()
80-
{
81-
// todo - implement this
82-
return [];
83-
}
8478
}

0 commit comments

Comments
 (0)