refactor: move and update fixme / todo comments

This commit is contained in:
Paul Makles
2023-10-28 14:53:39 +01:00
parent 9bf60e87e9
commit 196a856c68
14 changed files with 19 additions and 25 deletions

View File

@@ -243,8 +243,7 @@ impl EventV1 {
pub async fn p_user(self, id: String, db: &Database) { pub async fn p_user(self, id: String, db: &Database) {
self.clone().p(id.clone()).await; self.clone().p(id.clone()).await;
// ! FIXME: this should be captured by member list in the future // TODO: this should be captured by member list in the future and not immediately fanned out to users
// ! and not immediately fanned out to users
if let Ok(members) = db.fetch_all_memberships(&id).await { if let Ok(members) = db.fetch_all_memberships(&id).await {
for member in members { for member in members {
self.clone().p(member.id.server).await; self.clone().p(member.id.server).await;

View File

@@ -60,7 +60,7 @@ impl AbstractMessages for ReferenceDb {
.cloned() .cloned()
.collect(); .collect();
// TODO: sorting, etc (will be required for tests) // FIXME: sorting, etc (will be required for tests)
Ok(matched_messages) Ok(matched_messages)

View File

@@ -23,7 +23,7 @@ auto_derived_partial!(
pub description: Option<String>, pub description: Option<String>,
/// Channels within this server /// Channels within this server
// ! FIXME: this may be redundant // TODO: investigate if this is redundant and can be removed
pub channels: Vec<String>, pub channels: Vec<String>,
/// Categories for this server /// Categories for this server
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@@ -132,7 +132,7 @@ pub async fn generate(
return Err(create_error!(LabelMe)); return Err(create_error!(LabelMe));
} }
// ! FIXME: batch request to january // TODO: batch request to january
let mut tasks = Vec::new(); let mut tasks = Vec::new();
for link in links { for link in links {

View File

@@ -22,7 +22,7 @@ auto_derived_partial!(
pub description: Option<String>, pub description: Option<String>,
/// Channels within this server /// Channels within this server
// ! FIXME: this may be redundant // TODO: investigate if this is redundant and can be removed
pub channels: Vec<String>, pub channels: Vec<String>,
/// Categories for this server /// Categories for this server
#[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))] #[cfg_attr(feature = "serde", serde(skip_serializing_if = "Option::is_none"))]

View File

@@ -37,6 +37,12 @@ pub async fn calculate_user_permissions<P: PermissionQuery>(query: &mut P) -> Pe
} else { } else {
permissions.into() 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 /// Calculate permissions against a server

View File

@@ -31,8 +31,7 @@ pub async fn req(
match &channel { match &channel {
Channel::Group { .. } => { Channel::Group { .. } => {
// FIXME: use permissions here? // TODO: use permissions here? interesting if users could block new group invites
// interesting if users could block new group invites
let member = member_id.as_user(db).await?; let member = member_id.as_user(db).await?;
if !user.is_friends_with(&member.id) { if !user.is_friends_with(&member.id) {
return Err(create_error!(NotFriends)); return Err(create_error!(NotFriends));

View File

@@ -148,7 +148,7 @@ mod test {
.await; .await;
dbg!(response.into_string().await); dbg!(response.into_string().await);
// TODO: finish impl // FIXME: finish impl
// assert_eq!(response.status(), Status::NotFound); // assert_eq!(response.status(), Status::NotFound);
} }
@@ -185,6 +185,6 @@ mod test {
.dispatch() .dispatch()
.await; .await;
// TODO: impl assert_eq!(response.status(), Status::Forbidden); // FIXME: impl assert_eq!(response.status(), Status::Forbidden);
} }
} }

View File

@@ -568,8 +568,7 @@ impl EventV1 {
pub async fn p_user(self, id: String, db: &Database) { pub async fn p_user(self, id: String, db: &Database) {
self.clone().p(id.clone()).await; self.clone().p(id.clone()).await;
// ! FIXME: this should be captured by member list in the future // TODO: this should be captured by member list in the future and not immediately fanned out to users
// ! and not immediately fanned out to users
if let Ok(members) = db.fetch_all_memberships(&id).await { if let Ok(members) = db.fetch_all_memberships(&id).await {
for member in members { for member in members {
self.clone().p(member.id.server).await; self.clone().p(member.id.server).await;

View File

@@ -170,7 +170,8 @@ impl User {
/// Check if this user can acquire another server /// Check if this user can acquire another server
pub async fn can_acquire_server(&self, db: &Database) -> Result<bool> { 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) Ok(db.fetch_server_count(&self.id).await? <= 100)
} }

View File

@@ -93,7 +93,6 @@ pub struct Server {
pub description: Option<String>, pub description: Option<String>,
/// Channels within this server /// Channels within this server
// ! FIXME: this may be redundant
pub channels: Vec<String>, pub channels: Vec<String>,
/// Categories for this server /// Categories for this server
#[serde(skip_serializing_if = "Option::is_none")] #[serde(skip_serializing_if = "Option::is_none")]

View File

@@ -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 if data.flag_has_mutual_connection
|| data || data
.perspective .perspective

View File

@@ -43,7 +43,7 @@ pub trait AbstractChannel: Sync + Send {
async fn remove_user_from_group(&self, channel: &str, user: &str) -> Result<()>; async fn remove_user_from_group(&self, channel: &str, user: &str) -> Result<()>;
/// Set role permission for a channel /// 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( async fn set_channel_role_permission(
&self, &self,
channel: &str, channel: &str,

View File

@@ -2,10 +2,10 @@ use async_lock::Semaphore;
use async_std::task::spawn; use async_std::task::spawn;
use futures::future::join_all; use futures::future::join_all;
use linkify::{LinkFinder, LinkKind}; use linkify::{LinkFinder, LinkKind};
use once_cell::sync::Lazy;
use regex::Regex; use regex::Regex;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
use std::{collections::HashSet, sync::Arc}; use std::{collections::HashSet, sync::Arc};
use once_cell::sync::Lazy;
use crate::{models::attachment::File, Error, Result}; use crate::{models::attachment::File, Error, Result};
@@ -187,8 +187,6 @@ impl Embed {
max_embeds: usize, max_embeds: usize,
semaphore: Arc<Semaphore>, semaphore: Arc<Semaphore>,
) -> Result<Vec<Embed>> { ) -> Result<Vec<Embed>> {
// Ignore code blocks. // Ignore code blocks.
let content = RE_CODE.replace_all(&content, ""); let content = RE_CODE.replace_all(&content, "");
@@ -233,7 +231,6 @@ impl Embed {
return Err(Error::LabelMe); return Err(Error::LabelMe);
} }
// ! FIXME: batch request to january?
let client = reqwest::Client::new(); let client = reqwest::Client::new();
let mut tasks = Vec::new(); let mut tasks = Vec::new();