ishapi 0.1.8.316 → 3.0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/MIT-LICENSE +1 -1
- data/README.md +21 -12
- data/Rakefile +4 -22
- data/app/assets/config/ishapi_manifest.js +0 -1
- data/app/assets/stylesheets/ishapi/{application.scss → application.css} +2 -32
- data/app/controllers/ishapi/application_controller.rb +2 -139
- data/app/helpers/ishapi/application_helper.rb +0 -5
- data/app/mailers/ishapi/application_mailer.rb +4 -11
- data/app/models/ishapi/application_record.rb +5 -0
- data/app/views/layouts/ishapi/application.html.erb +15 -0
- data/config/routes.rb +0 -101
- data/lib/ishapi/engine.rb +0 -6
- data/lib/ishapi/version.rb +1 -1
- data/lib/ishapi.rb +2 -4
- metadata +13 -272
- data/app/assets/javascripts/ishapi/application.js +0 -14
- data/app/assets/stylesheets/ishapi/galleries.scss +0 -46
- data/app/assets/stylesheets/ishapi/locations.scss +0 -8
- data/app/assets/stylesheets/scaffold.css +0 -80
- data/app/controllers/ishapi/email_contexts_controller.rb +0 -28
- data/app/controllers/ishapi/email_conversations_controller.rb +0 -45
- data/app/controllers/ishapi/email_messages_controller.rb +0 -54
- data/app/controllers/ishapi/email_unsubscribes_controller.rb +0 -35
- data/app/controllers/ishapi/galleries_controller.rb +0 -56
- data/app/controllers/ishapi/gameui_controller.rb +0 -64
- data/app/controllers/ishapi/invoices_controller.rb +0 -22
- data/app/controllers/ishapi/lead_actions_controller.rb +0 -23
- data/app/controllers/ishapi/leads_controller.rb +0 -18
- data/app/controllers/ishapi/leadsets_controller.rb +0 -30
- data/app/controllers/ishapi/locations_controller.rb +0 -54
- data/app/controllers/ishapi/maps_controller.rb +0 -45
- data/app/controllers/ishapi/my/galleries_controller.rb +0 -11
- data/app/controllers/ishapi/my/reports_controller.rb +0 -11
- data/app/controllers/ishapi/my/videos_controller.rb +0 -10
- data/app/controllers/ishapi/newsitems_controller.rb +0 -35
- data/app/controllers/ishapi/obfuscated_redirects_controller.rb +0 -27
- data/app/controllers/ishapi/option_price_items_controller.rb +0 -44
- data/app/controllers/ishapi/order_items_controller.rb +0 -53
- data/app/controllers/ishapi/orders_controller.rb +0 -32
- data/app/controllers/ishapi/payments_controller.rb +0 -108
- data/app/controllers/ishapi/photos_controller.rb +0 -13
- data/app/controllers/ishapi/products_controller.rb +0 -16
- data/app/controllers/ishapi/stock_watches_controller.rb +0 -13
- data/app/controllers/ishapi/user_profiles_controller.rb +0 -27
- data/app/controllers/ishapi/users/registrations_controller.rb +0 -37
- data/app/controllers/ishapi/users/sessions_controller.rb +0 -36
- data/app/controllers/ishapi/users_controller.rb +0 -43
- data/app/controllers/ishapi/videos_controller.rb +0 -17
- data/app/jobs/ishapi/email_message_intake_job.rb +0 -178
- data/app/jobs/ishapi/email_message_intake_job.rb-todo +0 -6
- data/app/mailers/ishapi/confirmations_mailer.rb +0 -14
- data/app/models/ishapi/ability.rb +0 -130
- data/app/views/ishapi/addresses/_show.jbuilder +0 -12
- data/app/views/ishapi/application/_meta.jbuilder +0 -10
- data/app/views/ishapi/application/_metaline.haml +0 -12
- data/app/views/ishapi/application/_pagination.jbuilder +0 -11
- data/app/views/ishapi/application_mailer/forwarder_notify.html.erb +0 -16
- data/app/views/ishapi/email_contexts/summary.csv.erb +0 -4
- data/app/views/ishapi/email_messages/show.haml +0 -10
- data/app/views/ishapi/email_unsubscribes/create.haml +0 -5
- data/app/views/ishapi/galleries/_index.jbuilder +0 -11
- data/app/views/ishapi/galleries/_show.jbuilder +0 -24
- data/app/views/ishapi/galleries/index.jbuilder +0 -15
- data/app/views/ishapi/galleries/show.html.haml +0 -20
- data/app/views/ishapi/galleries/show.json.jbuilder +0 -12
- data/app/views/ishapi/galleries/show_premium_locked.jbuilder +0 -21
- data/app/views/ishapi/galleries/show_premium_unlocked.jbuilder +0 -17
- data/app/views/ishapi/locations/show.haml +0 -14
- data/app/views/ishapi/mailer/confirmation_instructions.html.erb +0 -6
- data/app/views/ishapi/mailer/email_changed.html.erb +0 -7
- data/app/views/ishapi/mailer/password_change.html.erb +0 -3
- data/app/views/ishapi/mailer/reset_password_instructions.html.erb +0 -8
- data/app/views/ishapi/mailer/unlock_instructions.html.erb +0 -7
- data/app/views/ishapi/maps/_show.jbuilder +0 -63
- data/app/views/ishapi/maps/_show_lite.jbuilder-trash +0 -16
- data/app/views/ishapi/maps/index.jbuilder +0 -12
- data/app/views/ishapi/maps/show.jbuilder +0 -6
- data/app/views/ishapi/maps/show_restricted.jbuilder +0 -44
- data/app/views/ishapi/markers/_card.haml +0 -28
- data/app/views/ishapi/markers/_index.jbuilder +0 -38
- data/app/views/ishapi/my/videos/index.jbuilder +0 -9
- data/app/views/ishapi/newsitems/_index.haml +0 -22
- data/app/views/ishapi/newsitems/_index.jbuilder +0 -86
- data/app/views/ishapi/newsitems/_show.haml +0 -10
- data/app/views/ishapi/newsitems/_show.haml-trash +0 -5
- data/app/views/ishapi/newsitems/index.jbuilder +0 -5
- data/app/views/ishapi/obfuscated_redirects/show.haml +0 -4
- data/app/views/ishapi/option_price_items/index.jbuilder +0 -17
- data/app/views/ishapi/option_price_items/view.jbuilder +0 -19
- data/app/views/ishapi/orders/_item.jbuilder +0 -8
- data/app/views/ishapi/orders/_show.jbuilder +0 -11
- data/app/views/ishapi/photos/_index.jbuilder +0 -19
- data/app/views/ishapi/photos/_show.jbuilder +0 -12
- data/app/views/ishapi/photos/show.jbuilder +0 -6
- data/app/views/ishapi/products/show.jbuilder +0 -16
- data/app/views/ishapi/reports/_index.jbuilder +0 -24
- data/app/views/ishapi/reports/index.jbuilder +0 -6
- data/app/views/ishapi/reports/show.haml +0 -15
- data/app/views/ishapi/reports/show.jbuilder +0 -51
- data/app/views/ishapi/stock_watches/index.jbuilder +0 -11
- data/app/views/ishapi/user_profiles/_account.jbuilder +0 -18
- data/app/views/ishapi/user_profiles/_index.jbuilder +0 -9
- data/app/views/ishapi/user_profiles/account.jbuilder +0 -2
- data/app/views/ishapi/user_profiles/login.jbuilder +0 -5
- data/app/views/ishapi/user_profiles/show.jbuilder +0 -9
- data/app/views/ishapi/user_profiles/show.jbuilder-bk +0 -24
- data/app/views/ishapi/videos/_index.jbuilder +0 -11
- data/app/views/ishapi/videos/_show.haml +0 -22
- data/app/views/ishapi/videos/_show.jbuilder +0 -37
- data/app/views/ishapi/videos/index.jbuilder +0 -3
- data/app/views/layouts/ishapi/application.html.haml +0 -38
@@ -1,37 +0,0 @@
|
|
1
|
-
|
2
|
-
class Ishapi::Users::RegistrationsController < Devise::RegistrationsController
|
3
|
-
skip_before_action :verify_authenticity_token
|
4
|
-
|
5
|
-
def create
|
6
|
-
build_resource(sign_up_params)
|
7
|
-
resource.save
|
8
|
-
user_profile = Ish::UserProfile.create({ email: resource.email })
|
9
|
-
yield resource if block_given?
|
10
|
-
if resource.persisted?
|
11
|
-
render json: {
|
12
|
-
status: :ok,
|
13
|
-
message: "You have successfully registered! Please verify your email by clicking on a link we just sent you, before logging in.",
|
14
|
-
}, status: 200
|
15
|
-
|
16
|
-
# if resource.active_for_authentication?
|
17
|
-
# set_flash_message! :notice, :signed_up
|
18
|
-
# sign_up(resource_name, resource)
|
19
|
-
# respond_with resource, location: after_sign_up_path_for(resource)
|
20
|
-
# else
|
21
|
-
# set_flash_message! :notice, :"signed_up_but_#{resource.inactive_message}"
|
22
|
-
# expire_data_after_sign_in!
|
23
|
-
# respond_with resource, location: after_inactive_sign_up_path_for(resource)
|
24
|
-
# end
|
25
|
-
else
|
26
|
-
render json: {
|
27
|
-
status: :not_ok,
|
28
|
-
message: "Cannot register: #{resource.errors.full_messages.join(', ')}",
|
29
|
-
}, status: 400
|
30
|
-
|
31
|
-
# clean_up_passwords resource
|
32
|
-
# set_minimum_password_length
|
33
|
-
# respond_with resource
|
34
|
-
end
|
35
|
-
end
|
36
|
-
|
37
|
-
end
|
@@ -1,36 +0,0 @@
|
|
1
|
-
|
2
|
-
class Ishapi::Users::SessionsController < Devise::SessionsController
|
3
|
-
skip_before_action :verify_authenticity_token
|
4
|
-
|
5
|
-
def create
|
6
|
-
self.resource = warden.authenticate!(auth_options)
|
7
|
-
set_flash_message!(:notice, :signed_in)
|
8
|
-
sign_in(resource_name, resource)
|
9
|
-
yield resource if block_given?
|
10
|
-
|
11
|
-
|
12
|
-
## Send the jwt to client
|
13
|
-
@current_user = resource
|
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
|
-
end
|
18
|
-
|
19
|
-
private
|
20
|
-
|
21
|
-
## copy-pasted from application_controller
|
22
|
-
## jwt
|
23
|
-
def decode(token)
|
24
|
-
decoded = JWT.decode(token, Rails.application.secrets.secret_key_base.to_s)[0]
|
25
|
-
HashWithIndifferentAccess.new decoded
|
26
|
-
end
|
27
|
-
|
28
|
-
## copy-pasted from application_controller
|
29
|
-
## jwt
|
30
|
-
def encode(payload, exp = 48.hours.from_now) # @TODO: definitely change, right now I expire once in 2 days.
|
31
|
-
payload[:exp] = exp.to_i
|
32
|
-
JWT.encode(payload, Rails.application.secrets.secret_key_base.to_s)
|
33
|
-
end
|
34
|
-
|
35
|
-
|
36
|
-
end
|
@@ -1,43 +0,0 @@
|
|
1
|
-
|
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
|
7
|
-
|
8
|
-
skip_authorization_check only: %i| create fb_sign_in login |
|
9
|
-
|
10
|
-
before_action :check_profile!, only: %i| account |
|
11
|
-
|
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
|
20
|
-
|
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 'ishapi/user_profiles/login'
|
31
|
-
else
|
32
|
-
render json: {
|
33
|
-
messages: @user.errors.messages.merge( @profile.errors.messages ),
|
34
|
-
}, status: 400
|
35
|
-
end
|
36
|
-
end
|
37
|
-
|
38
|
-
def fb_sign_in
|
39
|
-
authorize! :fb_sign_in, Ishapi
|
40
|
-
render 'ishapi/user_profiles/show'
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
@@ -1,17 +0,0 @@
|
|
1
|
-
require_dependency "ishapi/application_controller"
|
2
|
-
module Ishapi
|
3
|
-
class VideosController < ApplicationController
|
4
|
-
|
5
|
-
def show
|
6
|
-
@video = Video.unscoped.find_by :slug => params[:slug]
|
7
|
-
authorize! :show, @video
|
8
|
-
end
|
9
|
-
|
10
|
-
def index
|
11
|
-
authorize! :index, Video
|
12
|
-
@videos = Video.all.published
|
13
|
-
@videos = @videos.page( params[:videos_page] ).per( 10 )
|
14
|
-
end
|
15
|
-
|
16
|
-
end
|
17
|
-
end
|
@@ -1,178 +0,0 @@
|
|
1
|
-
|
2
|
-
##
|
3
|
-
## 2023-02-26 _vp_ Let's go
|
4
|
-
## 2023-03-07 _vp_ Continue
|
5
|
-
##
|
6
|
-
## class name: EIJ
|
7
|
-
##
|
8
|
-
class Ishapi::EmailMessageIntakeJob < Ishapi::ApplicationJob
|
9
|
-
|
10
|
-
queue_as :default
|
11
|
-
|
12
|
-
=begin
|
13
|
-
|
14
|
-
## Mongo::Error::MaxBSONSize: The document exceeds maximum allowed BSON object size after serialization (on 10.138.2.145)
|
15
|
-
object_key = 'k9n9qo03fii2in3ocj977nac0vj5djn07e110bg1'
|
16
|
-
|
17
|
-
object_key = 'hlbg24s1ov5k7irgmqsrjp0kl95vpik8t1esvs81'
|
18
|
-
MsgStub.where({ object_key: object_key }).delete
|
19
|
-
|
20
|
-
stub = MsgStub.create!({ object_key: object_key })
|
21
|
-
id = stub.id
|
22
|
-
|
23
|
-
Ishapi::EmailMessageIntakeJob.perform_now( stub.id.to_s )
|
24
|
-
|
25
|
-
=end
|
26
|
-
def perform id
|
27
|
-
stub = ::Office::EmailMessageStub.find id
|
28
|
-
if !Rails.env.test?
|
29
|
-
puts "Performing EmailMessageIntakeJob for object_key #{stub.object_key}"
|
30
|
-
end
|
31
|
-
if stub.state != ::Office::EmailMessageStub::STATE_PENDING
|
32
|
-
raise "This stub has already been processed: #{stub.id.to_s}."
|
33
|
-
return
|
34
|
-
end
|
35
|
-
|
36
|
-
client = Aws::S3::Client.new({
|
37
|
-
region: ::S3_CREDENTIALS[:region_ses],
|
38
|
-
access_key_id: ::S3_CREDENTIALS[:access_key_id_ses],
|
39
|
-
secret_access_key: ::S3_CREDENTIALS[:secret_access_key_ses],
|
40
|
-
})
|
41
|
-
|
42
|
-
raw = client.get_object( bucket: ::S3_CREDENTIALS[:bucket_ses], key: stub.object_key ).body.read
|
43
|
-
the_mail = Mail.new( raw )
|
44
|
-
message_id = the_mail.header['message-id']&.decoded
|
45
|
-
message_id ||= "#{the_mail.date.iso8601}::#{the_mail.from}"
|
46
|
-
in_reply_to_id = the_mail.header['in-reply-to']&.to_s
|
47
|
-
email_inbox_tag_id = WpTag.emailtag(WpTag::INBOX).id
|
48
|
-
the_mail.to = [ 'NO-RECIPIENT' ] if !the_mail.to
|
49
|
-
subject = ::Msg.strip_emoji( the_mail.subject || '(wco-no-subject)' )
|
50
|
-
|
51
|
-
|
52
|
-
## Conversation
|
53
|
-
if in_reply_to_id
|
54
|
-
in_reply_to_msg = ::Office::EmailMessage.where({ message_id: in_reply_to_id }).first
|
55
|
-
if !in_reply_to_msg
|
56
|
-
conv = ::Office::EmailConversation.find_or_create_by({
|
57
|
-
subject: subject,
|
58
|
-
})
|
59
|
-
in_reply_to_msg = ::Office::EmailMessage.find_or_create_by({
|
60
|
-
message_id: in_reply_to_id,
|
61
|
-
email_conversation_id: conv.id,
|
62
|
-
})
|
63
|
-
end
|
64
|
-
conv = in_reply_to_msg.email_conversation
|
65
|
-
else
|
66
|
-
conv = ::Office::EmailConversation.find_or_create_by({
|
67
|
-
subject: subject,
|
68
|
-
})
|
69
|
-
end
|
70
|
-
|
71
|
-
@message = ::Office::EmailMessage.where( message_id: message_id ).first
|
72
|
-
@message ||= ::Office::EmailMessage.create({
|
73
|
-
# raw: raw,
|
74
|
-
email_conversation_id: conv.id,
|
75
|
-
|
76
|
-
message_id: message_id,
|
77
|
-
in_reply_to_id: in_reply_to_id,
|
78
|
-
|
79
|
-
object_key: stub.object_key,
|
80
|
-
|
81
|
-
subject: subject,
|
82
|
-
date: the_mail.date,
|
83
|
-
|
84
|
-
from: the_mail.from ? the_mail.from[0] : "nobody@unknown-doma.in",
|
85
|
-
froms: the_mail.from,
|
86
|
-
|
87
|
-
to: the_mail.to ? the_mail.to[0] : nil,
|
88
|
-
tos: the_mail.to,
|
89
|
-
|
90
|
-
cc: the_mail.cc ? the_mail.cc[0] : nil,
|
91
|
-
ccs: the_mail.cc,
|
92
|
-
})
|
93
|
-
if !@message.persisted?
|
94
|
-
throw "Could not create email_message: #{@message.errors.full_messages.join(', ')} ."
|
95
|
-
end
|
96
|
-
|
97
|
-
## Parts
|
98
|
-
the_mail.parts.each do |part|
|
99
|
-
@message.churn_subpart( part )
|
100
|
-
end
|
101
|
-
@message.save
|
102
|
-
|
103
|
-
if the_mail.parts.length == 0
|
104
|
-
body = the_mail.body.decoded.encode('UTF-8', invalid: :replace, undef: :replace, replace: '?')
|
105
|
-
if the_mail.content_type&.include?('text/html')
|
106
|
-
@message.part_html = body
|
107
|
-
elsif the_mail.content_type&.include?('text/plain')
|
108
|
-
@message.part_txt = body
|
109
|
-
elsif the_mail.content_type.blank?
|
110
|
-
@message.part_txt = body
|
111
|
-
else
|
112
|
-
@message.logs.push "mail body of unknown type: #{the_mail.content_type}"
|
113
|
-
end
|
114
|
-
@message.save
|
115
|
-
end
|
116
|
-
|
117
|
-
## Attachments
|
118
|
-
the_mail.attachments.each do |att|
|
119
|
-
@message.save_attachment( att )
|
120
|
-
end
|
121
|
-
|
122
|
-
if !@message.save
|
123
|
-
puts! @message.errors.full_messages.join(", "), "Could not save @message"
|
124
|
-
end
|
125
|
-
|
126
|
-
## Leadset, Lead
|
127
|
-
domain = @message.from.split('@')[1] rescue 'unknown.domain'
|
128
|
-
leadset = Leadset.find_or_create_by( company_url: domain )
|
129
|
-
lead = Lead.find_or_create_by( email: @message.from, m3_leadset_id: leadset.id )
|
130
|
-
the_mail.cc&.each do |cc|
|
131
|
-
domain = cc.split('@')[1] rescue 'unknown.domain'
|
132
|
-
leadset = Leadset.find_or_create_by( company_url: domain )
|
133
|
-
Lead.find_or_create_by( email: cc, m3_leadset_id: leadset.id )
|
134
|
-
end
|
135
|
-
|
136
|
-
# @message.update_attributes({ email_conversation_id: conv.id })
|
137
|
-
conv.update_attributes({
|
138
|
-
state: Conv::STATE_UNREAD,
|
139
|
-
latest_at: the_mail.date || Time.now.to_datetime,
|
140
|
-
from_emails: ( conv.from_emails + the_mail.from ).uniq,
|
141
|
-
preview: @message.body_sanitized[0...200],
|
142
|
-
})
|
143
|
-
conv.add_tag( ::WpTag::INBOX )
|
144
|
-
conv_lead_tie = Office::EmailConversationLead.find_or_create_by({
|
145
|
-
lead_id: lead.id,
|
146
|
-
email_conversation_id: conv.id,
|
147
|
-
})
|
148
|
-
|
149
|
-
|
150
|
-
## Actions & Filters
|
151
|
-
email_filters = Office::EmailFilter.active
|
152
|
-
email_filters.each do |filter|
|
153
|
-
if ( filter.from_regex.blank? || @message.from.match( filter.from_regex ) ) &&
|
154
|
-
( filter.from_exact.blank? || @message.from.downcase.include?( filter.from_exact&.downcase ) ) &&
|
155
|
-
( filter.body_exact.blank? || @message.part_html&.include?( filter.body_exact ) ) &&
|
156
|
-
( filter.subject_regex.blank? || @message.subject.match( filter.subject_regex ) ) &&
|
157
|
-
( filter.subject_exact.blank? || @message.subject.downcase.include?( filter.subject_exact&.downcase ) )
|
158
|
-
|
159
|
-
# || MiaTagger.analyze( @message.part_html, :is_spammy_recruite ).score > .5
|
160
|
-
|
161
|
-
# puts! "applying filter #{filter} to conv #{conv}" if DEBUG
|
162
|
-
|
163
|
-
@message.apply_filter( filter )
|
164
|
-
end
|
165
|
-
end
|
166
|
-
|
167
|
-
stub.update_attributes({ state: ::Office::EmailMessageStub::STATE_PROCESSED })
|
168
|
-
|
169
|
-
## Notification
|
170
|
-
conv = Conv.find( conv.id )
|
171
|
-
if conv.in_emailtag? WpTag::INBOX
|
172
|
-
out = ::Ishapi::ApplicationMailer.forwarder_notify( @message.id.to_s )
|
173
|
-
Rails.env.production? ? out.deliver_later : out.deliver_now
|
174
|
-
end
|
175
|
-
|
176
|
-
end
|
177
|
-
end
|
178
|
-
EIJ = Ishapi::EmailMessageIntakeJob
|
@@ -1,14 +0,0 @@
|
|
1
|
-
|
2
|
-
class Ishapi::ConfirmationsMailer < Devise::Mailer
|
3
|
-
# default from: '314658@gmail.com'
|
4
|
-
helper :application # gives access to all helpers defined within `application_helper`.
|
5
|
-
include Devise::Controllers::UrlHelpers # Optional. eg. `confirmation_url`
|
6
|
-
|
7
|
-
default template_path: 'ishapi/mailer' # to make sure that your mailer uses the devise views
|
8
|
-
|
9
|
-
def confirmation_instructions(record, token, opts={})
|
10
|
-
# headers["Custom-header"] = "Bar"
|
11
|
-
super
|
12
|
-
end
|
13
|
-
|
14
|
-
end
|
@@ -1,130 +0,0 @@
|
|
1
|
-
|
2
|
-
class Ishapi::Ability
|
3
|
-
include ::CanCan::Ability
|
4
|
-
|
5
|
-
def initialize user_profile
|
6
|
-
|
7
|
-
##
|
8
|
-
## super user
|
9
|
-
##
|
10
|
-
if %w| piousbox@gmail.com |.include?( user_profile&.email )
|
11
|
-
can [ :manage ], :all
|
12
|
-
end
|
13
|
-
|
14
|
-
#
|
15
|
-
# signed in user_profile
|
16
|
-
#
|
17
|
-
if user_profile.present?
|
18
|
-
|
19
|
-
can [ :my_index ], Gallery
|
20
|
-
can [ :show ], Gallery do |gallery|
|
21
|
-
( gallery.user_profile == user_profile ) || # my own
|
22
|
-
(!gallery.is_trash && gallery.is_public ) || # public
|
23
|
-
(!gallery.is_trash && gallery.shared_profiles.include?( user_profile ) ) # shared with me
|
24
|
-
end
|
25
|
-
|
26
|
-
can [ :do_purchase ], ::Gameui
|
27
|
-
can [ :show ], ::Gameui::Map do |map|
|
28
|
-
map.creator_profile == user_profile
|
29
|
-
end
|
30
|
-
|
31
|
-
can [ :destroy ], Newsitem do |n|
|
32
|
-
n.map.creator_profile.id.to_s == user_profile.id.to_s
|
33
|
-
end
|
34
|
-
|
35
|
-
can [ :create, :unlock ], ::Ish::Payment
|
36
|
-
|
37
|
-
can [ :buy_stars ], ::Ish::UserProfile
|
38
|
-
|
39
|
-
##
|
40
|
-
## superuser
|
41
|
-
##
|
42
|
-
if %w| victor@wasya.co victor@piousbox.com piousbox@gmail.com |.include?( user_profile.email )
|
43
|
-
|
44
|
-
can [ :manage ], ::Ishapi
|
45
|
-
can [ :manage ], ::Ish::EmailContext
|
46
|
-
|
47
|
-
can [ :show ], ::Office::EmailMessage
|
48
|
-
end
|
49
|
-
|
50
|
-
end
|
51
|
-
#
|
52
|
-
# anonymous user
|
53
|
-
#
|
54
|
-
user ||= User.new
|
55
|
-
|
56
|
-
can [ :show ], Ish::UserProfile
|
57
|
-
can [ :update ], Ish::UserProfile do |p|
|
58
|
-
p.user.id.to_s == user.id.to_s
|
59
|
-
end
|
60
|
-
|
61
|
-
|
62
|
-
##
|
63
|
-
## E
|
64
|
-
##
|
65
|
-
can [ :create ], Ish::EmailUnsubscribe
|
66
|
-
|
67
|
-
#
|
68
|
-
# G
|
69
|
-
#
|
70
|
-
# can [ :index ], Gallery
|
71
|
-
can [ :show ], Gallery do |gallery|
|
72
|
-
gallery.is_public && !gallery.is_trash
|
73
|
-
end
|
74
|
-
|
75
|
-
#
|
76
|
-
# I
|
77
|
-
#
|
78
|
-
can [ :fb_sign_in, :long_term_token, :open_permission, :welcome_home ], Ishapi
|
79
|
-
|
80
|
-
#
|
81
|
-
# M
|
82
|
-
#
|
83
|
-
can [ :index ], ::Gameui::Map
|
84
|
-
can [ :show ], ::Gameui::Map do |map|
|
85
|
-
map.is_public || map.shared_profiles.include?( user_profile )
|
86
|
-
end
|
87
|
-
can [ :show ], ::Gameui::Marker do |m|
|
88
|
-
m.is_public
|
89
|
-
end
|
90
|
-
|
91
|
-
#
|
92
|
-
# O
|
93
|
-
#
|
94
|
-
|
95
|
-
can [ :show ], ::Office::ObfuscatedRedirect
|
96
|
-
|
97
|
-
can [ :view_chain ], ::Iro::OptionPriceItem
|
98
|
-
|
99
|
-
|
100
|
-
#
|
101
|
-
# P
|
102
|
-
#
|
103
|
-
can [ :show ], Photo
|
104
|
-
|
105
|
-
#
|
106
|
-
# R
|
107
|
-
#
|
108
|
-
can [ :index ], Report
|
109
|
-
can [ :my_index, :show ], Report do |report|
|
110
|
-
report.is_public
|
111
|
-
end
|
112
|
-
|
113
|
-
#
|
114
|
-
# S
|
115
|
-
#
|
116
|
-
|
117
|
-
#
|
118
|
-
# T
|
119
|
-
#
|
120
|
-
|
121
|
-
#
|
122
|
-
# V
|
123
|
-
#
|
124
|
-
# can [ :index, :my_index ], Video
|
125
|
-
can [ :show ], Video do |video|
|
126
|
-
video.is_public
|
127
|
-
end
|
128
|
-
|
129
|
-
end
|
130
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
# ishapi / addresses / _show
|
3
|
-
|
4
|
-
json.address do
|
5
|
-
json.name address.name
|
6
|
-
json.phone address.phone
|
7
|
-
json.address_1 address.address_1
|
8
|
-
json.address_2 address.address_2
|
9
|
-
json.city address.city
|
10
|
-
json.state address.state
|
11
|
-
json.zipcode address.zipcode
|
12
|
-
end
|
@@ -1,12 +0,0 @@
|
|
1
|
-
|
2
|
-
.metaline
|
3
|
-
|
4
|
-
<b>On</b> #{item.created_at.to_s[0...10]}
|
5
|
-
- if item.user_profile
|
6
|
-
<b>By</b> #{item.user_profile.name}
|
7
|
-
|
8
|
-
-# - if item.tags.length > 0
|
9
|
-
-# <b>Tags:</b> #{ item.tags.map(&:name).join(', ') }
|
10
|
-
|
11
|
-
- if defined?(item.premium_tier) && item.premium_tier > 0
|
12
|
-
<b>Tier #{item.premium_tier}</b>
|
@@ -1,11 +0,0 @@
|
|
1
|
-
|
2
|
-
## From: https://gist.github.com/be9/6446051
|
3
|
-
|
4
|
-
current, total, per_page = collection.current_page, collection.total_pages, collection.limit_value
|
5
|
-
|
6
|
-
json.current current
|
7
|
-
json.previous (current > 1 ? (current - 1) : nil)
|
8
|
-
json.next (current == total ? nil : (current + 1))
|
9
|
-
json.per_page per_page
|
10
|
-
json.pages total
|
11
|
-
json.count collection.total_count
|
@@ -1,16 +0,0 @@
|
|
1
|
-
|
2
|
-
<ul>
|
3
|
-
<li><b>From:</b> <%= @msg.from %></li>
|
4
|
-
<li><b>To:</b> <%= @msg.to %></li>
|
5
|
-
<li><b>Cc:</b> <%= @msg.cc %></li>
|
6
|
-
<li><b>Subject:</b> <%= @msg.subject %></li>
|
7
|
-
<li><b>Date:</b> <%= @msg.date %></li>
|
8
|
-
<li><b>N Attachments:</b> <%= @msg.attachments.length %></li>
|
9
|
-
</ul>
|
10
|
-
|
11
|
-
<%= raw @msg.part_html %>
|
12
|
-
|
13
|
-
<hr />
|
14
|
-
|
15
|
-
<%= raw @msg.part_txt %>
|
16
|
-
|
@@ -1,24 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ishapi / galleries / _show
|
3
|
-
#
|
4
|
-
|
5
|
-
# @TODO: remove this file, this looks like a newsitem
|
6
|
-
|
7
|
-
json.id gallery.id.to_s
|
8
|
-
json.item_type gallery.class.name
|
9
|
-
json.name gallery.name
|
10
|
-
json.slug gallery.slug
|
11
|
-
json.description gallery.description
|
12
|
-
json.username gallery.username || 'piousbox'
|
13
|
-
json.n_photos photos.length
|
14
|
-
json.slug gallery.slug
|
15
|
-
json.subhead gallery.subhead
|
16
|
-
json.partial! 'ishapi/application/meta', :item => gallery
|
17
|
-
if gallery.is_premium
|
18
|
-
json.premium_tier gallery.premium_tier
|
19
|
-
json.is_premium gallery.premium_tier > 0
|
20
|
-
json.is_purchased @current_profile&.has_premium_purchase( gallery )
|
21
|
-
json.partial! 'ishapi/photos/index', :photos => [ photos[0] ]
|
22
|
-
else
|
23
|
-
json.partial! 'ishapi/photos/index', :photos => photos
|
24
|
-
end
|
@@ -1,15 +0,0 @@
|
|
1
|
-
|
2
|
-
#
|
3
|
-
# ishapi / galleries / index
|
4
|
-
#
|
5
|
-
|
6
|
-
json.array! @galleries do |gallery|
|
7
|
-
json.id gallery.id.to_s
|
8
|
-
json.name gallery.name
|
9
|
-
json.slug gallery.slug
|
10
|
-
json.slug gallery.slug
|
11
|
-
json.subhead gallery.subhead
|
12
|
-
json.username gallery.user_profile&.name
|
13
|
-
json.partial! 'ishapi/photos/index', :photos => gallery.photos
|
14
|
-
end
|
15
|
-
|
@@ -1,20 +0,0 @@
|
|
1
|
-
|
2
|
-
.galleries-show
|
3
|
-
|
4
|
-
.header
|
5
|
-
%h2.title= @gallery.name
|
6
|
-
|
7
|
-
.photos-mini
|
8
|
-
- @photos.each do |photo|
|
9
|
-
.item= image_tag photo.photo.url( :mini )
|
10
|
-
.photos-thumb
|
11
|
-
- @photos.each do |photo|
|
12
|
-
.item= image_tag photo.photo.url( :thumb2 )
|
13
|
-
.photos-large
|
14
|
-
- @photos.each do |photo|
|
15
|
-
.item= image_tag photo.photo.url( :large )
|
16
|
-
|
17
|
-
-# json.thumb_url photo.photo.url( :thumb )
|
18
|
-
-# json.small_url photo.photo.url( :small )
|
19
|
-
-# json.large_url photo.photo.url( :large )
|
20
|
-
-# json.original_url photo.photo.url( :original )
|
@@ -1,12 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ishapi / galleries / show
|
3
|
-
#
|
4
|
-
|
5
|
-
this_key = [ @gallery, params.permit! ]
|
6
|
-
json.cache! this_key do
|
7
|
-
json.gallery do
|
8
|
-
json.partial! 'ishapi/application/meta', item: @gallery
|
9
|
-
json.partial! 'ishapi/galleries/show', gallery: @gallery, photos: @photos
|
10
|
-
end
|
11
|
-
end
|
12
|
-
|
@@ -1,21 +0,0 @@
|
|
1
|
-
#
|
2
|
-
# ishapi / galleries / show_premium_locked
|
3
|
-
#
|
4
|
-
|
5
|
-
this_key = [ @gallery, params.permit! ]
|
6
|
-
json.cache! this_key do
|
7
|
-
json.gallery do
|
8
|
-
|
9
|
-
json.id @gallery.id.to_s
|
10
|
-
json.item_type @gallery.class.name
|
11
|
-
|
12
|
-
json.premium_tier @gallery.premium_tier
|
13
|
-
json.is_premium @gallery.is_premium
|
14
|
-
json.is_purchased false
|
15
|
-
|
16
|
-
# json.partial! 'ishapi/galleries/show', gallery: @gallery
|
17
|
-
# json.partial! 'ishapi/photos/index', :photos => [ @gallery.photos[0] ]
|
18
|
-
end
|
19
|
-
json.message "This is premium content - please purchase it to view!"
|
20
|
-
end
|
21
|
-
|