Skip to content

Commit

Permalink
refactor: move and update fixme / todo comments
Browse files Browse the repository at this point in the history
  • Loading branch information
insertish committed Oct 28, 2023
1 parent 9bf60e8 commit 196a856
Show file tree
Hide file tree
Showing 14 changed files with 19 additions and 25 deletions.
3 changes: 1 addition & 2 deletions crates/core/database/src/events/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,7 @@ impl EventV1 {
pub async fn p_user(self, id: String, db: &Database) {
self.clone().p(id.clone()).await;

// ! FIXME: this should be captured by member list in the future
// ! and not immediately fanned out to users
// TODO: this should be captured by member list in the future and not immediately fanned out to users
if let Ok(members) = db.fetch_all_memberships(&id).await {
for member in members {
self.clone().p(member.id.server).await;
Expand Down
2 changes: 1 addition & 1 deletion crates/core/database/src/models/messages/ops/reference.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ impl AbstractMessages for ReferenceDb {
.cloned()
.collect();

// TODO: sorting, etc (will be required for tests)
// FIXME: sorting, etc (will be required for tests)

Ok(matched_messages)

Expand Down
2 changes: 1 addition & 1 deletion crates/core/database/src/models/servers/model.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ auto_derived_partial!(
pub description: Option<String>,

/// Channels within this server
// ! FIXME: this may be redundant
// TODO: investigate if this is redundant and can be removed
pub channels: Vec<String>,
/// Categories for this server
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
2 changes: 1 addition & 1 deletion crates/core/database/src/tasks/process_embeds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ pub async fn generate(
return Err(create_error!(LabelMe));
}

// ! FIXME: batch request to january
// TODO: batch request to january
let mut tasks = Vec::new();

for link in links {
Expand Down
2 changes: 1 addition & 1 deletion crates/core/models/src/v0/servers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ auto_derived_partial!(
pub description: Option<String>,

/// Channels within this server
// ! FIXME: this may be redundant
// TODO: investigate if this is redundant and can be removed
pub channels: Vec<String>,
/// Categories for this server
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]
Expand Down
6 changes: 6 additions & 0 deletions crates/core/permissions/src/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,12 @@ pub async fn calculate_user_permissions<P: PermissionQuery>(query: &mut P) -> Pe
} else {
permissions.into()
}

// TODO: add boolean switch for permission for users to globally message a user
// maybe an enum?
// PrivacyLevel { Private, Friends, Mutual, Public, Global }

// TODO: add boolean switch for permission for users to mutually DM a user
}

/// Calculate permissions against a server
Expand Down
3 changes: 1 addition & 2 deletions crates/delta/src/routes/channels/group_add_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ pub async fn req(

match &channel {
Channel::Group { .. } => {
// FIXME: use permissions here?
// interesting if users could block new group invites
// TODO: use permissions here? interesting if users could block new group invites
let member = member_id.as_user(db).await?;
if !user.is_friends_with(&member.id) {
return Err(create_error!(NotFriends));
Expand Down
4 changes: 2 additions & 2 deletions crates/delta/src/routes/channels/group_remove_member.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ mod test {
.await;

dbg!(response.into_string().await);
// TODO: finish impl
// FIXME: finish impl
// assert_eq!(response.status(), Status::NotFound);
}

Expand Down Expand Up @@ -185,6 +185,6 @@ mod test {
.dispatch()
.await;

// TODO: impl assert_eq!(response.status(), Status::Forbidden);
// FIXME: impl assert_eq!(response.status(), Status::Forbidden);
}
}
3 changes: 1 addition & 2 deletions crates/quark/src/events/impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -568,8 +568,7 @@ impl EventV1 {
pub async fn p_user(self, id: String, db: &Database) {
self.clone().p(id.clone()).await;

// ! FIXME: this should be captured by member list in the future
// ! and not immediately fanned out to users
// TODO: this should be captured by member list in the future and not immediately fanned out to users
if let Ok(members) = db.fetch_all_memberships(&id).await {
for member in members {
self.clone().p(member.id.server).await;
Expand Down
3 changes: 2 additions & 1 deletion crates/quark/src/impl/generic/users/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,8 @@ impl User {

/// Check if this user can acquire another server
pub async fn can_acquire_server(&self, db: &Database) -> Result<bool> {
// ! FIXME: hardcoded max server count
// hardcoded max server count
// NB. fixed in new crate
Ok(db.fetch_server_count(&self.id).await? <= 100)
}

Expand Down
1 change: 0 additions & 1 deletion crates/quark/src/models/servers/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ pub struct Server {
pub description: Option<String>,

/// Channels within this server
// ! FIXME: this may be redundant
pub channels: Vec<String>,
/// Categories for this server
#[serde(skip_serializing_if = "Option::is_none")]
Expand Down
6 changes: 0 additions & 6 deletions crates/quark/src/permissions/impl/user.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,6 @@ async fn calculate_permission(data: &mut PermissionCalculator<'_>, db: &crate::D
_ => {}
}

// ! FIXME: add boolean switch for permission for users to globally message a user
// maybe an enum?
// PrivacyLevel { Private, Friends, Mutual, Public, Global }

// ! FIXME: add boolean switch for permission for users to mutually DM a user

if data.flag_has_mutual_connection
|| data
.perspective
Expand Down
2 changes: 1 addition & 1 deletion crates/quark/src/traits/channels/channel.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ pub trait AbstractChannel: Sync + Send {
async fn remove_user_from_group(&self, channel: &str, user: &str) -> Result<()>;

/// Set role permission for a channel
/// ! FIXME: may want to refactor to just use normal updates
/// TODO: may want to refactor to just use normal updates
async fn set_channel_role_permission(
&self,
channel: &str,
Expand Down
5 changes: 1 addition & 4 deletions crates/quark/src/types/january.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ use async_lock::Semaphore;
use async_std::task::spawn;
use futures::future::join_all;
use linkify::{LinkFinder, LinkKind};
use once_cell::sync::Lazy;
use regex::Regex;
use serde::{Deserialize, Serialize};
use std::{collections::HashSet, sync::Arc};
use once_cell::sync::Lazy;

use crate::{models::attachment::File, Error, Result};

Expand Down Expand Up @@ -187,8 +187,6 @@ impl Embed {
max_embeds: usize,
semaphore: Arc<Semaphore>,
) -> Result<Vec<Embed>> {


// Ignore code blocks.
let content = RE_CODE.replace_all(&content, "");

Expand Down Expand Up @@ -233,7 +231,6 @@ impl Embed {
return Err(Error::LabelMe);
}

// ! FIXME: batch request to january?
let client = reqwest::Client::new();

let mut tasks = Vec::new();
Expand Down

0 comments on commit 196a856

Please sign in to comment.