From 4b169cf2e0a6789fa195041d66eae00ca2b6bc94 Mon Sep 17 00:00:00 2001 From: Manson Wang Date: Wed, 4 Dec 2013 13:43:00 +0800 Subject: [PATCH] Fix desktop nil theme bug and approval for new user --- app/controllers/admin/users_new_interface_controller.rb | 8 ++++++++ app/controllers/desktop_controller.rb | 5 +++++ 2 files changed, 13 insertions(+) diff --git a/app/controllers/admin/users_new_interface_controller.rb b/app/controllers/admin/users_new_interface_controller.rb index fe8ccd87..0631659a 100644 --- a/app/controllers/admin/users_new_interface_controller.rb +++ b/app/controllers/admin/users_new_interface_controller.rb @@ -168,7 +168,15 @@ class Admin::UsersNewInterfaceController < OrbitMemberController # } # @user.rebuild_sub_roles_from_attribute_values!(attribute_values) # binding.pry + @user.confirmation_token = nil + @user.confirmed_at = Time.now + @user.approved = true + if !flash.now[:error] && @user.save + desk = @user.desktop + desk.theme = DesktopTheme.first.id.to_s + desk.wallpaper = nil + desk.save! flash[:notice] = t('create.success.user') redirect_to :action => :index else diff --git a/app/controllers/desktop_controller.rb b/app/controllers/desktop_controller.rb index 299c2a21..d2230767 100644 --- a/app/controllers/desktop_controller.rb +++ b/app/controllers/desktop_controller.rb @@ -9,6 +9,11 @@ class DesktopController< ApplicationController def index @desktop = current_user.desktop + if(@desktop.theme.nil?) + @desktop.theme = DesktopTheme.first.id.to_s + @desktop.wallpaper = nil + @desktop.save! + end @currentusername = current_user.name @currentname = current_user.first_name + current_user.last_name @title = "Desktop - " + @currentusername