X-Git-Url: https://git.openstreetmap.org/rails.git/blobdiff_plain/cb87f02642d0097ebc067ca1f9371dde274a41e3..e091246ffc2d640f0a7f2324998315b33b891847:/app/models/user_block.rb diff --git a/app/models/user_block.rb b/app/models/user_block.rb index 4f9cf1128..f56f87b9d 100644 --- a/app/models/user_block.rb +++ b/app/models/user_block.rb @@ -3,12 +3,12 @@ # Table name: user_blocks # # id :integer not null, primary key -# user_id :integer not null -# creator_id :integer not null +# user_id :bigint(8) not null +# creator_id :bigint(8) not null # reason :text not null # ends_at :datetime not null # needs_view :boolean default(FALSE), not null -# revoker_id :integer +# revoker_id :bigint(8) # created_at :datetime # updated_at :datetime # reason_format :enum default("markdown"), not null @@ -26,6 +26,7 @@ class UserBlock < ActiveRecord::Base validate :moderator_permissions + validates :reason, :invalid_chars => true belongs_to :user, :class_name => "User", :foreign_key => :user_id belongs_to :creator, :class_name => "User", :foreign_key => :creator_id @@ -63,7 +64,7 @@ class UserBlock < ActiveRecord::Base # revokes the block, allowing the user to use the API again. the argument # is the user object who is revoking the ban. def revoke!(revoker) - update_attributes( + update( :ends_at => Time.now.getutc, :revoker_id => revoker.id, :needs_view => false