forked from jmug/stoatchat
Remove old notif code; uncommited changes.
This commit is contained in:
@@ -3,10 +3,6 @@ use crate::database::{
|
||||
self, channel::Channel, get_relationship, get_relationship_internal, message::Message,
|
||||
user::User, Permission, PermissionCalculator, Relationship,
|
||||
};
|
||||
use crate::notifications::{
|
||||
self,
|
||||
events::{groups::*, guilds::ChannelDelete, message::*, Notification},
|
||||
};
|
||||
use crate::util::vec_to_set;
|
||||
|
||||
use chrono::prelude::*;
|
||||
@@ -180,13 +176,13 @@ pub fn add_member(user: User, target: Channel, member: User) -> Option<Response>
|
||||
})
|
||||
.send(&target)
|
||||
{
|
||||
notifications::send_message_given_channel(
|
||||
/*notifications::send_message_given_channel(
|
||||
Notification::group_user_join(UserJoin {
|
||||
id: target.id.clone(),
|
||||
user: member.id.clone(),
|
||||
}),
|
||||
&target,
|
||||
);
|
||||
&target, FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
@@ -255,13 +251,13 @@ pub fn remove_member(user: User, target: Channel, member: User) -> Option<Respon
|
||||
})
|
||||
.send(&target)
|
||||
{
|
||||
notifications::send_message_given_channel(
|
||||
/*notifications::send_message_given_channel(
|
||||
Notification::group_user_leave(UserLeave {
|
||||
id: target.id.clone(),
|
||||
user: member.id.clone(),
|
||||
}),
|
||||
&target,
|
||||
);
|
||||
&target, FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
@@ -373,13 +369,13 @@ pub fn delete(user: User, target: Channel) -> Option<Response> {
|
||||
})
|
||||
.send(&target)
|
||||
{
|
||||
notifications::send_message_given_channel(
|
||||
/*notifications::send_message_given_channel(
|
||||
Notification::group_user_leave(UserLeave {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
}),
|
||||
&target,
|
||||
);
|
||||
&target, FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
@@ -411,14 +407,14 @@ pub fn delete(user: User, target: Channel) -> Option<Response> {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
guild_id.clone(),
|
||||
Notification::guild_channel_delete(ChannelDelete {
|
||||
id: guild_id.clone(),
|
||||
channel: target.id.clone(),
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
try_delete()
|
||||
} else {
|
||||
@@ -630,15 +626,15 @@ pub fn edit_message(
|
||||
None,
|
||||
) {
|
||||
Ok(_) => {
|
||||
notifications::send_message_given_channel(
|
||||
/*notifications::send_message_given_channel(
|
||||
Notification::message_edit(Edit {
|
||||
id: message.id.clone(),
|
||||
channel: target.id.clone(),
|
||||
author: message.author.clone(),
|
||||
content: edit.content.clone(),
|
||||
}),
|
||||
&target,
|
||||
);
|
||||
&target, FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
}
|
||||
@@ -661,12 +657,12 @@ pub fn delete_message(user: User, target: Channel, message: Message) -> Option<R
|
||||
|
||||
match col.delete_one(doc! { "_id": &message.id }, None) {
|
||||
Ok(_) => {
|
||||
notifications::send_message_given_channel(
|
||||
/*notifications::send_message_given_channel(
|
||||
Notification::message_delete(Delete {
|
||||
id: message.id.clone(),
|
||||
}),
|
||||
&target,
|
||||
);
|
||||
&target, FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
}
|
||||
|
||||
@@ -5,10 +5,6 @@ use crate::database::{
|
||||
self, channel::fetch_channel, channel::Channel, guild::serialise_guilds_with_channels,
|
||||
user::User, Permission, PermissionCalculator,
|
||||
};
|
||||
use crate::notifications::{
|
||||
self,
|
||||
events::{guilds::*, Notification},
|
||||
};
|
||||
use crate::util::gen_token;
|
||||
|
||||
use mongodb::bson::{doc, Bson};
|
||||
@@ -122,13 +118,13 @@ pub fn remove_guild(user: User, target: Guild) -> Option<Response> {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
target.id.clone(),
|
||||
Notification::guild_delete(Delete {
|
||||
id: target.id.clone(),
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
@@ -166,15 +162,15 @@ pub fn remove_guild(user: User, target: Guild) -> Option<Response> {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
target.id.clone(),
|
||||
Notification::guild_user_leave(UserLeave {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
banned: false,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
@@ -248,7 +244,7 @@ pub fn create_channel(user: User, target: Guild, info: Json<CreateChannel>) -> O
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
target.id.clone(),
|
||||
Notification::guild_channel_create(ChannelCreate {
|
||||
@@ -256,8 +252,8 @@ pub fn create_channel(user: User, target: Guild, info: Json<CreateChannel>) -> O
|
||||
channel: id.clone(),
|
||||
name: name.clone(),
|
||||
description: description.clone(),
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Success(json!({ "id": &id })))
|
||||
} else {
|
||||
@@ -426,14 +422,14 @@ pub fn use_invite(user: User, code: String) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
guild_id.clone(),
|
||||
Notification::guild_user_join(UserJoin {
|
||||
id: guild_id.clone(),
|
||||
user: user.id.clone(),
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({
|
||||
"guild": &guild_id,
|
||||
@@ -642,15 +638,15 @@ pub fn kick_member(user: User, target: Guild, other: String) -> Option<Response>
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
target.id.clone(),
|
||||
Notification::guild_user_leave(UserLeave {
|
||||
id: target.id.clone(),
|
||||
user: other.clone(),
|
||||
banned: false,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
@@ -734,15 +730,15 @@ pub fn ban_member(
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
None,
|
||||
target.id.clone(),
|
||||
Notification::guild_user_leave(UserLeave {
|
||||
id: target.id.clone(),
|
||||
user: other.clone(),
|
||||
banned: true,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Some(Response::Result(super::Status::Ok))
|
||||
} else {
|
||||
|
||||
@@ -2,10 +2,6 @@ use super::Response;
|
||||
use crate::database::{
|
||||
self, get_relationship, get_relationship_internal, user::User, Relationship,
|
||||
};
|
||||
use crate::notifications::{
|
||||
self,
|
||||
events::{users::*, Notification},
|
||||
};
|
||||
use crate::routes::channel;
|
||||
|
||||
use mongodb::bson::doc;
|
||||
@@ -251,7 +247,7 @@ pub fn add_friend(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![target.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
@@ -268,8 +264,8 @@ pub fn add_friend(user: User, target: User) -> Response {
|
||||
id: user.id.clone(),
|
||||
user: target.id.clone(),
|
||||
status: Relationship::Friend as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::Friend as i32 }))
|
||||
} else {
|
||||
@@ -324,7 +320,7 @@ pub fn add_friend(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
@@ -341,8 +337,8 @@ pub fn add_friend(user: User, target: User) -> Response {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
status: Relationship::Incoming as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::Outgoing as i32 }))
|
||||
} else {
|
||||
@@ -401,7 +397,7 @@ pub fn remove_friend(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
@@ -418,8 +414,8 @@ pub fn remove_friend(user: User, target: User) -> Response {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
status: Relationship::NONE as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::NONE as i32 }))
|
||||
} else {
|
||||
@@ -477,7 +473,7 @@ pub fn block_user(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
@@ -494,8 +490,8 @@ pub fn block_user(user: User, target: User) -> Response {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
status: Relationship::BlockedOther as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::Blocked as i32 }))
|
||||
} else {
|
||||
@@ -545,7 +541,7 @@ pub fn block_user(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
@@ -562,8 +558,8 @@ pub fn block_user(user: User, target: User) -> Response {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
status: Relationship::BlockedOther as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::Blocked as i32 }))
|
||||
} else {
|
||||
@@ -596,15 +592,15 @@ pub fn block_user(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
id: user.id.clone(),
|
||||
user: target.id.clone(),
|
||||
status: Relationship::Blocked as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::Blocked as i32 }))
|
||||
} else {
|
||||
@@ -640,15 +636,15 @@ pub fn unblock_user(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
id: user.id.clone(),
|
||||
user: target.id.clone(),
|
||||
status: Relationship::BlockedOther as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::BlockedOther as i32 }))
|
||||
} else {
|
||||
@@ -690,7 +686,7 @@ pub fn unblock_user(user: User, target: User) -> Response {
|
||||
)
|
||||
.is_ok()
|
||||
{
|
||||
notifications::send_message_threaded(
|
||||
/*notifications::send_message_threaded(
|
||||
vec![user.id.clone()],
|
||||
None,
|
||||
Notification::user_friend_status(FriendStatus {
|
||||
@@ -707,8 +703,8 @@ pub fn unblock_user(user: User, target: User) -> Response {
|
||||
id: target.id.clone(),
|
||||
user: user.id.clone(),
|
||||
status: Relationship::NONE as i32,
|
||||
}),
|
||||
);
|
||||
}), FIXME
|
||||
);*/
|
||||
|
||||
Response::Success(json!({ "status": Relationship::NONE as i32 }))
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user