Skip to content

Commit

Permalink
Fix rubocop errors in app/api & app/channels
Browse files Browse the repository at this point in the history
  • Loading branch information
yamiacat committed Oct 8, 2019
1 parent cc10a02 commit 16d46d2
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 9 deletions.
4 changes: 2 additions & 2 deletions app/api/srch/search.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ class Search < Grape::API
if results.present?
docs = results.map do |model|
DocResult.new(
doc_type: 'USERS',
doc_type: 'USERS',
doc_url: '/profile/' + model.name,
doc_title: model.username,
latitude: model.lat,
Expand Down Expand Up @@ -181,7 +181,7 @@ class Search < Grape::API
DocList.new('', search_request)
end
end

# Request URL should be /api/srch/nodes?query=QRY
desc 'Perform a search of nodes', hidden: false,
is_array: false,
Expand Down
6 changes: 2 additions & 4 deletions app/channels/application_cable/connection.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,15 @@ class Connection < ActionCable::Connection::Base
def connect
self.current_user = find_verified_user
end

def find_verified_user
if cookies.signed['user_token'] != nil
unless cookies.signed['user_token'].nil?
user = User.where(persistence_token: cookies.signed['user_token'])
if user.any?
return user.first
else
return nil
end
else
return nil
end
end
end
Expand Down
1 change: 0 additions & 1 deletion app/channels/room_channel.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# This is a general channel connected to all active session
class RoomChannel < ApplicationCable::Channel

def subscribed
stream_from "room_channel"
end
Expand Down
2 changes: 1 addition & 1 deletion app/channels/user_channel.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UserChannel < ApplicationCable::Channel
def subscribed
if current_user != nil
if !current_user.nil?
stream_from "users:#{current_user.id}"
else
reject
Expand Down
2 changes: 1 addition & 1 deletion app/channels/user_notification_channel.rb
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
class UserNotificationChannel < ApplicationCable::Channel
def subscribed
if current_user != nil
if !current_user.nil?
stream_from "users:notification:#{current_user.id}"
else
reject
Expand Down

0 comments on commit 16d46d2

Please sign in to comment.