Revert "Merge branch '114-comment_notifications' into user-emails-list"
This reverts commit 2179cbbf40334cbe5d4fa9ba3a7f297d8f543a0a, reversing changes made to 9bf06e5e1a595f320dc4527ebd44f14be05fcd64. Conflicts: app/models/user.rb
This commit is contained in:
parent
f6b6bbfb54
commit
e0b7699ffd
|
@ -1,27 +0,0 @@
|
|||
# coding: UTF-8
|
||||
class UserEmailsController < UsersController
|
||||
before_filter :find_user
|
||||
|
||||
def index
|
||||
@emails = @user.emails
|
||||
(5 - @user.emails.count).times {|e| @emails << UserEmail.new(:user_id => @user) }
|
||||
end
|
||||
|
||||
def update
|
||||
@user.role = params[:user][:role]
|
||||
if @user.update_attributes(params[:user])
|
||||
flash[:notice] = t('flash.user.saved')
|
||||
redirect_to users_path
|
||||
else
|
||||
flash[:error] = t('flash.user.save_error')
|
||||
render :action => :edit
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@user.destroy
|
||||
flash[:notice] = t("flash.user.destroyed")
|
||||
redirect_to users_path
|
||||
end
|
||||
|
||||
end
|
|
@ -26,7 +26,6 @@ class User < ActiveRecord::Base
|
|||
has_many :subscribes, :foreign_key => :user_id, :dependent => :destroy
|
||||
|
||||
has_many :comments, :dependent => :destroy
|
||||
has_many :emails, :class_name => 'UserEmail', :dependent => :destroy
|
||||
|
||||
include Modules::Models::PersonalRepository
|
||||
|
||||
|
@ -57,9 +56,7 @@ class User < ActiveRecord::Base
|
|||
def find_for_database_authentication(warden_conditions)
|
||||
conditions = warden_conditions.dup
|
||||
login = conditions.delete(:login)
|
||||
where(conditions).where("lower(uname) = :value OR " +
|
||||
"exists (select null from user_emails m where users.user_id = m.user_id and lower(m.email) = :value)",
|
||||
{:value => login.downcase}).first
|
||||
where(conditions).where(["lower(uname) = :value OR lower(email) = :value", { :value => login.downcase }]).first
|
||||
end
|
||||
|
||||
def new_with_session(params, session)
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
class UserEmail < ActiveRecord::Base
|
||||
belongs_to :user
|
||||
|
||||
validates :email, :uniqueness => true
|
||||
validates :email, :presence => true
|
||||
|
||||
end
|
|
@ -76,6 +76,3 @@
|
|||
|
||||
.group.navform.wat-cf
|
||||
= link_to t('layout.settings.notifier'), user_settings_notifier_path(current_user)#, :class => "text_button_padding link_button"
|
||||
|
||||
.group.navform.wat-cf
|
||||
= link_to t('layout.settings.emails'), user_emails_path(current_user)#, :class => "text_button_padding link_button"
|
||||
|
|
|
@ -45,7 +45,6 @@ en:
|
|||
notifier: Notifier setting
|
||||
notifiers:
|
||||
edit_header: Notifier setting
|
||||
email: Email addresses
|
||||
processing: working ...
|
||||
|
||||
downloads:
|
||||
|
|
|
@ -44,7 +44,6 @@ ru:
|
|||
notifier: Настройки оповещений
|
||||
notifiers:
|
||||
edit_header: Настройки оповещений
|
||||
emails: Список Email
|
||||
processing: Обрабатывается...
|
||||
|
||||
downloads:
|
||||
|
|
|
@ -8,10 +8,6 @@ Rosa::Application.routes.draw do
|
|||
|
||||
resources :users do
|
||||
resources :groups, :only => [:new, :create, :index]
|
||||
resources :emails, :only => [:index, :destroy], :controller => :user_emails do
|
||||
put :update, :as => :member
|
||||
end
|
||||
|
||||
get :autocomplete_user_uname, :on => :collection
|
||||
namespace :settings do
|
||||
resource :notifier, :only => [:show, :update]
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
class CreateUserEmails < ActiveRecord::Migration
|
||||
def self.up
|
||||
create_table :user_emails do |t|
|
||||
t.integer :user_id, :null => false
|
||||
t.string :email, :null => false
|
||||
|
||||
t.timestamps
|
||||
end
|
||||
|
||||
add_index :user_emails, :user_id
|
||||
add_index :user_emails, :email
|
||||
UserEmail.reset_column_information
|
||||
User.all.each do |u|
|
||||
UserEmail.create(:user_id => u.id, :email => u.email)
|
||||
end
|
||||
end
|
||||
|
||||
def self.down
|
||||
drop_table :user_emails
|
||||
end
|
||||
end
|
|
@ -1,8 +0,0 @@
|
|||
# Read about factories at http://github.com/thoughtbot/factory_girl
|
||||
|
||||
FactoryGirl.define do
|
||||
factory :user_email do
|
||||
user_id 1
|
||||
email "MyString"
|
||||
end
|
||||
end
|
|
@ -1,5 +0,0 @@
|
|||
require 'spec_helper'
|
||||
|
||||
describe UserEmail do
|
||||
pending "add some examples to (or delete) #{__FILE__}"
|
||||
end
|
Loading…
Reference in New Issue