Skip to content

Commit 97ef30f

Browse files
committed
fix API responses (geom -> geojson)
1 parent 272bbd0 commit 97ef30f

File tree

3 files changed

+9
-12
lines changed

3 files changed

+9
-12
lines changed

app/views/issues/show.api.rsb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,10 @@ api.issue do
2323
api.total_spent_hours(@issue.total_spent_hours)
2424
end
2525

26-
unless @issue.geom.nil?
27-
api.geom RGeo::GeoJSON.encode RGeo::GeoJSON::EntityFactory.instance.feature(
28-
RGeo::WKRep::WKBParser.new().parse(@issue.geom), @issue.id)
26+
if @issue.geom
27+
api.geojson @issue.geojson(simple: true)
2928
else
30-
api.geom ""
29+
api.geojson ""
3130
end
3231

3332
render_api_custom_values @issue.visible_custom_field_values, api

app/views/projects/show.api.rsb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,10 @@ api.project do
88
api.status @project.status
99
api.is_public @project.is_public?
1010

11-
unless @project.geom.nil?
12-
api.geom RGeo::GeoJSON.encode RGeo::GeoJSON::EntityFactory.instance.feature(
13-
RGeo::WKRep::WKBParser.new().parse(@project.geom), @project.id)
11+
if @project.geom
12+
api.geojson @project.geojson(simple: true)
1413
else
15-
api.geom ""
14+
api.geojson ""
1615
end
1716

1817
render_api_custom_values @project.visible_custom_field_values, api

app/views/users/show.api.rsb

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,10 @@ api.user do
99
api.api_key @user.api_key if User.current.admin? || (User.current == @user)
1010
api.status @user.status if User.current.admin?
1111

12-
unless @user.geom.nil?
13-
api.geom RGeo::GeoJSON.encode RGeo::GeoJSON::EntityFactory.instance.feature(
14-
RGeo::WKRep::WKBParser.new().parse(@user.geom), @user.id)
12+
if @user.geom
13+
api.geojson @user.geojson(simple: true)
1514
else
16-
api.geom ""
15+
api.geojson ""
1716
end
1817

1918
render_api_custom_values @user.visible_custom_field_values, api

0 commit comments

Comments
 (0)