Allow guests to chat
This commit is contained in:
parent
783f05172b
commit
72ed8a6dd2
1 changed files with 5 additions and 2 deletions
|
@ -9,7 +9,7 @@ impl Database {
|
||||||
user_id: UserId,
|
user_id: UserId,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
self.transaction(|tx| async move {
|
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?;
|
.await?;
|
||||||
channel_chat_participant::ActiveModel {
|
channel_chat_participant::ActiveModel {
|
||||||
id: ActiveValue::NotSet,
|
id: ActiveValue::NotSet,
|
||||||
|
@ -77,7 +77,7 @@ impl Database {
|
||||||
before_message_id: Option<MessageId>,
|
before_message_id: Option<MessageId>,
|
||||||
) -> Result<Vec<proto::ChannelMessage>> {
|
) -> Result<Vec<proto::ChannelMessage>> {
|
||||||
self.transaction(|tx| async move {
|
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?;
|
.await?;
|
||||||
|
|
||||||
let mut condition =
|
let mut condition =
|
||||||
|
@ -125,6 +125,9 @@ impl Database {
|
||||||
nonce: u128,
|
nonce: u128,
|
||||||
) -> Result<(MessageId, Vec<ConnectionId>, Vec<UserId>)> {
|
) -> Result<(MessageId, Vec<ConnectionId>, Vec<UserId>)> {
|
||||||
self.transaction(|tx| async move {
|
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()
|
let mut rows = channel_chat_participant::Entity::find()
|
||||||
.filter(channel_chat_participant::Column::ChannelId.eq(channel_id))
|
.filter(channel_chat_participant::Column::ChannelId.eq(channel_id))
|
||||||
.stream(&*tx)
|
.stream(&*tx)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue