Success

User tests: Successful: Unsuccessful:

avatar zero-24
zero-24
30 Jan 2015

Based on 08be5c5 this will add some code that do it generaly for all status that we have on jissues. This will run on every save action and add the status as label on github. (Ref #318)

I hope @b2z @mbabker or @elkuku can have a look into the code and the questions

Open questions

  • do we need to create the label bevor adding it via the $github->issues->labels->add( function or will this done automatic?
  • here: 08be5c5 we use some logger messages. How can i add a new logger instance or is this not needed?
avatar zero-24 zero-24 - open - 30 Jan 2015
avatar mbabker
mbabker - comment - 30 Jan 2015

At a glance, things look OK. This just highlights the need for a plugin system like the GitHub hooks have so we aren't putting code that's really only going to apply to one project into the main controllers.

As for the logging, it doesn't look like we inject a logger into the controllers (the hooks create a Monolog\Logger instance specific within the initialize method), so one option is to call $this->getContainer()->get('app')->getLogger(); to get the one being set in the application class or to create an instance within the controller. For the hooks, it's more important to log that data since there's no human interaction at any point in those request cycles; in this instance it may not be something we need.

avatar zero-24
zero-24 - comment - 30 Jan 2015

At a glance, things look OK.

Thanks @mbabker!

in this instance it may not be something we need.

ok so how we handel the Exceptions?

only by

catch (\DomainException $e)
{
    // Do nothing
}

or should we throw it like:

catch (\DomainException $e)
{
    throw $e;
}
avatar b2z
b2z - comment - 1 Feb 2015

@zero-24 I agree to @mbabker about putting it into the main controller. But currently we do not have other place, though #596 could be the saver if I am correct about its usage...

As for the code I have some questions and will comment inline, but not now. Why? If #596 will be used then your code should be refactored to match its pattern.

avatar zero-24
zero-24 - comment - 1 Feb 2015

Thanks for the feedback @b2z !. Let me know if something needs to be changed. Did you have a answere to my question regarding Exceptions or should we also wait for #596 ? Thanks

avatar b2z
b2z - comment - 1 Feb 2015

Regarding exceptions - I think that we should do not throw them. Saving an issue should not break because of the labels. May be we can enqueueMessage to let the user know that something went wrong.

avatar zero-24
zero-24 - comment - 1 Feb 2015

@b2z can you have a look into the last commits regarding enqueueMessage? zero-24@d4a6855 and ff23ba9

avatar b2z
b2z - comment - 1 Feb 2015

I think that we should enqueue only errors ;) Ok if you wish to work on this code without waiting #596 I will comment also inline.

avatar zero-24
zero-24 - comment - 2 Feb 2015

@b2z I have just fixed a issue with the var naming $new_label to $newlabel :smile: Should be good now for testing. Thanks @b2z

avatar b2z
b2z - comment - 2 Feb 2015

@zero-24 I reviewed and fixed some issues :wink: But I pushed my changes to this repo. See here the changes I made. So my question is - can I open new PR based on this changes and close this one? :blush:

avatar zero-24
zero-24 - comment - 2 Feb 2015

Thanks @b2z sure I will close here and you can open the new PR!

avatar zero-24 zero-24 - close - 2 Feb 2015
avatar zero-24 zero-24 - close - 2 Feb 2015
avatar zero-24 zero-24 - change - 2 Feb 2015
Status New Closed
Closed_Date 0000-00-00 00:00:00 2015-02-02 19:32:35
avatar zero-24 zero-24 - head_ref_deleted - 2 Feb 2015
avatar elkuku
elkuku - comment - 2 Feb 2015

Just a small side note(s).... You would need some code to run this only for specific projects and I guess you should use the defined edit bot credentials for the current project when instantiating the GitHub object.

avatar zero-24
zero-24 - comment - 2 Feb 2015

You would need some code to run this only for specific projects

@elkuku can you tell my what you mean? What kind of specific?

The code only run on projekts that on github see: https://github.com/joomla/jissues/blob/zero-24-patch-1/src/App/Tracker/Controller/Issue/Save.php#L98-130

avatar zero-24
zero-24 - comment - 2 Feb 2015

@b2z for the seccond issue i just open a new PR against the new branche: #601

avatar mbabker
mbabker - comment - 2 Feb 2015

What he's saying is the same as I did above, there really needs to be something set up so that we aren't coding project specific tasks into the main controller classes. Otherwise, if things are merged as is, every project using this app is going to have the ~status labels applied to it or we'll have to use hardcoded checks for specific projects.

The AbstractHookController for our webhook events uses the initialize() method to set up the event dispatcher and figure out if there are any event listeners for the project and uses that to perform project specific tasks. It looks like #596 is another way to handle the same thinking. The main point is that between those two approaches, it keeps project specific tasks out of an area where code is executing for all projects.

avatar b2z
b2z - comment - 2 Feb 2015

@mbabker agree. What I want to understand is - do we need to use events or rely on #596? It seems that #596 is more thought for automatic processing.

avatar mbabker
mbabker - comment - 2 Feb 2015

Either approach would work as long as it can access the needed data and services.

avatar zero-24
zero-24 - comment - 3 Feb 2015

@mbabker just a idea that come up over the day. What do you think about a parameter?

I think it will be useful for other projekts that use this app, to show the state of the Issue also on github.

avatar mbabker
mbabker - comment - 3 Feb 2015

I think I'd still rather see whatever's calling the code to do this in a project specific executor. And I think that's something that #596 would address it looks like (we write a common task then somewhere in the UI we update a project to use that action).

Is it a useful feature? Absolutely. But, I don't think that we should be forcing it on each GitHub repo that is hooked up to the application. The parameter addresses it, but now we're back at my original concern of adding tasks that are project centric in our main code which kind of goes against making these parts of the app extensible. I'd scream just as loudly if we tried making JControllerForm in the CMS dependent on a parameter from com_newsfeeds.

avatar elkuku
elkuku - comment - 3 Feb 2015

making JControllerForm in the CMS dependent on a parameter from com_newsfeeds.

That'd be a decent example :stuck_out_tongue_winking_eye:

avatar zero-24
zero-24 - comment - 3 Feb 2015

hmm ok thanks @mbabker. So let me know if should implement it with the new way (if we have a final commit of it) if i'm able to understand it i would be happy to help :smile:

Add a Comment

Login with GitHub to post a comment