]> Untitled Git - lemmy.git/blobdiff - crates/websocket/src/lib.rs
Removing the site creator, adding leave_admin. Fixes #1808 (#2052)
[lemmy.git] / crates / websocket / src / lib.rs
index e9f48874124155294d759335fa3ba40ce8431f5d..324562180b0854d9ff897a5ce5ece6f8de0e1219 100644 (file)
@@ -4,10 +4,9 @@ extern crate strum_macros;
 use crate::chat_server::ChatServer;
 use actix::Addr;
 use background_jobs::QueueHandle;
-use lemmy_db_queries::DbPool;
-use lemmy_db_schema::source::secret::Secret;
+use lemmy_db_schema::{source::secret::Secret, DbPool};
 use lemmy_utils::{settings::structs::Settings, LemmyError};
-use reqwest::Client;
+use reqwest_middleware::ClientWithMiddleware;
 use serde::Serialize;
 
 pub mod chat_server;
@@ -17,19 +16,19 @@ pub mod routes;
 pub mod send;
 
 pub struct LemmyContext {
-  pub pool: DbPool,
-  pub chat_server: Addr<ChatServer>,
-  pub client: Client,
-  pub activity_queue: QueueHandle,
-  pub settings: Settings,
-  pub secret: Secret,
+  pool: DbPool,
+  chat_server: Addr<ChatServer>,
+  client: ClientWithMiddleware,
+  activity_queue: QueueHandle,
+  settings: Settings,
+  secret: Secret,
 }
 
 impl LemmyContext {
   pub fn create(
     pool: DbPool,
     chat_server: Addr<ChatServer>,
-    client: Client,
+    client: ClientWithMiddleware,
     activity_queue: QueueHandle,
     settings: Settings,
     secret: Secret,
@@ -49,7 +48,7 @@ impl LemmyContext {
   pub fn chat_server(&self) -> &Addr<ChatServer> {
     &self.chat_server
   }
-  pub fn client(&self) -> &Client {
+  pub fn client(&self) -> &ClientWithMiddleware {
     &self.client
   }
   pub fn activity_queue(&self) -> &QueueHandle {
@@ -98,7 +97,7 @@ where
   Ok(serde_json::to_string(&response)?)
 }
 
-#[derive(EnumString, ToString, Debug, Clone)]
+#[derive(EnumString, Display, Debug, Clone)]
 pub enum UserOperation {
   Login,
   GetCaptcha,
@@ -111,12 +110,14 @@ pub enum UserOperation {
   CreatePostLike,
   LockPost,
   StickyPost,
+  MarkPostAsRead,
   SavePost,
   CreatePostReport,
   ResolvePostReport,
   ListPostReports,
   GetReportCount,
   GetUnreadCount,
+  VerifyEmail,
   FollowCommunity,
   GetReplies,
   GetPersonMentions,
@@ -125,13 +126,17 @@ pub enum UserOperation {
   BanFromCommunity,
   AddModToCommunity,
   AddAdmin,
+  GetUnreadRegistrationApplicationCount,
+  ListRegistrationApplications,
+  ApproveRegistrationApplication,
   BanPerson,
+  GetBannedPersons,
   Search,
   ResolveObject,
   MarkAllAsRead,
   SaveUserSettings,
   TransferCommunity,
-  TransferSite,
+  LeaveAdmin,
   PasswordReset,
   PasswordChange,
   MarkPrivateMessageAsRead,
@@ -147,7 +152,7 @@ pub enum UserOperation {
   BlockPerson,
 }
 
-#[derive(EnumString, ToString, Debug, Clone)]
+#[derive(EnumString, Display, Debug, Clone)]
 pub enum UserOperationCrud {
   // Site
   CreateSite,
@@ -169,6 +174,7 @@ pub enum UserOperationCrud {
   RemovePost,
   // Comment
   CreateComment,
+  GetComment,
   GetComments,
   EditComment,
   DeleteComment,