Skip to content

Commit

Permalink
Deprecate JSTree api routes
Browse files Browse the repository at this point in the history
We are not using JSTree anymore (solidusio#569) but we still have these
routes available for stores that used it outside JSTree scopes.

We decided to deprecate these routes long time ago but we never did it.
See also #194.

Once we've deprecated this enough we can probably just resurrect solidusio#664.
  • Loading branch information
kennyadsl committed Oct 4, 2017
1 parent 926ea68 commit 57484ee
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 0 deletions.
1 change: 1 addition & 0 deletions api/app/controllers/spree/api/taxonomies_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def show

# Because JSTree wants parameters in a *slightly* different format
def jstree
Spree::Deprecation.warn("Please don't use `/api/taxonomies/:taxonomy_id/jstree` endpoint. It is deprecated and will be removed in the next future.", caller)
show
end

Expand Down
1 change: 1 addition & 0 deletions api/app/controllers/spree/api/taxons_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ def show
end

def jstree
Spree::Deprecation.warn("Please don't use `/api/taxonomies/:taxonomy_id/taxons/:taxon_id/jstree` endpoint. It is deprecated and will be removed in the next future.", caller)
show
end

Expand Down
1 change: 1 addition & 0 deletions api/spec/requests/spree/api/taxonomies_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ module Spree
end

it "gets the jstree-friendly version of a taxonomy" do
expect(Spree::Deprecation).to(receive(:warn))
get spree.jstree_api_taxonomy_path(taxonomy.id)
expect(json_response["data"]).to eq(taxonomy.root.name)
expect(json_response["attr"]).to eq({ "id" => taxonomy.root.id, "name" => taxonomy.root.name })
Expand Down
1 change: 1 addition & 0 deletions api/spec/requests/spree/api/taxons_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ module Spree
end

it "gets all taxons in JSTree form" do
expect(Spree::Deprecation).to(receive(:warn))
get spree.jstree_api_taxonomy_taxon_path(taxonomy, taxon.id)
response = json_response.first
expect(response["data"]).to eq(taxon2.name)
Expand Down

0 comments on commit 57484ee

Please sign in to comment.