Skip to content

More MVC Refactoring #1255

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

Merged
merged 5 commits into from
Feb 22, 2018
Merged

Conversation

jtgeibel
Copy link
Member

This PR splits several existing source files into the MVC submodules. Here is a summary of the changes per commit:

  • Split krate.rs
    • Moved WithCount under models::helpers.
    • Moved follow into its own model.
    • Added an ok_true() function under controllers::helpers that returns a json result of {ok: true}. There are several additional places under user and version where this can be used as they are moved over.
  • Split badge.rs - straightforward
  • Extract rights.rs into a model used by User
    • Moved the Rights enum to its own file under models.
    • Moved rights from a free-standing function to a method on User.
  • Split owner.rs
    • This splits the functionality into two models: Owner and Team.
    • Team::github_url() was moved to github::team_url to be alongside other Github related code.
  • Split crate_owner_invitations - straightforward, and removes some duplicate InvitationResponse structs from the tests.

@jtgeibel
Copy link
Member Author

This is failing due to whitespace issues introduced by me using a newer rustfmt locally. I've opened #1256 and will rebase once that is merged. Tests are otherwise green.

There is still more work to do to extract model logic from some of the
controller endpoints, however I'm focusing on getting things moved
around in bulk first, and then focus on extracting logic when practical.
@jtgeibel jtgeibel force-pushed the more-mvc-refactoring branch from faa91e0 to f69ccb8 Compare February 20, 2018 03:01
@carols10cents
Copy link
Member

\o/

bors: r+

bors-voyager bot added a commit that referenced this pull request Feb 22, 2018
1255: More MVC Refactoring r=carols10cents

This PR splits several existing source files into the MVC submodules.  Here is a summary of the changes per commit:

* Split `krate.rs`
  * Moved `WithCount` under `models::helpers`.
  * Moved `follow` into its own model.
  * Added an `ok_true()` function under `controllers::helpers` that returns a json result of `{ok: true}`.  There are several additional places under `user` and `version` where this can be used as they are moved over.
* Split `badge.rs` - straightforward
* Extract `rights.rs` into a model used by `User`
  * Moved the `Rights` enum to its own file under models.
  * Moved `rights` from a free-standing function to a method on `User`.
* Split `owner.rs`
  * This splits the functionality into two models: `Owner` and `Team`.
  * `Team::github_url()` was moved to `github::team_url` to be alongside other Github related code.
* Split `crate_owner_invitations` - straightforward, and removes some duplicate `InvitationResponse` structs from the tests.
@bors-voyager
Copy link
Contributor

bors-voyager bot commented Feb 22, 2018

Build succeeded

@bors-voyager bors-voyager bot merged commit f69ccb8 into rust-lang:master Feb 22, 2018
@jtgeibel jtgeibel deleted the more-mvc-refactoring branch September 19, 2018 03:16
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