module FrancisCms
  class WebmentionValidator < ActiveModel::Validator
    def validate(record)
      return record.errors[:base] << 'Webmention source and target must be different.' if source_is_target?
    end

    private

    def source_is_target?
      record.source.sub(%r{^https?://}, '') == record.target.sub(%r{^https?://}, '')
    end
  end
end

module FrancisCms
  class WebmentionValidator < ActiveModel::Validator
    def validate(record)
      if record.source.sub(/^https?:\/\//, '') == record.target.sub(/^https?:\/\//, '')
        record.errors[:base] << 'Webmention source and target must be different.'
      end
    end
  end
end

Revert conditional logic bug introduced in 0d5ee8c
Revert conditional logic bug introduced in 0d5ee8c
