diff --git a/app/controllers/content_controller.rb b/app/controllers/content_controller.rb index c4bbacef..e4c22707 100644 --- a/app/controllers/content_controller.rb +++ b/app/controllers/content_controller.rb @@ -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 diff --git a/app/controllers/export_controller.rb b/app/controllers/export_controller.rb index a641e486..7c44ead2 100644 --- a/app/controllers/export_controller.rb +++ b/app/controllers/export_controller.rb @@ -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 diff --git a/app/controllers/image_upload_controller.rb b/app/controllers/image_upload_controller.rb index 1e6e3c19..f8b6536e 100644 --- a/app/controllers/image_upload_controller.rb +++ b/app/controllers/image_upload_controller.rb @@ -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 diff --git a/app/controllers/subscriptions_controller.rb b/app/controllers/subscriptions_controller.rb index 91711e43..4a5e1131 100644 --- a/app/controllers/subscriptions_controller.rb +++ b/app/controllers/subscriptions_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index e1bcadf2..eb5e4827 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 diff --git a/app/views/content/display/_floating_action_buttons.html.erb b/app/views/content/display/_floating_action_buttons.html.erb index 85bb0de3..230aef2d 100644 --- a/app/views/content/display/_floating_action_buttons.html.erb +++ b/app/views/content/display/_floating_action_buttons.html.erb @@ -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 %> - delete sip + delete <% end %> <% end %> diff --git a/features/serendipitous_cards.feature b/features/serendipitous_cards.feature index ef67a78d..2459ce0d 100644 --- a/features/serendipitous_cards.feature +++ b/features/serendipitous_cards.feature @@ -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 diff --git a/features/step_definitions/steps.rb b/features/step_definitions/steps.rb index 188b4346..c5691ad9 100644 --- a/features/step_definitions/steps.rb +++ b/features/step_definitions/steps.rb @@ -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