diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 06b1aa332..c0aa9e511 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -27,7 +27,7 @@ class UsersController < ApplicationController end def create - @user = User.create(params[:user], :as => :admin) + @user = User.create(params[:user], :as => CurrentUser.role) if @user.errors.empty? session[:user_id] = @user.id end @@ -38,7 +38,7 @@ class UsersController < ApplicationController def update @user = User.find(params[:id]) check_privilege(@user) - @user.update_attributes(params[:user], :as => :admin) + @user.update_attributes(params[:user], :as => CurrentUser.role) respond_with(@user) end diff --git a/app/models/user.rb b/app/models/user.rb index 7d60cc63e..0e3a80219 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -328,7 +328,7 @@ class User < ActiveRecord::Base def can_upload? if is_contributor? true - elsif false && created_at > 1.week.ago + elsif created_at > 1.week.ago false else upload_limit > 0 @@ -338,7 +338,7 @@ class User < ActiveRecord::Base def can_comment? if is_privileged? true - elsif false && created_at > 1.week.ago + elsif created_at > 1.week.ago false else Comment.where("creator_id = ? and created_at > ?", id, 1.hour.ago).count < Danbooru.config.member_comment_limit diff --git a/app/views/users/new.html.erb b/app/views/users/new.html.erb index d850a5c65..781e4109a 100644 --- a/app/views/users/new.html.erb +++ b/app/views/users/new.html.erb @@ -69,7 +69,6 @@ <%= f.input :password %> <%= f.input :password_confirmation %> <%= f.input :email, :required => false, :as => :email %> - <%= f.input :level, :collection => User.level_hash.to_a, :include_blank => false %> <%= f.button :submit %> <% end %> diff --git a/script/upgrade_schema.sql b/script/upgrade_schema.sql index 85c5c210d..5fa4edd50 100644 --- a/script/upgrade_schema.sql +++ b/script/upgrade_schema.sql @@ -1,7 +1,11 @@ alter table posts add column fav_string text not null default ''; alter table posts add column pool_string text not null default ''; -update posts set fav_string = (select coalesce(string_agg('fav:' || _.user_id, ' '), '') from favorites _ where _.post_id = posts.id); -update posts set pool_string = (select coalesce(string_agg('pool:' || _.pool_id, ' '), '') from pools_posts _ where _.post_id = posts.id); + +-- TODO: REVERT +update posts set fav_string = (select coalesce(string_agg('fav:' || _.user_id, ' '), '') from favorites _ where _.post_id = posts.id) where posts.id < 1000; + +-- TODO: REVERT +update posts set pool_string = (select coalesce(string_agg('pool:' || _.pool_id, ' '), '') from pools_posts _ where _.post_id = posts.id) where posts.id < 1000; create index index_advertisements_on_ad_type on advertisements (ad_type);