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

[10.2.0] Treat send attempt as unsuccessful when there is a message. #35221

Merged
merged 1 commit into from
May 16, 2019

Conversation

VicDeo
Copy link
Member

@VicDeo VicDeo commented May 14, 2019

Backport of #35220

Description

result.ocs.meta.status is 200 when the email was not sent.

Related Issue

Motivation and Context

Frontend says that email is successfully sent even when it has been not sent.

How Has This Been Tested?

See #35218

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Database schema changes (next release will require increase of minor version instead of patch)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Technical debt
  • Tests only (no source changes)

Checklist:

  • Code changes
  • Unit tests added
  • Acceptance tests added
  • Documentation ticket raised:

@VicDeo VicDeo self-assigned this May 14, 2019
@VicDeo VicDeo added p2-high Escalation, on top of current planning, release blocker 3 - To Review labels May 14, 2019
@VicDeo VicDeo added this to the development milestone May 14, 2019
@codecov
Copy link

codecov bot commented May 14, 2019

Codecov Report

Merging #35221 into release-10.2.0 will decrease coverage by <.01%.
The diff coverage is 12.5%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##             release-10.2.0   #35221      +/-   ##
====================================================
- Coverage             64.39%   64.39%   -0.01%     
  Complexity            20049    20049              
====================================================
  Files                  1285     1285              
  Lines                 76842    76844       +2     
  Branches               1308     1308              
====================================================
  Hits                  49480    49480              
- Misses                26978    26980       +2     
  Partials                384      384
Flag Coverage Δ Complexity Δ
#javascript 53.66% <100%> (ø) 0 <0> (ø) ⬇️
#phpunit 65.53% <0%> (-0.01%) 20049 <0> (ø)
Impacted Files Coverage Δ Complexity Δ
...es_sharing/lib/Controller/Share20OcsController.php 87.25% <0%> (-0.32%) 202 <0> (ø)
core/js/sharedialogshareelistview.js 80.48% <100%> (ø) 0 <0> (ø) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 24e0e79...b54f30c. Read the comment docs.

@VicDeo VicDeo changed the title [10.2.0] Treat send attempt unsuccessful when there is a message. [10.2.0] Treat send attempt as unsuccessful when there is a message. May 14, 2019
@micbar
Copy link
Contributor

micbar commented May 14, 2019

@VicDeo Please do not merge until the decisions about the release are made.

@owncloud owncloud deleted a comment from codecov bot May 14, 2019
@paurakhsharma
Copy link
Member

I have tested this and it works fine on the frontend.
But network response tab have two status
{"ocs":{"meta":{"status":"ok","statuscode":200,"message":"Couldn't send mail to following recipient(s): merouser3 ","totalitems":"","itemsperpage":""},"data":{"status":"error"}}}
status "ok" and status "error".

Is this the expected behavior?

@patrickjahns patrickjahns modified the milestones: development, QA May 15, 2019
@patrickjahns
Copy link
Contributor

@paurakhsharma
What was the behavior with 10.1 ? can you please double check

@paurakhsharma
Copy link
Member

@paurakhsharma
What was the behavior with 10.1 ? can you please double check

I double checked and this is the network response in 10.1 {"data":{"message":"Couldn't send mail to following recipient(s): arkouser "},"status":"error"}

@PVince81
Copy link
Contributor

@VicDeo would be good to also update the frontend unit tests. I believe we have some for the email part.

@PVince81
Copy link
Contributor

backend unit tests as well... but here I believe this is not coverable...

please always add statements and reasons if you decide to skip unit tests

@PVince81
Copy link
Contributor

@paurakhsharma
What was the behavior with 10.1 ? can you please double check

I double checked and this is the network response in 10.1 {"data":{"message":"Couldn't send mail to following recipient(s): arkouser "},"status":"error"}

@VicDeo so this changes the response format ? I thought this PR was an attempt to bring it back to what it was before

@VicDeo
Copy link
Member Author

VicDeo commented May 15, 2019

@PVince81 to bring it back I need to kill the controller and send the response from core/ajax/share.php.
Frontend tests are adjusted already.

not coverable as I can't mock Share::setSendMailStatus properly

@VicDeo
Copy link
Member Author

VicDeo commented May 15, 2019

10.1 sends a response with \OCP\JSON::success or \OCP\JSON::error from core/ajax/share.php

#33180 changes it send a response from OCA\Files_Sharing\Controller\Share20OcsController class via OCS

that's why the responses differ - one is pure AJAX and other is OCS

@PVince81
Copy link
Contributor

@VicDeo would you qualify this as API change ? or would the new format be solidified as a public API if it's OCS ?

@PVince81
Copy link
Contributor

the old API as far as I remember was not OCS so considered private

@PVince81
Copy link
Contributor

@michaelstingl I also assume no client was using this private API in ajax/share.php

@michaelstingl
Copy link

@michaelstingl I also assume no client was using this private API in ajax/share.php

Is this the mail for public links? Never made it to the clients because of the missing proper API.

@VicDeo
Copy link
Member Author

VicDeo commented May 15, 2019

@PVince81 it didn't look like a public API at all as it needed logged in user and a valid CSRF token:
https://github.com/owncloud/core/blob/master/core/ajax/share.php#L40-L41

@VicDeo
Copy link
Member Author

VicDeo commented May 15, 2019

{
  "ocs":
  {
      "meta": 
      {
           "status":"ok",
           "statuscode":200,
           "message":"Couldn't send mail to following recipient(s): merouser3 ",
           "totalitems":"",
           "itemsperpage":""
      },
     "data":
     {
       "status":"error"
     }
   }
} 

meta.status is HTTP-alike OCS status. ok here is just a text test representation of a statuscode 200
while data.status is exactly the same with the prev implementation. Prev implementation used deprecated \OCP\JSON public API to deal with frontend - it's success and error methods respectively

Copy link
Contributor

@PVince81 PVince81 left a comment

Choose a reason for hiding this comment

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

👍

@PVince81 PVince81 merged commit 4180eda into release-10.2.0 May 16, 2019
@delete-merged-branch delete-merged-branch bot deleted the release-10.2.0-fix-35218 branch May 16, 2019 06:03
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
3 - To Review p2-high Escalation, on top of current planning, release blocker
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants