diff --git a/app/controllers/services_controller.rb b/app/controllers/services_controller.rb index 5e3cf5a2..bcf5aae2 100644 --- a/app/controllers/services_controller.rb +++ b/app/controllers/services_controller.rb @@ -10,14 +10,15 @@ class ServicesController < ApplicationController def create service = Service.initialize_from_omniauth(omniauth_hash) service.user = current_user + service_name = service.type.split("::").last.titleize if service.save - flash[:success] = t(".success") + flash[:success] = t(".success", service: service_name) else flash[:error] = if service.errors.details[:uid]&.any? { |err| err[:error] == :taken } - t(".duplicate", service: service.type.split("::").last.titleize, app: APP_CONFIG["site_name"]) + t(".duplicate", service: service_name, app: APP_CONFIG["site_name"]) else - t(".error") + t(".error", service: service_name) end end @@ -43,8 +44,9 @@ class ServicesController < ApplicationController def destroy @service = current_user.services.find(params[:id]) + service_name = @service.type.split("::").last.titleize @service.destroy - flash[:success] = t(".success") + flash[:success] = t(".success", service: service_name) redirect_to services_path end diff --git a/config/locales/controllers.en.yml b/config/locales/controllers.en.yml index e1cf05b1..a899a50e 100644 --- a/config/locales/controllers.en.yml +++ b/config/locales/controllers.en.yml @@ -138,16 +138,16 @@ en: error: "No user with the name @%{author} found, showing entries from all users instead!" services: create: - success: "Service connected successfully." + success: "%{service} connected successfully." duplicate: "The %{service} account you are trying to connect is already connected to another %{app} account. If you are unable to disconnect the account yourself, please send us a Direct Message on Twitter: @retrospring." - error: "Unable to connect service." + error: "Unable to connect to %{service}." update: success: "Service updated successfully." error: "Unable to update service." failure: error: :errors.base destroy: - success: "Service removed successfully." + success: "%{service} disconnected successfully." settings: export: index: