diff --git a/app/controllers/contributors_controller.rb b/app/controllers/contributors_controller.rb
index ca66620a..5f138613 100644
--- a/app/controllers/contributors_controller.rb
+++ b/app/controllers/contributors_controller.rb
@@ -16,6 +16,15 @@ class ContributorsController < ApplicationController
passthrough_link: Rails.application.routes.url_helpers.universe_path(relevant_universe)
) if user.present?
+ # Create a notification letting the universe owner know
+ relevant_universe.user.notifications.create(
+ message_html: "
#{user.display_name} has stopped collaborating on your #{relevant_universe.name} universe.
",
+ icon: Universe.icon,
+ icon_color: Universe.color,
+ happened_at: DateTime.current,
+ passthrough_link: Rails.application.routes.url_helpers.universe_path(relevant_universe)
+ ) if user.present?
+
#todo send "you've been removed as a contributor" email
end
diff --git a/app/controllers/registrations_controller.rb b/app/controllers/registrations_controller.rb
index 61a4d859..eac5e3e7 100644
--- a/app/controllers/registrations_controller.rb
+++ b/app/controllers/registrations_controller.rb
@@ -82,7 +82,7 @@ class RegistrationsController < Devise::RegistrationsController
icon_color: Universe.color,
happened_at: DateTime.current,
passthrough_link: Rails.application.routes.url_helpers.universe_path(contributorship.universe)
- ) if resource.present?
+ )
end
end
end
diff --git a/app/models/users/user.rb b/app/models/users/user.rb
index 48eecdee..63bfd0db 100644
--- a/app/models/users/user.rb
+++ b/app/models/users/user.rb
@@ -234,13 +234,16 @@ class User < ApplicationRecord
result
end
- def forum_username
+ def display_name
username = self.username.present? ? "@#{self.username}" : nil
username ||= self.name.present? ? self.name : nil
username ||= 'Anonymous Author'
username
end
+ def forum_username
+ display_name
+ end
def self.from_api_key(key)
found_key = ApiKey.includes(:user).find_by(key: key)
diff --git a/app/services/subscription_service.rb b/app/services/subscription_service.rb
index a43e5923..94761cae 100644
--- a/app/services/subscription_service.rb
+++ b/app/services/subscription_service.rb
@@ -41,6 +41,14 @@ class SubscriptionService < Service
end_date: DateTime.now.end_of_day + 5.years
)
+ user.notifications.create(
+ message_html: "You signed up for Premium!
Click here to turn on your Premium pages.
",
+ icon: 'star',
+ icon_color: 'text-darken-3 yellow',
+ happened_at: DateTime.current,
+ passthrough_link: Rails.application.routes.url_helpers.customization_content_types_path
+ ) if user.reload.on_premium_plan?
+
report_subscription_change_to_slack(user, plan_id)
rescue Stripe::CardError => e