Allow guests to chat

Conrad Irwin created

Change summary

crates/collab/src/db/queries/messages.rs | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)

Detailed changes

crates/collab/src/db/queries/messages.rs 🔗

@@ -9,7 +9,7 @@ impl Database {
         user_id: UserId,
     ) -> Result<()> {
         self.transaction(|tx| async move {
-            self.check_user_is_channel_member(channel_id, user_id, &*tx)
+            self.check_user_is_channel_participant(channel_id, user_id, &*tx)
                 .await?;
             channel_chat_participant::ActiveModel {
                 id: ActiveValue::NotSet,
@@ -77,7 +77,7 @@ impl Database {
         before_message_id: Option<MessageId>,
     ) -> Result<Vec<proto::ChannelMessage>> {
         self.transaction(|tx| async move {
-            self.check_user_is_channel_member(channel_id, user_id, &*tx)
+            self.check_user_is_channel_participant(channel_id, user_id, &*tx)
                 .await?;
 
             let mut condition =
@@ -125,6 +125,9 @@ impl Database {
         nonce: u128,
     ) -> Result<(MessageId, Vec<ConnectionId>, Vec<UserId>)> {
         self.transaction(|tx| async move {
+            self.check_user_is_channel_participant(channel_id, user_id, &*tx)
+                .await?;
+
             let mut rows = channel_chat_participant::Entity::find()
                 .filter(channel_chat_participant::Column::ChannelId.eq(channel_id))
                 .stream(&*tx)