Skip to content

Conversation

@rullzer
Copy link
Member

@rullzer rullzer commented Aug 10, 2016

Since 99% of the time when we return a DataResponse in an OCSController
we actually just want to set the data field to that we introduce the
OCS\DataResponse which is handled in the OCSController to do just that.

Nothing to fancy just cleaner.

CC: @LukasReschke @MorrisJobke @BernhardPosselt @schiessle

@rullzer rullzer added the 3. to review Waiting for reviews label Aug 10, 2016
@rullzer rullzer added this to the Nextcloud 11.0 milestone Aug 10, 2016
@schiessle
Copy link
Member

I like it 👍

if ($data instanceof \OCP\AppFramework\OCS\DataResponse) {
$data = ['data' => $data->getData()];
} else if ($data instanceof DataResponse) {
$data = $data->getData();
Copy link
Member

Choose a reason for hiding this comment

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

Is there any reason now to keep the normal DataResponse? If not: Why not just move the logic from L96 to L98?

Copy link
Member Author

Choose a reason for hiding this comment

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

Well before people could use the normal DataResponse. And I don't all of sudden want to break code that dit a: return DataResponse(['data' => $result]). The same like they can still return a normal array etc.

The OCS Controller requires a DataResponse object to be returned.
This means that all error handling will have to be done via exceptions
thrown and handling in the middleware.
@rullzer rullzer changed the title Introducing OCS DataResponse OCSController requires DataResponse Aug 10, 2016
@rullzer
Copy link
Member Author

rullzer commented Aug 10, 2016

OK PR changed after discussing with @schiessle and @LukasReschke

The OCS Controller now requires users to return a DataResponse.

@rullzer
Copy link
Member Author

rullzer commented Aug 10, 2016

First commit had to go into stable10 as well

@schiessle
Copy link
Member

looks good 👍

@LukasReschke
Copy link
Member

👍

@LukasReschke LukasReschke added 4. to release Ready to be released and/or waiting for tests to finish and removed 3. to review Waiting for reviews labels Aug 10, 2016
@schiessle
Copy link
Member

@rullzer any idea what happens with the tests here?

@rullzer
Copy link
Member Author

rullzer commented Aug 10, 2016

Yes I think I know ;)

@rullzer
Copy link
Member Author

rullzer commented Aug 10, 2016

Forgot to update one mroe OCSController ;)
Fixed now. Tests should pass

@rullzer rullzer merged commit ba922c9 into master Aug 10, 2016
@rullzer rullzer deleted the ocs_dataresponse branch August 10, 2016 20:36
@schiessle
Copy link
Member

@rullzer do we need to backport this last commit as well?

@MorrisJobke
Copy link
Member

@rullzer do we need to backport this last commit as well?

Comment from IRC: "no"

GitHubUser4234 pushed a commit to GitHubUser4234/server that referenced this pull request Aug 30, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

4. to release Ready to be released and/or waiting for tests to finish

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants