ishapi 0.1.8.194 → 0.1.8.196

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. checksums.yaml +4 -4
  2. data/Rakefile +0 -3
  3. data/app/controllers/ishapi/application_controller.rb +12 -14
  4. data/app/controllers/ishapi/galleries_controller.rb +0 -4
  5. data/app/controllers/ishapi/maps_controller.rb +2 -6
  6. data/app/controllers/ishapi/payments_controller.rb +8 -8
  7. data/app/controllers/ishapi/users/registrations_controller.rb +1 -1
  8. data/app/controllers/ishapi/users/sessions_controller.rb +3 -3
  9. data/app/controllers/ishapi/users_controller.rb +32 -34
  10. data/app/controllers/ishapi/videos_controller.rb +0 -9
  11. data/app/helpers/ishapi/application_helper.rb +1 -1
  12. data/app/models/ishapi/ability.rb +8 -25
  13. data/app/views/ishapi/application/_meta.jbuilder +0 -10
  14. data/app/views/ishapi/galleries/_show.jbuilder +1 -1
  15. data/app/views/ishapi/galleries/index.jbuilder +1 -4
  16. data/app/views/ishapi/maps/_show.jbuilder +1 -5
  17. data/app/views/ishapi/maps/show.jbuilder +1 -1
  18. data/app/views/ishapi/markers/_index.jbuilder +2 -2
  19. data/app/views/ishapi/newsitems/_index.jbuilder +4 -4
  20. data/app/views/ishapi/reports/_index.jbuilder +0 -2
  21. data/app/views/ishapi/reports/show.jbuilder +0 -3
  22. data/app/views/ishapi/user_profiles/_account.jbuilder +21 -0
  23. data/app/views/ishapi/{users → user_profiles}/_index.jbuilder +0 -0
  24. data/app/views/ishapi/user_profiles/account.jbuilder +2 -0
  25. data/app/views/ishapi/user_profiles/login.jbuilder +5 -0
  26. data/app/views/ishapi/user_profiles/show.jbuilder +0 -4
  27. data/app/views/ishapi/{users/show.jbuilder → user_profiles/show.jbuilder-bk} +1 -4
  28. data/app/views/ishapi/videos/_show.jbuilder +2 -10
  29. data/config/routes.rb +6 -22
  30. data/lib/ishapi/engine.rb +1 -1
  31. metadata +7 -36
  32. data/app/controllers/ishapi/application_controller.rb-trash +0 -275
  33. data/app/controllers/ishapi/articles_controller.rb +0 -62
  34. data/app/controllers/ishapi/cities_controller.rb +0 -35
  35. data/app/controllers/ishapi/events_controller.rb +0 -21
  36. data/app/controllers/ishapi/measurements_controller.rb +0 -26
  37. data/app/controllers/ishapi/sites_controller.rb +0 -55
  38. data/app/controllers/ishapi/tags_controller.rb +0 -24
  39. data/app/controllers/ishapi/venues_controller.rb +0 -20
  40. data/app/models/tmp_user.rb +0 -49
  41. data/app/views/ishapi/articles/_form.html.erb +0 -27
  42. data/app/views/ishapi/articles/edit.html.erb +0 -6
  43. data/app/views/ishapi/articles/index.html.erb +0 -29
  44. data/app/views/ishapi/articles/new.html.erb +0 -5
  45. data/app/views/ishapi/articles/show.html.erb +0 -14
  46. data/app/views/ishapi/cities/_index.jbuilder +0 -16
  47. data/app/views/ishapi/cities/features.jbuilder +0 -9
  48. data/app/views/ishapi/cities/index.jbuilder +0 -9
  49. data/app/views/ishapi/cities/show.jbuilder +0 -30
  50. data/app/views/ishapi/events/_index.jbuilder +0 -13
  51. data/app/views/ishapi/events/show.jbuilder +0 -11
  52. data/app/views/ishapi/features/_index.jbuilder +0 -41
  53. data/app/views/ishapi/sites/show.jbuilder +0 -31
  54. data/app/views/ishapi/tags/_index.jbuilder +0 -14
  55. data/app/views/ishapi/tags/_widget.jbuilder +0 -11
  56. data/app/views/ishapi/tags/index.jbuilder +0 -10
  57. data/app/views/ishapi/tags/show.jbuilder +0 -14
  58. data/app/views/ishapi/users/_account.jbuilder +0 -21
  59. data/app/views/ishapi/users/account.jbuilder +0 -2
  60. data/app/views/ishapi/users/login.jbuilder +0 -5
  61. data/app/views/ishapi/venues/_index.jbuilder +0 -21
  62. data/app/views/ishapi/venues/index.jbuilder +0 -2
  63. data/app/views/ishapi/venues/show.jbuilder +0 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 59e8e484d3741e6599d8d8397cfad5dd499635f956c92ed0ed9265172ea30e73
4
- data.tar.gz: 5a1c6b3c8a307cf402167ced6ae4280d943f26c2791848e7cf084a7cee336c24
3
+ metadata.gz: 4cac74ad18c61255a3db45b0192d67c09f2ca7b498f7979d47983709f7a0036d
4
+ data.tar.gz: a04ddbdf71da020e89a4baf912f5796600ae37a215828cf01fc4538d5b689ff2
5
5
  SHA512:
6
- metadata.gz: b7dba64e22efac66fc5167e3d9dfbca15572adfdf0d867f0abe74ab464fbae30020eae2038b59e52b48f2826f66dedd08bc0680c7a6e42eddfc80cd6729eee92
7
- data.tar.gz: 7eaaccd91a551e98134431730f4cdee21f85bc580d9d7953054a9bb7abc2b9351418de9a32e3ed9bcce5eeca901c2882419f7b5f83957ff479eddf0758584365
6
+ metadata.gz: b8deb4efaf0d7c0fcfebda5a5484048f2bbf75350bf8865f8139eac9ebb42373a9f19f1dd79e5bea1220cdf04c4a4dcc494cb920a533f32da59864548518e1e3
7
+ data.tar.gz: b6bf703266e85ac946b3af85c3467cf61f6b33e6ea00025b55f6825d1fc9372a29bf8b5ed19a225dc6137e965c8d9e6a8e27427519d259ba333c9ea30e19fc3a
data/Rakefile CHANGED
@@ -17,11 +17,8 @@ end
17
17
  APP_RAKEFILE = File.expand_path("../test/dummy/Rakefile", __FILE__)
18
18
  load 'rails/tasks/engine.rake'
19
19
 
20
-
21
20
  load 'rails/tasks/statistics.rake'
22
21
 
23
-
24
-
25
22
  require 'bundler/gem_tasks'
26
23
 
27
24
  require 'rake/testtask'
@@ -19,7 +19,7 @@ class Ishapi::ApplicationController < ActionController::Base
19
19
  @long_term_token = j['access_token']
20
20
  @graph = Koala::Facebook::API.new( accessToken )
21
21
  @me = @graph.get_object( 'me', :fields => 'email' )
22
- @current_user = TmpUser.where( :email => @me['email'] ).first
22
+ @current_user = User.where( :email => @me['email'] ).first
23
23
 
24
24
  # send the jwt to client
25
25
  @jwt_token = encode(user_id: @current_user.id.to_s)
@@ -28,7 +28,7 @@ class Ishapi::ApplicationController < ActionController::Base
28
28
  email: @current_user.email,
29
29
  jwt_token: @jwt_token,
30
30
  long_term_token: @long_term_token,
31
- n_unlocks: @current_user.profile.n_unlocks,
31
+ n_unlocks: @current_profile.n_unlocks,
32
32
  }
33
33
  end
34
34
 
@@ -56,26 +56,24 @@ class Ishapi::ApplicationController < ActionController::Base
56
56
 
57
57
  private
58
58
 
59
- ## This returns an empty user if not logged in!
59
+ ## This returns an empty profile if not logged in!
60
60
  def check_profile
61
61
  begin
62
62
  decoded = decode(params[:jwt_token])
63
- @current_user = User.find decoded['user_id']
63
+ @current_profile = Ish::UserProfile.find decoded['user_profile_id']
64
64
  rescue JWT::ExpiredSignature, JWT::DecodeError => e
65
- # flash[:notice] = 'You are not logged in, or you have been logged out.'
66
- # puts! 'You are not logged in, or you have been logged out.'
67
- @current_user = TmpUser.new({ profile: Ish::UserProfile.new })
65
+ flash[:notice] = 'You are not logged in, or you have been logged out.'
66
+ @current_profile = Ish::UserProfile.new
68
67
  end
69
68
  end
70
69
 
71
- ## This errors out if not logged in!
72
- def check_profile_hard
70
+ ## If not logged in, errors out
71
+ def check_profile!
73
72
  begin
74
73
  decoded = decode(params[:jwt_token])
75
- @current_user = TmpUser.find decoded['user_id']
74
+ @current_profile = Ish::UserProfile.find decoded['user_profile_id']
76
75
  rescue JWT::ExpiredSignature, JWT::DecodeError => e
77
- # flash[:notice] = 'You are not logged in, or you have been logged out.'
78
- # puts! 'You are not logged in, or you have been logged out.'
76
+ flash[:notice] = 'You are not logged in, or you have been logged out.'
79
77
  end
80
78
  end
81
79
 
@@ -83,7 +81,7 @@ class Ishapi::ApplicationController < ActionController::Base
83
81
  def check_jwt
84
82
  begin
85
83
  decoded = decode(params[:jwt_token])
86
- @current_user = TmpUser.find decoded['user_id']
84
+ @current_profile = Ish::UserProfile.find decoded['user_profile_id']
87
85
  rescue JWT::ExpiredSignature
88
86
  Rails.logger.info("JWT::ExpiredSignature")
89
87
  rescue JWT::DecodeError
@@ -105,7 +103,7 @@ class Ishapi::ApplicationController < ActionController::Base
105
103
  end
106
104
 
107
105
  def current_ability
108
- @current_ability ||= Ishapi::Ability.new( @current_user )
106
+ @current_ability ||= Ishapi::Ability.new( @current_profile )
109
107
  end
110
108
 
111
109
  end
@@ -9,10 +9,6 @@ module Ishapi
9
9
  def index
10
10
  @galleries = Gallery.all
11
11
  authorize! :index, Gallery
12
- if params[:cityname]
13
- city = City.find_by :cityname => params[:cityname]
14
- @galleries = @galleries.where( :city => city )
15
- end
16
12
  if params[:domain]
17
13
  @site = Site.find_by( :domain => params[:domain], :lang => 'en' )
18
14
  @galleries = @galleries.where( :site => @site )
@@ -14,7 +14,7 @@ class Ishapi::MapsController < Ishapi::ApplicationController
14
14
  @newsitems = @location.newsitems.page( params[:newsitems_page]
15
15
  ).per( @location.newsitems_page_size )
16
16
 
17
- @markers = @map.markers.permitted_to(@current_user.profile).order_by(ordering: :asc)
17
+ @markers = @map.markers.permitted_to(@current_profile).order_by(ordering: :asc)
18
18
  # case @map.ordering_type
19
19
  # when ::Gameui::Map::ORDERING_TYPE_ALPHABETIC
20
20
  # @markers = @markers.order_by( name: :asc )
@@ -22,15 +22,11 @@ class Ishapi::MapsController < Ishapi::ApplicationController
22
22
  # @markers = @markers.order_by( ordering: :asc )
23
23
  # end
24
24
 
25
- @tags = @map.tags
26
-
27
- if @map.is_premium && !@current_user.profile.has_premium_purchase( @map )
25
+ if @map.is_premium && !@current_profile.has_premium_purchase( @map )
28
26
  render 'show_restricted'
29
27
  else
30
28
  render 'show'
31
29
  end
32
-
33
-
34
30
  end
35
31
 
36
32
  def show_marker
@@ -51,7 +51,7 @@ module Ishapi
51
51
  ##
52
52
  def create2
53
53
  authorize! :create, ::Ish::Payment
54
- current_user.profile.update_attributes({ is_purchasing: true })
54
+ @current_profile.update_attributes({ is_purchasing: true })
55
55
 
56
56
  begin
57
57
  amount_cents = params[:amount_cents].to_i # @TODO: change
@@ -65,9 +65,9 @@ module Ishapi
65
65
 
66
66
  payment = Ish::Payment.create!(
67
67
  client_secret: intent.client_secret,
68
- email: current_user.email,
68
+ email: @current_profile.email,
69
69
  payment_intent_id: intent.id,
70
- profile_id: current_user.profile.id,
70
+ profile_id: @current_profile.id,
71
71
  )
72
72
 
73
73
  render json: { client_secret: intent.client_secret }
@@ -110,18 +110,18 @@ module Ishapi
110
110
  authorize! :unlock, ::Ish::Payment
111
111
  item = Object::const_get(params['kind']).find params['id']
112
112
 
113
- existing = Purchase.where( user_profile: @current_user.profile, item: item ).first
113
+ existing = Purchase.where( user_profile: @current_profile, item: item ).first
114
114
  if existing
115
115
  render status: 200, json: { status: :ok, message: 'already purchased' }
116
116
  return
117
117
  end
118
118
 
119
- @current_user.profile.inc( n_unlocks: -item.premium_tier )
119
+ @current_profile.inc( n_unlocks: -item.premium_tier )
120
120
 
121
- purchase = ::Gameui::PremiumPurchase.create!( item: item, user_profile: @current_user.profile, )
121
+ purchase = ::Gameui::PremiumPurchase.create!( item: item, user_profile: @current_profile, )
122
122
 
123
- @profile = @current_user.profile
124
- render 'ishapi/users/account'
123
+ @profile = @current_profile
124
+ render 'ishapi/user_profiles/account'
125
125
  end
126
126
 
127
127
  end
@@ -5,7 +5,7 @@ class Ishapi::Users::RegistrationsController < Devise::RegistrationsController
5
5
  def create
6
6
  build_resource(sign_up_params)
7
7
  resource.save
8
- resource.profile = Ish::UserProfile.create({ user: resource, email: resource.email })
8
+ user_profile = Ish::UserProfile.create({ email: resource.email })
9
9
  yield resource if block_given?
10
10
  if resource.persisted?
11
11
  render json: {
@@ -11,9 +11,9 @@ class Ishapi::Users::SessionsController < Devise::SessionsController
11
11
 
12
12
  ## Send the jwt to client
13
13
  @current_user = resource
14
- @jwt_token = encode(user_id: @current_user.id.to_s)
15
- @profile = @current_user.profile
16
- render 'ishapi/users/login', format: :json, layout: false
14
+ @current_profile = Ish::UserProfile.find_by({ email: @current_user.email })
15
+ @jwt_token = encode(user_profile_id: @current_profile.id.to_s)
16
+ render 'ishapi/user_profiles/login', format: :json, layout: false
17
17
  end
18
18
 
19
19
  private
@@ -1,45 +1,43 @@
1
- # require_dependency "ishapi/application_controller"
2
1
 
3
- module Ishapi
4
- class UsersController < Ishapi::ApplicationController
2
+ ##
3
+ ## Cannot move this class right now - it gets hit verifying user's account, every time.
4
+ ## @TODO: merge with user_profiles_controller. _vp_ 2022-10-13
5
+ ##
6
+ class ::Ishapi::UsersController < Ishapi::ApplicationController
5
7
 
6
- skip_authorization_check only: %i| create fb_sign_in login |
8
+ skip_authorization_check only: %i| create fb_sign_in login |
7
9
 
10
+ before_action :check_profile!, only: %i| account |
8
11
 
9
- before_action :check_profile_hard, only: %i| account |
12
+ def account
13
+ authorize! :show, @current_profile
14
+ render 'ishapi/user_profiles/account'
15
+ rescue CanCan::AccessDenied
16
+ render json: {
17
+ status: :not_ok,
18
+ }, status: 401
19
+ end
10
20
 
11
- def account
12
- @profile = @current_user&.profile
13
- authorize! :show, @profile
14
- render 'ishapi/users/account'
15
- rescue CanCan::AccessDenied
16
- render json: {
17
- status: :not_ok,
18
- }, status: 401
19
- end
21
+ def create
22
+ authorize! :open_permission, Ishapi
23
+ new_user_params = params[:user].permit!
20
24
 
21
- def create
22
- authorize! :open_permission, Ishapi
23
- new_user_params = params[:user].permit!
24
-
25
- @profile = Profile.new( email: new_user_params[:email] )
26
- @user = User.new( email: new_user_params[:email], password: new_user_params[:password], profile: @profile )
27
-
28
- if @profile.save && @user.save
29
- @jwt_token = encode(user_id: @user.id.to_s)
30
- render 'login'
31
- else
32
- render json: {
33
- messages: @user.errors.messages.merge( @profile.errors.messages ),
34
- }, status: 400
35
- end
36
- end
25
+ @profile = Profile.new( email: new_user_params[:email] )
26
+ @user = User.new( email: new_user_params[:email], password: new_user_params[:password], profile: @profile )
37
27
 
38
- def fb_sign_in
39
- authorize! :fb_sign_in, Ishapi
40
- # render :json => { :status => :ok }
41
- render :action => 'show'
28
+ if @profile.save && @user.save
29
+ @jwt_token = encode(user_id: @user.id.to_s)
30
+ render 'ishapi/user_profiles/login'
31
+ else
32
+ render json: {
33
+ messages: @user.errors.messages.merge( @profile.errors.messages ),
34
+ }, status: 400
42
35
  end
36
+ end
43
37
 
38
+ def fb_sign_in
39
+ authorize! :fb_sign_in, Ishapi
40
+ render 'ishapi/user_profiles/show'
44
41
  end
42
+
45
43
  end
@@ -10,15 +10,6 @@ module Ishapi
10
10
  def index
11
11
  authorize! :index, Video
12
12
  @videos = Video.all
13
- if params[:cityname]
14
- city = City.find_by :cityname => params[:cityname]
15
- @videos = @videos.where( :city_id => city.id )
16
- end
17
- if params[:domain]
18
- site = Site.find_by :domain => params[:domain], :lang => :en
19
- @videos = @videos.where( :site_id => site.id )
20
- end
21
-
22
13
  @videos = @videos.page( params[:videos_page] ).per( 10 )
23
14
  end
24
15
 
@@ -2,7 +2,7 @@ module Ishapi
2
2
  module ApplicationHelper
3
3
 
4
4
  def image_missing
5
- 'https://s3.amazonaws.com/ish-wp/wp-content/uploads/2022/02/25232018/100x100_crossout.png'
5
+ 'https://d15g8hc4183yn4.cloudfront.net/wp-content/uploads/2022/02/25232018/100x100_crossout.png'
6
6
  end
7
7
 
8
8
  end
@@ -2,30 +2,26 @@
2
2
  class Ishapi::Ability
3
3
  include ::CanCan::Ability
4
4
 
5
- def initialize user
5
+ def initialize user_profile
6
6
  #
7
- # signed in user
7
+ # signed in user_profile
8
8
  #
9
- if !user.blank?
10
-
11
- # if user.profile && user.profile.sudoer?
12
- # can :manage, :all
13
- # end
9
+ if !user_profile.blank?
14
10
 
15
11
  can [ :my_index ], Gallery
16
12
  can [ :show ], Gallery do |gallery|
17
- gallery.user_profile == user.profile || # my own
13
+ gallery.user_profile == user_profile || # my own
18
14
  (!gallery.is_trash && gallery.is_public ) || # public
19
- (!gallery.is_trash && gallery.shared_profiles.include?( user.profile ) ) # shared with me
15
+ (!gallery.is_trash && gallery.shared_profiles.include?( user_profile ) ) # shared with me
20
16
  end
21
17
 
22
18
  can [ :do_purchase ], ::Gameui
23
19
  can [ :show ], ::Gameui::Map do |map|
24
- map.creator_profile == user.profile
20
+ map.creator_profile == user_profile
25
21
  end
26
22
 
27
23
  can [ :destroy ], Newsitem do |n|
28
- n.map.creator_profile.id == user.profile.id
24
+ n.map.creator_profile.id == user_profile.id
29
25
  end
30
26
 
31
27
  can [ :create, :unlock ], ::Ish::Payment
@@ -43,10 +39,6 @@ class Ishapi::Ability
43
39
  p.user.id.to_s == user.id.to_s
44
40
  end
45
41
 
46
- can [ :index, :show ], City
47
-
48
- can [ :index, :show ], Event
49
-
50
42
  #
51
43
  # G
52
44
  #
@@ -65,7 +57,7 @@ class Ishapi::Ability
65
57
  #
66
58
  can [ :index ], ::Gameui::Map
67
59
  can [ :show ], ::Gameui::Map do |map|
68
- map.is_public || map.shared_profiles.include?( user.profile )
60
+ map.is_public || map.shared_profiles.include?( user_profile )
69
61
  end
70
62
  can [ :show ], ::Gameui::Marker do |m|
71
63
  m.is_public
@@ -87,23 +79,14 @@ class Ishapi::Ability
87
79
  #
88
80
  # S
89
81
  #
90
- can [ :index, :show ], Site
91
82
 
92
83
  #
93
84
  # T
94
85
  #
95
- can [ :index ], Tag
96
- can [ :show ], Tag do |tag|
97
- tag.is_public
98
- end
99
86
 
100
87
  #
101
88
  # V
102
89
  #
103
- can [ :index ], Venue
104
- can [ :show ], Venue do |venue|
105
- venue.is_public
106
- end
107
90
  can [ :index, :my_index ], Video
108
91
  can [ :show ], Video do |video|
109
92
  video.is_public
@@ -3,18 +3,8 @@
3
3
  # ishapi / application / _meta
4
4
  #
5
5
 
6
- if !item.tags.blank?
7
- json.partial! 'ishapi/tags/index', tags: item.tags
8
- end
9
6
  json.created_at item.created_at
10
7
  json.updated_at item.updated_at
11
8
  json.username item.user_profile.name if item.user_profile
12
- if item.city
13
- json.city do
14
- json.name item.city.name
15
- json.slug item.city.cityname
16
- end
17
- json.cityname item.city.cityname
18
- end
19
9
  json.subhead item.subhead
20
10
  json.description item.descr
@@ -17,7 +17,7 @@ json.partial! 'ishapi/application/meta', :item => gallery
17
17
  if gallery.is_premium
18
18
  json.premium_tier gallery.premium_tier
19
19
  json.is_premium gallery.premium_tier > 0
20
- json.is_purchased current_user&.profile&.has_premium_purchase( gallery )
20
+ json.is_purchased @current_profile&.has_premium_purchase( gallery )
21
21
  json.partial! 'ishapi/photos/index', :photos => [ gallery.photos[0] ]
22
22
  else
23
23
  json.partial! 'ishapi/photos/index', :photos => gallery.photos
@@ -6,13 +6,10 @@
6
6
  json.array! @galleries do |gallery|
7
7
  json.id gallery.id.to_s
8
8
  json.name gallery.name
9
- json.slug gallery.slug
9
+ json.slug gallery.slug
10
10
  json.slug gallery.slug
11
11
  json.subhead gallery.subhead
12
12
  json.username gallery.user_profile.name
13
- json.cityname gallery.city.name if gallery.city
14
- json.tag_names gallery.tags.map &:slug
15
- json.venuename gallery.venue.name if gallery.venue
16
13
  json.partial! 'ishapi/photos/index', :photos => gallery.photos
17
14
  end
18
15
 
@@ -22,7 +22,7 @@ json.cache! this_key do
22
22
 
23
23
  json.premium_tier map.premium_tier
24
24
  json.is_premium map.is_premium
25
- json.is_purchased current_user&.profile&.has_premium_purchase( map )
25
+ json.is_purchased @current_profile&.has_premium_purchase( map )
26
26
 
27
27
  json.breadcrumbs do
28
28
  json.array! map.breadcrumbs do |b|
@@ -40,10 +40,6 @@ json.cache! this_key do
40
40
  json.partial! 'ishapi/newsitems/index', newsitems: newsitems
41
41
  end
42
42
 
43
- if tags
44
- json.partial! 'ishapi/tags/index', tags: tags
45
- end
46
-
47
43
  if map.map
48
44
  json.partial! 'ishapi/maps/show', map: map.map
49
45
  end
@@ -2,5 +2,5 @@
2
2
  # ishapi / maps / show
3
3
  #
4
4
 
5
- json.partial! 'ishapi/maps/show', map: @map, markers: @markers, newsitems: @newsitems, tags: @tags
5
+ json.partial! 'ishapi/maps/show', map: @map, markers: @markers, newsitems: @newsitems
6
6
 
@@ -25,8 +25,8 @@ json.markers do
25
25
  json.is_premium destination.is_premium
26
26
  json.id destination.id.to_s
27
27
  if destination.is_premium
28
- if current_user && current_user.profile
29
- json.is_purchased current_user.profile.has_premium_purchase( destination )
28
+ if @current_profile
29
+ json.is_purchased @current_profile.has_premium_purchase( destination )
30
30
  end
31
31
  end
32
32
  end
@@ -16,8 +16,8 @@ json.newsitems do
16
16
  json.description item.description
17
17
 
18
18
  json.votes_score item.votes_score
19
- if @current_user&.profile
20
- json.current_user_vote_value item.vote_value(@current_user.profile.id)
19
+ if @current_profile
20
+ json.current_user_vote_value item.vote_value(@current_profile.id)
21
21
  end
22
22
 
23
23
 
@@ -34,7 +34,7 @@ json.newsitems do
34
34
  if item.gallery.is_premium
35
35
  json.premium_tier item.gallery.premium_tier
36
36
  json.is_premium item.gallery.premium_tier > 0
37
- json.is_purchased current_user&.profile&.has_premium_purchase( item.gallery )
37
+ json.is_purchased @current_profile&.has_premium_purchase( item.gallery )
38
38
  json.partial! 'ishapi/photos/index', :photos => [ item.gallery.photos[0] ]
39
39
  else
40
40
  json.partial! 'ishapi/photos/index', :photos => item.gallery.photos[0...3]
@@ -63,7 +63,7 @@ json.newsitems do
63
63
  if item.report.is_premium
64
64
  json.premium_tier item.report.premium_tier
65
65
  json.is_premium item.report.premium_tier > 0
66
- json.is_purchased current_user&.profile&.has_premium_purchase( item.report )
66
+ json.is_purchased @current_profile&.has_premium_purchase( item.report )
67
67
  end
68
68
  end
69
69
  end
@@ -20,7 +20,5 @@ json.reports do
20
20
  end
21
21
  end
22
22
 
23
- json.partial! 'ishapi/tags/index', tags: report.tags unless report.tags.blank?
24
-
25
23
  end
26
24
  end
@@ -21,7 +21,6 @@ json.cache! key do
21
21
  json.created_at @report.created_at
22
22
  json.updated_at @report.updated_at
23
23
  json.username @report.user_profile.name if @report.user_profile
24
- json.cityname @report.city.cityname if @report.city
25
24
  json.subhead @report.subhead
26
25
 
27
26
  case @report.item_type
@@ -38,8 +37,6 @@ json.cache! key do
38
37
  json.large_url @report.photo.photo.url :large
39
38
  end
40
39
  end
41
-
42
- json.partial! 'ishapi/tags/index', :tags => @report.tags
43
40
  end
44
41
 
45
42
  # @deprecated, but specs use this _vp_ 20180423
@@ -0,0 +1,21 @@
1
+
2
+ json.id profile.id.to_s
3
+ json.name profile.name
4
+ json.email profile.email
5
+ json.profile_photo_url profile.profile_photo.photo.url( :thumb ) if profile.profile_photo
6
+
7
+ json.n_reports profile.reports.count
8
+ json.n_galleries profile.galleries.count
9
+ json.n_videos profile.videos.count
10
+ # json.n_stars profile.n_stars # @TODO: which one is deprecated?
11
+ json.n_unlocks profile.n_unlocks # @TODO: which one is deprecated?
12
+ json.is_purchasing profile.is_purchasing
13
+ if profile.current_city
14
+ json.current_city profile.current_city
15
+ end
16
+
17
+ json.bookmarks profile.bookmarks do |b|
18
+ json.name b.name
19
+ json.slug b.slug
20
+ end
21
+
@@ -0,0 +1,2 @@
1
+
2
+ json.partial! 'ishapi/user_profiles/account', profile: @current_profile
@@ -0,0 +1,5 @@
1
+
2
+ json.email @current_profile.email
3
+ json.n_unlocks @current_profile.n_unlocks
4
+ json.jwt_token @jwt_token
5
+ json.partial! 'ishapi/user_profiles/account', profile: @current_profile
@@ -7,7 +7,3 @@ json.n_galleries @profile.galleries.count
7
7
  json.n_videos @profile.videos.count
8
8
  json.n_stars @profile.n_stars
9
9
 
10
- if @profile.current_city
11
- json.current_city @profile.current_city
12
- end
13
-
@@ -1,7 +1,4 @@
1
1
 
2
- #
3
- # ishapi / users / show.jbuilder
4
- #
5
2
 
6
3
  json.email @current_profile.email
7
4
  json.about @current_profile.about
@@ -23,5 +20,5 @@ if @current_profile.measurement
23
20
  json.partial! 'ishapi/measurements/show', :measurement => @current_profile.measurement
24
21
  end
25
22
 
26
- json.partial! 'ishapi/orders/show', :order => @current_order
23
+ # json.partial! 'ishapi/orders/show', :order => @current_order
27
24
 
@@ -13,14 +13,6 @@ json.x video.x
13
13
  json.y video.y
14
14
  json.url video.video.url
15
15
 
16
- if video.city
17
- json.cityname video.city.cityname
18
- json.city do
19
- json.name video.city.name
20
- json.slug video.city.cityname
21
- end
22
- end
23
-
24
16
  json.tags [ { slug: 'adventure', name: 'Adventure' },
25
17
  { slug: 'bars-and-clubs', name: 'Bars & Clubs' },
26
18
  { slug: 'food', name: 'Food' },
@@ -34,8 +26,8 @@ end
34
26
  if video.is_premium
35
27
  json.premium_tier video.premium_tier
36
28
  json.is_premium video.premium_tier > 0
37
- if current_user && current_user.profile
38
- json.is_purchased current_user.profile.has_premium_purchase( video )
29
+ if @current_profile
30
+ json.is_purchased @current_profile.has_premium_purchase( video )
39
31
  end
40
32
  end
41
33