ishapi 0.1.8.176 → 0.1.8.180
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.
- checksums.yaml +4 -4
- data/app/controllers/ishapi/maps_controller.rb +4 -1
- data/app/controllers/ishapi/newsitems_controller.rb +16 -2
- data/app/controllers/ishapi/user_profiles_controller.rb +16 -2
- data/app/models/ishapi/ability.rb +11 -2
- data/app/views/ishapi/maps/show.jbuilder +4 -0
- data/app/views/ishapi/newsitems/_index.jbuilder +1 -1
- data/app/views/ishapi/tags/_index.jbuilder +1 -0
- data/config/routes.rb +5 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc1fab799950f80dc60e96c14da20e2b819597bb6ba08a7202faa265f8da9b1c
|
4
|
+
data.tar.gz: 60a76c0bcc2df49cf116fcec8d9889710290c8811c0c8922ffbaff5b85063a6f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2d9949936dca45d8377c8331083f2fa6badc2dcc73e424f2130957f60b688368b06bebaf533198d2c08020ec4d5b865b844488c12e3c49fff6922a589f554673
|
7
|
+
data.tar.gz: '024685ff64b145e92763772af8fd3da14bd994dd329f6808799b484808949753c3216f0267db1607231eefb50430068154615213bdbfbb98b0bbbb54ff449460'
|
@@ -5,7 +5,8 @@ class Ishapi::MapsController < Ishapi::ApplicationController
|
|
5
5
|
before_action :check_profile, only: [ :show ]
|
6
6
|
|
7
7
|
def show
|
8
|
-
@location
|
8
|
+
@location = ::Gameui::Map.where( slug: params[:slug] ).first
|
9
|
+
@location ||= ::Gameui::Map.find params[:slug]
|
9
10
|
@map = @location.map || @location
|
10
11
|
|
11
12
|
authorize! :show, @map
|
@@ -13,6 +14,8 @@ class Ishapi::MapsController < Ishapi::ApplicationController
|
|
13
14
|
|
14
15
|
@markers = @map.markers.permitted_to(current_user.profile)
|
15
16
|
|
17
|
+
@tags = @map.tags
|
18
|
+
|
16
19
|
# case @map.ordering_type
|
17
20
|
# when ::Gameui::Map::ORDERING_TYPE_ALPHABETIC
|
18
21
|
# @markers = @markers.order_by( name: :asc )
|
@@ -3,8 +3,22 @@ require_dependency "ishapi/application_controller"
|
|
3
3
|
module Ishapi
|
4
4
|
class NewsitemsController < ApplicationController
|
5
5
|
|
6
|
-
before_action :check_profile
|
7
|
-
|
6
|
+
before_action :check_profile
|
7
|
+
|
8
|
+
def destroy
|
9
|
+
n = Newsitem.find params[:id]
|
10
|
+
|
11
|
+
puts! n.map.creator_profile.id, 'ze id'
|
12
|
+
puts! current_user.profile.id, 'ze2 id'
|
13
|
+
|
14
|
+
authorize! :destroy, n
|
15
|
+
flag = n.destroy
|
16
|
+
if flag
|
17
|
+
render json: { status: 'ok' }, status: :ok
|
18
|
+
else
|
19
|
+
render json: { message: "No luck: #{n.errors.full_messages.join(", ")}." }, status: 400
|
20
|
+
end
|
21
|
+
end
|
8
22
|
|
9
23
|
def index
|
10
24
|
if params[:domain]
|
@@ -2,12 +2,26 @@ require_dependency "ishapi/application_controller"
|
|
2
2
|
module Ishapi
|
3
3
|
class UserProfilesController < ApplicationController
|
4
4
|
|
5
|
-
before_action :check_profile
|
5
|
+
before_action :check_profile, only: %i| show | ## @TODO: hmmm I may not need this check at all
|
6
|
+
|
7
|
+
before_action :check_profile_hard, only: %i| update |
|
6
8
|
|
7
9
|
def show
|
8
|
-
@profile =
|
10
|
+
@profile = Ish::UserProfile.find_by :username => params[:username]
|
9
11
|
authorize! :show, @profile
|
10
12
|
end
|
11
13
|
|
14
|
+
def update
|
15
|
+
@profile = Ish::UserProfile.find @current_user.profile
|
16
|
+
authorize! :update, @profile
|
17
|
+
|
18
|
+
flag = @profile.update params[:profile].permit!
|
19
|
+
if flag
|
20
|
+
render json: { message: 'ok' }, status: :ok
|
21
|
+
else
|
22
|
+
render json: { message: "No luck: #{@profile.errors.full_messages.join(", ")}." }, code: 400
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
12
26
|
end
|
13
27
|
end
|
@@ -6,7 +6,7 @@ class Ishapi::Ability
|
|
6
6
|
#
|
7
7
|
# signed in user
|
8
8
|
#
|
9
|
-
|
9
|
+
if !user.blank?
|
10
10
|
|
11
11
|
# if user.profile && user.profile.sudoer?
|
12
12
|
# can :manage, :all
|
@@ -14,7 +14,9 @@ class Ishapi::Ability
|
|
14
14
|
|
15
15
|
can [ :my_index ], Gallery
|
16
16
|
can [ :show ], Gallery do |gallery|
|
17
|
-
gallery.user_profile == user.profile
|
17
|
+
gallery.user_profile == user.profile || # my own
|
18
|
+
(!gallery.is_trash && gallery.is_public ) || # public
|
19
|
+
(!gallery.is_trash && gallery.shared_profiles.include?( user.profile ) ) # shared with me
|
18
20
|
end
|
19
21
|
|
20
22
|
can [ :do_purchase ], ::Gameui
|
@@ -22,6 +24,10 @@ class Ishapi::Ability
|
|
22
24
|
map.creator_profile == user.profile
|
23
25
|
end
|
24
26
|
|
27
|
+
can [ :destroy ], Newsitem do |n|
|
28
|
+
n.map.creator_profile.id == user.profile.id
|
29
|
+
end
|
30
|
+
|
25
31
|
can [ :create, :unlock ], ::Ish::Payment
|
26
32
|
|
27
33
|
can [ :buy_stars ], ::Ish::UserProfile
|
@@ -33,6 +39,9 @@ class Ishapi::Ability
|
|
33
39
|
user ||= User.new
|
34
40
|
|
35
41
|
can [ :show ], Ish::UserProfile
|
42
|
+
can [ :update ], Ish::UserProfile do |p|
|
43
|
+
p.user.id.to_s == user.id.to_s
|
44
|
+
end
|
36
45
|
|
37
46
|
can [ :index, :show ], City
|
38
47
|
|
data/config/routes.rb
CHANGED
@@ -29,6 +29,9 @@ Ishapi::Engine.routes.draw do
|
|
29
29
|
post 'videos', to: 'videos#index'
|
30
30
|
end
|
31
31
|
|
32
|
+
# N
|
33
|
+
delete 'newsitems/:id', to: 'newsitems#destroy'
|
34
|
+
|
32
35
|
post 'do_purchase', to: 'gameui#do_purchase' # @TODO: rename to just purchase, or destroy endpoint
|
33
36
|
post 'payments', :to => 'payments#create'
|
34
37
|
post 'payments2', :to => 'payments#create2' # @TODO: change
|
@@ -58,8 +61,8 @@ Ishapi::Engine.routes.draw do
|
|
58
61
|
|
59
62
|
post 'users/fb_sign_in', to: 'users#fb_sign_in'
|
60
63
|
get 'users/me', to: 'users#account'
|
61
|
-
post 'users/profile', to: 'users#show'
|
62
|
-
post 'users/profile/update', to: '
|
64
|
+
post 'users/profile', to: 'users#show' ## @TODO: change, this makes no sense
|
65
|
+
post 'users/profile/update', to: 'user_profiles#update'
|
63
66
|
get 'users/profile', to: 'users#show' # @TODO: only for testing! accessToken must be hidden
|
64
67
|
match 'users/long_term_token', to: 'application#long_term_token', via: [ :get, :post ]
|
65
68
|
post 'users/login', to: 'users#login'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ishapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.8.
|
4
|
+
version: 0.1.8.180
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- piousbox
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-08-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|