apply rails 4 todos and fix specs after rebase
This commit is contained in:
parent
3fadba0430
commit
d6d65cd0fd
4 changed files with 10 additions and 21 deletions
|
|
@ -101,12 +101,10 @@ DATA
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
||||||
# TODO action needed after rails4 update
|
|
||||||
class UserSearch
|
class UserSearch
|
||||||
#include ActiveModel::Model # rails4
|
include ActiveModel::Model
|
||||||
include ActiveModel::Conversion
|
include ActiveModel::Conversion
|
||||||
include ActiveModel::Validations
|
include ActiveModel::Validations
|
||||||
include ActiveModel::MassAssignmentSecurity
|
|
||||||
|
|
||||||
attr_accessor :username, :email, :guid, :under13
|
attr_accessor :username, :email, :guid, :under13
|
||||||
|
|
||||||
|
|
@ -117,26 +115,20 @@ DATA
|
||||||
yield(self) if block_given?
|
yield(self) if block_given?
|
||||||
end
|
end
|
||||||
|
|
||||||
def assign_attributes(values, options={})
|
def assign_attributes(values)
|
||||||
sanitize_for_mass_assignment(values, options[:as]).each do |k, v|
|
values.each do |k, v|
|
||||||
send("#{k}=", v)
|
public_send("#{k}=", v)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# TODO remove this once ActiveModel is included
|
|
||||||
def persisted?
|
|
||||||
false
|
|
||||||
end
|
|
||||||
|
|
||||||
def any_searchfield_present?
|
def any_searchfield_present?
|
||||||
if %w(username email guid under13).all? { |attr| self.send(attr).blank? }
|
if %w(username email guid under13).all? { |attr| public_send(attr).blank? }
|
||||||
errors.add :base, "no fields for search set"
|
errors.add :base, "no fields for search set"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def perform
|
def perform
|
||||||
#return User.none unless valid? # rails4
|
return User.none unless valid?
|
||||||
return [] unless valid?
|
|
||||||
|
|
||||||
users = User.arel_table
|
users = User.arel_table
|
||||||
people = Person.arel_table
|
people = Person.arel_table
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
# From http://jfire.io/blog/2012/04/30/how-to-securely-bootstrap-json-in-a-rails-view/
|
# From http://jfire.io/blog/2012/04/30/how-to-securely-bootstrap-json-in-a-rails-view/
|
||||||
# Review on Rails 4 update, might be built in by then!
|
# Remove on Rails 4.1 update
|
||||||
|
|
||||||
class ActionView::Base
|
class ActionView::Base
|
||||||
def json_escape(s)
|
def json_escape(s)
|
||||||
|
|
|
||||||
|
|
@ -78,7 +78,7 @@ class SignedRetraction
|
||||||
onward_retraction.sender = receiving_user.person
|
onward_retraction.sender = receiving_user.person
|
||||||
Postzord::Dispatcher.build(receiving_user, onward_retraction).post
|
Postzord::Dispatcher.build(receiving_user, onward_retraction).post
|
||||||
end
|
end
|
||||||
if target
|
if target && !target.destroyed?
|
||||||
self.target.destroy
|
self.target.destroy
|
||||||
end
|
end
|
||||||
Rails.logger.info("event=retraction status =complete target_type=#{self.target_type} guid =#{self.target_guid}")
|
Rails.logger.info("event=retraction status =complete target_type=#{self.target_type} guid =#{self.target_guid}")
|
||||||
|
|
|
||||||
|
|
@ -36,12 +36,9 @@ module Diaspora
|
||||||
message << options[:append_after_truncate].to_s
|
message << options[:append_after_truncate].to_s
|
||||||
end
|
end
|
||||||
|
|
||||||
include ActionView::Helpers::TagHelper
|
|
||||||
def escape
|
def escape
|
||||||
if options[:escape]
|
if options[:escape]
|
||||||
# TODO: On Rails 4 port change this to ERB::Util.html_escape_once
|
@message = ERB::Util.html_escape_once message
|
||||||
# and remove the include
|
|
||||||
@message = escape_once message
|
|
||||||
|
|
||||||
# Special case Hex entities since escape_once
|
# Special case Hex entities since escape_once
|
||||||
# doesn't catch them.
|
# doesn't catch them.
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue