avatar zero-24
zero-24
22 Jun 2015

Hi,

if some one open a issue on github we need to manually add the No Code Attached Yet label.

As the code that manage it looks wrong to me?

This trigger the event: https://github.com/joomla/jissues/blob/master/src/App/Tracker/Controller/Hooks/ReceiveIssuesHook.php#L135

$this->triggerEvent('onIssueAfterCreate', $table, array('action' => $action));

but we use it only with one argument here:

https://github.com/joomla/jissues/blob/master/src/App/Tracker/Controller/Hooks/Listeners/JoomlacmsIssuesListener.php#L32

public function onIssueAfterCreate(Event $event)

Is there a reason to pass the action? As we don't use it later. To get the action we use the following code:

        // Pull the arguments array
        $arguments = $event->getArguments();
        // Only perform these events if this is a new issue, action will be 'opened'
        if ($arguments['action'] === 'opened')
        {
avatar zero-24 zero-24 - open - 22 Jun 2015
avatar mbabker
mbabker - comment - 22 Jun 2015

The trigger is right. The way the Framework's Event class is designed, all of your arguments have to be added through the addArgument() method (unless you subclass it and add a "pretty" API for setting arguments) and then within the event listener you have to fetch out your arguments array via the getArguments() method. If you dig into the triggerEvent() method you'll see that we default inject a bunch of arguments into the event and that third argument (the array with the action) allows additional optional arguments for the event based on context.

avatar zero-24
zero-24 - comment - 22 Jun 2015

hmm than it looks correct. Do you have any idea why it fails than?

avatar mbabker
mbabker - comment - 22 Jun 2015

I've got nothing. No log messages and the class name is correct for the expectation to register the listener.

avatar zero-24
zero-24 - comment - 2 Jul 2015

@mbabker can we try the following debug code here:
https://github.com/joomla/jissues/blob/master/src/App/Tracker/Controller/Hooks/Listeners/JoomlacmsIssuesListener.php#L36

            $logger->info(
                sprintf(
                    'onIssueAfterCreate for %s/%s #%d - Action: %s',
                    $project->gh_user,
                    $project->gh_project,
                    $hookData->issue->number,
                    $arguments['action']
                )
            );

If that is in i can open a issue on github. To be sure we get in and no other "action" than opened is set here?

avatar zero-24 zero-24 - change - 17 Oct 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-10-17 22:57:54
Closed_By zero-24
avatar zero-24 zero-24 - close - 17 Oct 2015

Add a Comment

Login with GitHub to post a comment