Fix data returned in setFriendlyDescription graphql mutation
closes OUT-4891 flag=none Test plan: - Create outcome with description and non-empty friendly description. - Open dev tools and go to the networks tab - Edit the friendly description so it is now empty. - Find the graphql event near the bottom where the operation names equals "SetOutcomeFriendlyDescription". - Verify the description field in both the payload column and response column are both "". Change-Id: Ifdd1ada8d4131e9d09bbb08abafd9d15140d1692 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/325772 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Angela Gomba <angela.gomba@instructure.com> QA-Review: Angela Gomba <angela.gomba@instructure.com> Product-Review: Kyle Rosenbaum <krosenbaum@instructure.com>
This commit is contained in:
parent
54560c284d
commit
184b5421d2
|
@ -57,17 +57,15 @@ class Mutations::SetFriendlyDescription < Mutations::BaseMutation
|
||||||
friendly_description.workflow_state = "active"
|
friendly_description.workflow_state = "active"
|
||||||
friendly_description.description = description
|
friendly_description.description = description
|
||||||
friendly_description.save!
|
friendly_description.save!
|
||||||
return {
|
|
||||||
outcome_friendly_description: friendly_description
|
else
|
||||||
}
|
friendly_description.destroy if friendly_description.persisted?
|
||||||
elsif friendly_description.persisted?
|
friendly_description.description = ""
|
||||||
friendly_description.destroy
|
|
||||||
return {
|
|
||||||
outcome_friendly_description: friendly_description
|
|
||||||
}
|
|
||||||
end
|
end
|
||||||
|
|
||||||
{}
|
{
|
||||||
|
outcome_friendly_description: friendly_description
|
||||||
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
|
@ -128,6 +128,7 @@ describe Mutations::SetFriendlyDescription do
|
||||||
result = exec({ description: "" })
|
result = exec({ description: "" })
|
||||||
expect(res_field(result, "_id")).to eql(friendly_description.id.to_s)
|
expect(res_field(result, "_id")).to eql(friendly_description.id.to_s)
|
||||||
expect(res_field(result, "workflowState")).to eql("deleted")
|
expect(res_field(result, "workflowState")).to eql("deleted")
|
||||||
|
expect(res_field(result, "description")).to eql("")
|
||||||
friendly_description.reload
|
friendly_description.reload
|
||||||
expect(friendly_description.workflow_state).to eql("deleted")
|
expect(friendly_description.workflow_state).to eql("deleted")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue