Merge branch 'master' into omniauth_for_social_sites

This commit is contained in:
Andrew Brown 2017-09-30 08:02:12 -05:00 committed by GitHub
commit 2a04d4e7fb
8 changed files with 22 additions and 17 deletions

View File

@ -33,13 +33,13 @@ class ContentController < ApplicationController
'content_type': content_type.name,
'content_owner': current_user.present? && current_user.id == @content.user_id,
'logged_in_user': current_user.present?
})
}) if Rails.env.production?
else
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'viewed recently-modified content', {
'content_type': content_type.name,
'content_owner': current_user.present? && current_user.id == @content.user_id,
'logged_in_user': current_user.present?
})
}) if Rails.env.production?
end
end
@ -94,7 +94,7 @@ class ContentController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'created content', {
'content_type': content_type.name
})
}) if Rails.env.production?
if @content.save
if params.key? 'image_uploads'
@ -117,7 +117,7 @@ class ContentController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'updated content', {
'content_type': content_type.name
})
}) if Rails.env.production?
if params.key? 'image_uploads'
upload_files params['image_uploads'], content_type.name, @content.id
@ -156,7 +156,7 @@ class ContentController < ApplicationController
'content_type': content_type,
'image_size_kb': image_size_kb,
'first five images': current_user.image_uploads.count <= 5
})
}) if Rails.env.production?
end
end
@ -170,7 +170,7 @@ class ContentController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'deleted content', {
'content_type': content_type.name
})
}) if Rails.env.production?
@content.destroy

View File

@ -4,14 +4,14 @@ class ExportController < ApplicationController
def index
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'viewed export page', {
'content count': current_user.content_count
})
}) if Rails.env.production?
end
def report_to_mixpanel format, scope
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'exported content', {
'export format': format,
'scope': scope
})
}) if Rails.env.production?
end
# Formats

View File

@ -28,7 +28,7 @@ class ImageUploadController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'deleted image', {
'image_size_kb': reclaimed_space_kb
})
}) if Rails.env.production?
render json: { success: result }, status: 200
end

View File

@ -7,7 +7,7 @@ class SubscriptionsController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'viewed billing page', {
'current billing plan': current_user.selected_billing_plan_id,
'content count': current_user.content_count
})
}) if Rails.env.production?
# We only support a single billing plan right now, so just grab the first one. If they don't have an active plan,
# we also treat them as if they have a Starter plan.
@ -163,7 +163,7 @@ class SubscriptionsController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'viewed payment method page', {
'current billing plan': current_user.selected_billing_plan_id,
'content count': current_user.content_count
})
}) if Rails.env.production?
end
def information_change
@ -300,7 +300,7 @@ class SubscriptionsController < ApplicationController
end
def stripe_webhook
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'stripe webhook')
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(current_user.id, 'stripe webhook') if Rails.env.production?
#todo handle webhooks
end

View File

@ -8,6 +8,6 @@ class UsersController < ApplicationController
Mixpanel::Tracker.new(Rails.application.config.mixpanel_token).track(@user.id, 'viewed profile', {
'sharing any content': @user.public_content_count != 0
})
}) if Rails.env.production?
end
end

View File

@ -44,6 +44,6 @@
style: 'z-index: 500;',
method: :delete,
data: { confirm: "Are you sure? Deleting this #{@content.class.name.downcase} cannot be undone!" } do %>
<i class="material-icons red-text text-lighten-2">delete</i> sip
<i class="material-icons red-text text-lighten-2">delete</i>
<% end %>
<% end %>

View File

@ -3,6 +3,7 @@ Feature: Serendipitous cards
Scenario: I update character info using a serendipitous card
Given I am logged-in
And I create a character
When I view that character
When I view the dashboard
Then I should see my dashboard
And I answer the Serendipitous question
Then that new field should be saved

View File

@ -31,6 +31,10 @@ When 'I log out' do
visit destroy_user_session_path
end
When(/^I view the dashboard/) do
visit dashboard_path
end
Then 'I should see my dashboard' do
expect(current_path).to eq(dashboard_path)
end
@ -52,9 +56,9 @@ end
When(/^I change my (character|location|item|universe)\'s name$/) do |model|
visit polymorphic_path(@model)
click_on "Edit this #{model}"
click_on 'edit'
fill_in "#{model}_name", with: 'My changed name'
click_on "Update"
click_on 'save'
@model.reload
end