This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li class="no-requests">You have no new requests</li> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% current_user.pending_received_contact_requests.each do |user| %> | |
<%= render partial: "layouts/"\ | |
"navigation/"\ | |
"header/"\ | |
"dropdowns/"\ | |
"contact_requests/"\ | |
"request", | |
locals: { user: user } %> | |
<% end %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<a class="dropdown-toggle" data-toggle="dropdown" href="#"> | |
<i class="fa fa-user-o" aria-hidden="true"> | |
<span id="unresponded-contact-requests"></span> | |
</i> | |
</a> | |
<ul class="dropdown dropdown-menu" role="menu"> | |
<%= render nav_contact_requests_partial_path %> | |
</ul><!-- dropdown-menu --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<li class="contact-request" data-user-name="<%= sender.name %>"> | |
<div class="sixty-percent"> | |
<span class="contact-name"><%= sender.name %></span> | |
</div> | |
<div class="forty-percent"> | |
<span class="accept-request"> | |
<%= link_to "Accept", | |
contact_path(id: sender.id), | |
remote: true, | |
method: "put" %> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ContactRequestBroadcastJob < ApplicationJob | |
queue_as :default | |
def perform(contact_request) | |
sender = User.find(contact_request.user_id) | |
receiver = User.find(contact_request.contact_id) | |
ActionCable.server.broadcast( | |
"notifications_#{receiver.id}", | |
notification: 'contact-request-received', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NotificationChannel < ApplicationCable::Channel | |
def subscribed | |
stream_from "notifications_#{current_user.id}" | |
end | |
def unsubscribed | |
stop_all_streams | |
end | |
def contact_request_response(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<form class="send-group-message"> | |
<input name="conversation_id" | |
type="hidden" | |
value="<%= conversation.id %>"> | |
<input name="user_id" type="hidden" value="<%= current_user.id %>"> | |
<textarea name="content" | |
rows="2" | |
class="form-control" | |
placeholder="Type a message..."></textarea> | |
<input type="submit" class="btn btn-success send-message"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="conversation-details"> | |
<%= link_to :back do %> | |
<i class="fa fa-arrow-left back-to-chats-main" aria-hidden="true"></i> | |
<% end %> | |
<div class="conversation-name"> | |
<%= conversation.name %> | |
</div> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<% @is_messenger = true %> | |
<%= render 'messengers/group_conversation/details', | |
conversation: conversation %> | |
<%= render 'group/conversations/conversation/messages_list', | |
conversation: conversation %> | |
<%= render 'messengers/group_conversation/new_message_form', | |
conversation: conversation %> |