[deploy] Fix non channel details visible (#9252)

* Feature 🚀 : Ability to delete messages in chat channels

- Sending message ID to frontend
- Deleting Message
- Use pusher to delete message realtime

* Minor Bug 🐞: Show message action only for current user

- User can delete or edit their own messages

* Test cases added

* Bug 🐞: Update message id for receiver

Message id was not sent to receiver by pusher

* Refactoring🛠: Message controller refactoring

* Test Cases📝 : Specs for Delete message added

* Feature 🚀 : Ability to edit messages

* Test Cases📝 : Specs for Edit message added

* Merge conflict resolved

* fix pending invitation issue

* non active member blocked to open channel details

* add specs for bug fix

Co-authored-by: Sarthak Sharma <7lovesharma7@gmail.com>
This commit is contained in:
narender2031 2020-07-16 20:58:28 +05:30 committed by GitHub
parent 9e94b80741
commit 2a5f5053b7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 22 additions and 2 deletions

View file

@ -225,8 +225,9 @@ class ChatChannelsController < ApplicationController
else
params[:slug]
end
@active_channel = ChatChannel.find_by(slug: slug)
@active_channel.current_user = current_user if @active_channel
chat_channel = ChatChannel.find_by(slug: slug)
membership = chat_channel.chat_channel_memberships.find_by(user_id: current_user.id)
@active_channel = membership&.status == "active" ? chat_channel : nil
end
def render_chat_channel

View file

@ -7,6 +7,10 @@ const PendingMembershipSection = ({
removeMembership,
currentMembershipRole,
}) => {
if (currentMembershipRole === 'member') {
return null;
}
return (
<div
data-testid="pending-memberships"

View file

@ -39,6 +39,21 @@ RSpec.describe "ChatChannels", type: :request do
expect(response.body).to include("chat-page-wrapper")
end
end
context "when active membership is pending" do
before do
invite_channel.add_users [user]
invite_channel.chat_channel_memberships.last.update(status: "pending")
sign_in user
get "/connect/#{invite_channel.slug}"
end
it "have no active channel" do
expect(response).not_to(redirect_to(connect_path(invite_channel.slug)))
expect(response.body).not_to include(invite_channel.slug)
end
end
end
describe "get /chat_channels?state=unopened" do