Fix: Use channel_invites collection name instead of invites.

Was conflicting with invite-only rauth registrations.
This commit is contained in:
Paul
2021-06-12 10:33:31 +01:00
parent 9be9b76035
commit 6b8158bf54
9 changed files with 15 additions and 15 deletions

View File

@@ -116,7 +116,7 @@ impl Channel {
let messages = get_collection("messages");
// Delete any invites.
get_collection("invites")
get_collection("channel_invites")
.delete_many(
doc! {
"channel": id
@@ -126,7 +126,7 @@ impl Channel {
.await
.map_err(|_| Error::DatabaseError {
operation: "delete_many",
with: "invites",
with: "channel_invites",
})?;
// Check if there are any attachments we need to delete.

View File

@@ -44,7 +44,7 @@ impl Invite {
}
pub async fn get(code: &str) -> Result<Invite> {
let doc = get_collection("invites")
let doc = get_collection("channel_invites")
.find_one(doc! { "_id": code }, None)
.await
.map_err(|_| Error::DatabaseError {
@@ -60,7 +60,7 @@ impl Invite {
}
pub async fn save(self) -> Result<()> {
get_collection("invites")
get_collection("channel_invites")
.insert_one(
to_document(&self).map_err(|_| Error::DatabaseError {
operation: "to_bson",
@@ -78,7 +78,7 @@ impl Invite {
}
pub async fn delete(&self) -> Result<()> {
get_collection("invites")
get_collection("channel_invites")
.delete_one(
doc! {
"_id": self.code()

View File

@@ -165,7 +165,7 @@ impl Server {
})?;
// Delete all channels, members, bans and invites.
for with in &["channels", "invites"] {
for with in &["channels", "channel_invites"] {
get_collection(with)
.delete_many(
doc! {