Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Assetcontroller cleanup #5858

Merged
merged 9 commits into from
Jul 17, 2018
Merged

Conversation

dmeltzer
Copy link
Contributor

Been sitting on this one for a little while, getting tired of trying to keep it up to date :) This looks much bigger than it is, I think. Primarily just code reorganization, moving Asset file operations to their own controller as well as bulk asset operations. Trying to keep things a bit more CRUDY as well as the files a bit less gigantic. If the direction looks good, I'll keep poking at some of the other controllers, if you feel like it's just noisy to make these changes feel free to reject :)

@dmeltzer dmeltzer requested a review from snipe as a code owner July 16, 2018 22:19
This is a giant diff without many functional changes, mostly cosmetic.
I've pulled a number of methods out of assetscontroller, preferring
instead to create some more targetted controllers for related actions.
I think this cleans up the file some, and suggests some places for
future targetted improvement.

Fix weird missing things.
@dmeltzer
Copy link
Contributor Author

A few other things fixed while poking at this:

  1. Removed old user importer code.
  2. Removed apiStore() methods that have been replaced by api controllers.
  3. Fixed a unit test failure introduced by date changes earlier today.
  4. Fixed a string that wasn't being translated properly when deleting files.

@snipe
Copy link
Owner

snipe commented Jul 16, 2018

Should we move the API controllers into their own business as well?

@dmeltzer
Copy link
Contributor Author

I would think so... I'd love to readdress at some point the idea of moving everywhere to just using api controllers and parsing it in the frontend, it seems like we could get rid of a lot of code that way.

@@ -420,7 +369,7 @@ public function destroy($id = null)

// Redirect to the user management page
return redirect()->route('users.index')->with('success', $success);
} catch (UserNotFoundException $e) {
} catch (ModelNotFoundException $e) {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why model not found here?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As far as I can tell, UserNotFoundException doesn't exist anywhere... Maybe it was a laravel 4 relic?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't remember exactly what led to this change--It was a few months ago, I remember that I didn't hit the expected error until changing it to this approach.

There are a number of other places in UsersController that uses UserNotFoundException, I haven't looked into porting those.

@snipe
Copy link
Owner

snipe commented Jul 17, 2018

Yeah, absolutely. That's the eventual plan, though I don't know whether I want to use Vue for that or just jQuery. I hate having to compile assets every time there's a tiny change. :-/

Trait-ifying and consuming the API for writes/updates are one of the biggest priorities for v5.

@dmeltzer
Copy link
Contributor Author

I'm going to go ahead and leave codacy where it is. Definitely cleaned up a lot of complexity, but AssetCheckinController@store() is going to be fixed when I extract a checkin method again, and the other ones are just codacy being picky :)

@snipe snipe merged commit 638a7b2 into snipe:develop Jul 17, 2018
@dmeltzer dmeltzer deleted the assetcontroller-cleanup branch July 17, 2018 00:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants