* VRFS-1098 - fixed case where registering as a musician in the native interface sends you to downloads (goofy). Also refactoder is_native_client? into a helper
This commit is contained in:
parent
763538e136
commit
240967f7ce
|
|
@ -1,18 +1,22 @@
|
|||
SimpleCov.start do
|
||||
add_filter "/test/"
|
||||
add_filter "/bin/"
|
||||
add_filter "/scripts/"
|
||||
add_filter "/tmp/"
|
||||
add_filter "/vendor/"
|
||||
end
|
||||
if ENV['COVERAGE'] == "1"
|
||||
|
||||
#SimpleCov.coverage_dir 'coverage/'
|
||||
all_files = Dir['**/*.rb']
|
||||
SimpleCov.start do
|
||||
add_filter "/test/"
|
||||
add_filter "/bin/"
|
||||
add_filter "/scripts/"
|
||||
add_filter "/tmp/"
|
||||
add_filter "/vendor/"
|
||||
add_filter "/spec/"
|
||||
end
|
||||
|
||||
all_files = Dir['**/*.rb']
|
||||
base_result = {}
|
||||
all_files.each do |file|
|
||||
absolute = File::expand_path(file)
|
||||
lines = File.readlines(absolute, :encoding => 'UTF-8')
|
||||
base_result[absolute] = lines.map do |l|
|
||||
l.encode!('UTF-16', 'UTF-8', :invalid => :replace, :replace => '')
|
||||
l.encode!('UTF-8', 'UTF-16')
|
||||
l.strip!
|
||||
l.empty? || l =~ /^end$/ || l[0] == '#' ? nil : 0
|
||||
end
|
||||
|
|
@ -29,3 +33,4 @@ end
|
|||
result.format!
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
class ClientsController < ApplicationController
|
||||
|
||||
include ClientHelper
|
||||
include UsersHelper
|
||||
|
||||
def index
|
||||
|
|
@ -19,15 +20,7 @@ class ClientsController < ApplicationController
|
|||
gon.allow_force_native_client = Rails.application.config.allow_force_native_client
|
||||
|
||||
# is this the native client or browser?
|
||||
user_agent = request.env["HTTP_USER_AGENT"]
|
||||
@nativeClient = !user_agent.blank? && user_agent.downcase.include?("jamkazam")
|
||||
|
||||
# allow override of the client type if configured to so, and if we find the override cookie in place
|
||||
if Rails.application.config.allow_force_native_client
|
||||
unless cookies[:act_as_native_client].nil?
|
||||
@nativeClient = (cookies[:act_as_native_client] == "true") ? true : false
|
||||
end
|
||||
end
|
||||
@nativeClient = is_native_client?
|
||||
|
||||
# let javascript have access to the server's opinion if this is a native client
|
||||
gon.isNativeClient = @nativeClient
|
||||
|
|
|
|||
|
|
@ -3,10 +3,15 @@
|
|||
require 'builder'
|
||||
|
||||
class UsersController < ApplicationController
|
||||
|
||||
include ClientHelper
|
||||
|
||||
before_filter :signed_in_user,
|
||||
only: [:index, :edit, :update, :destroy]
|
||||
before_filter :correct_user, only: [:edit, :update]
|
||||
before_filter :admin_user, only: :destroy
|
||||
before_filter :is_native_client
|
||||
|
||||
|
||||
rescue_from 'JamRuby::PermissionError' do |exception|
|
||||
@exception = exception
|
||||
|
|
@ -326,6 +331,10 @@ class UsersController < ApplicationController
|
|||
|
||||
private
|
||||
|
||||
def is_native_client
|
||||
@nativeClient = is_native_client?
|
||||
end
|
||||
|
||||
def correct_user
|
||||
@user = User.find(params[:id])
|
||||
redirect_to(root_url) unless current_user?(@user)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,18 @@
|
|||
module ClientHelper
|
||||
|
||||
# is this the native client (or browser emulating native client with CTRL+SHIFT+0), or browser?
|
||||
def is_native_client?
|
||||
# is this the native client or browser?
|
||||
user_agent = request.env["HTTP_USER_AGENT"]
|
||||
is_native_client = !user_agent.blank? && user_agent.downcase.include?("jamkazam")
|
||||
|
||||
# allow override of the client type if configured to so, and if we find the override cookie in place
|
||||
if Rails.application.config.allow_force_native_client
|
||||
unless cookies[:act_as_native_client].nil?
|
||||
is_native_client = (cookies[:act_as_native_client] == "true") ? true : false
|
||||
end
|
||||
end
|
||||
|
||||
is_native_client
|
||||
end
|
||||
end
|
||||
|
|
@ -3,7 +3,7 @@
|
|||
<div class="w100 ">
|
||||
<div class="spinner-large"></div>
|
||||
<div class="w70 left downloads-blurb">
|
||||
<
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
<p>You have successfully registered as a JamKazam fan.</p>
|
||||
|
||||
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", root_path, :class =>"button-orange m0" %></div>
|
||||
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", client_path, :class =>"button-orange m0" %></div>
|
||||
|
||||
<script type="text/javascript">
|
||||
window.congratulations.initialize(false, jQuery.QueryString["type"]);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,13 @@
|
|||
<% provide(:title, 'Congratulations') %>
|
||||
|
||||
<%= render "users/downloads" %>
|
||||
<% if @nativeClient %>
|
||||
<div class="tagline">Congratulations!</div>
|
||||
<p>You have successfully registered as a musician.</p>
|
||||
<div class="proceed"><%= link_to "PROCEED TO JAMKAZAM SITE", client_path, :class =>"button-orange m0" %></div>
|
||||
<% else %>
|
||||
<%= render "users/downloads" %>
|
||||
<% end %>
|
||||
|
||||
|
||||
<script type="text/javascript">
|
||||
window.congratulations.initialize(true, jQuery.QueryString["type"]);
|
||||
|
|
|
|||
Loading…
Reference in New Issue