mirror of
https://github.com/AppFlowy-IO/AppFlowy.git
synced 2024-08-30 18:12:39 +00:00
feat: wip
This commit is contained in:
parent
fbf4662c6c
commit
0b4b7519d0
@ -13,6 +13,8 @@ use crate::event_builder::EventBuilder;
|
|||||||
use crate::EventIntegrationTest;
|
use crate::EventIntegrationTest;
|
||||||
|
|
||||||
impl EventIntegrationTest {
|
impl EventIntegrationTest {
|
||||||
|
|
||||||
|
// Deprecated, use invite instead
|
||||||
pub async fn add_workspace_member(&self, workspace_id: &str, email: &str) {
|
pub async fn add_workspace_member(&self, workspace_id: &str, email: &str) {
|
||||||
EventBuilder::new(self.clone())
|
EventBuilder::new(self.clone())
|
||||||
.event(UserEvent::AddWorkspaceMember)
|
.event(UserEvent::AddWorkspaceMember)
|
||||||
@ -24,6 +26,18 @@ impl EventIntegrationTest {
|
|||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated, use invite instead
|
||||||
|
pub async fn invite_workspace_member(&self, workspace_id: &str, email: &str) {
|
||||||
|
EventBuilder::new(self.clone())
|
||||||
|
.event(UserEvent::InviteWorkspaceMembers)
|
||||||
|
.payload(AddWorkspaceMemberPB {
|
||||||
|
workspace_id: workspace_id.to_string(),
|
||||||
|
email: email.to_string(),
|
||||||
|
})
|
||||||
|
.async_send()
|
||||||
|
.await;
|
||||||
|
}
|
||||||
|
|
||||||
pub async fn delete_workspace_member(&self, workspace_id: &str, email: &str) {
|
pub async fn delete_workspace_member(&self, workspace_id: &str, email: &str) {
|
||||||
EventBuilder::new(self.clone())
|
EventBuilder::new(self.clone())
|
||||||
.event(UserEvent::RemoveWorkspaceMember)
|
.event(UserEvent::RemoveWorkspaceMember)
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
use event_integration::user_event::user_localhost_af_cloud;
|
use event_integration::user_event::user_localhost_af_cloud;
|
||||||
use event_integration::EventIntegrationTest;
|
use event_integration::EventIntegrationTest;
|
||||||
|
|
||||||
|
// Deprecated, use invite instead
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn af_cloud_add_workspace_member_test() {
|
async fn af_cloud_add_workspace_member_test() {
|
||||||
user_localhost_af_cloud().await;
|
user_localhost_af_cloud().await;
|
||||||
@ -14,6 +15,8 @@ async fn af_cloud_add_workspace_member_test() {
|
|||||||
assert_eq!(members.len(), 1);
|
assert_eq!(members.len(), 1);
|
||||||
assert_eq!(members[0].email, user_1.email);
|
assert_eq!(members[0].email, user_1.email);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
test_1
|
test_1
|
||||||
.add_workspace_member(&user_1.workspace_id, &user_2.email)
|
.add_workspace_member(&user_1.workspace_id, &user_2.email)
|
||||||
.await;
|
.await;
|
||||||
@ -24,6 +27,7 @@ async fn af_cloud_add_workspace_member_test() {
|
|||||||
assert_eq!(members[1].email, user_2.email);
|
assert_eq!(members[1].email, user_2.email);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated, use invite instead
|
||||||
#[tokio::test]
|
#[tokio::test]
|
||||||
async fn af_cloud_delete_workspace_member_test() {
|
async fn af_cloud_delete_workspace_member_test() {
|
||||||
user_localhost_af_cloud().await;
|
user_localhost_af_cloud().await;
|
||||||
|
@ -181,7 +181,7 @@ where
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
// Deprecated
|
// Deprecated, use invite instead
|
||||||
fn add_workspace_member(
|
fn add_workspace_member(
|
||||||
&self,
|
&self,
|
||||||
user_email: String,
|
user_email: String,
|
||||||
|
@ -607,6 +607,7 @@ pub async fn update_reminder_event_handler(
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Deprecated, use invite instead
|
||||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||||
pub async fn add_workspace_member_handler(
|
pub async fn add_workspace_member_handler(
|
||||||
data: AFPluginData<AddWorkspaceMemberPB>,
|
data: AFPluginData<AddWorkspaceMemberPB>,
|
||||||
@ -711,14 +712,14 @@ pub async fn change_workspace_icon_handler(
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||||
pub async fn invite_members_to_workspace_handler(
|
pub async fn invite_workspace_members_handler(
|
||||||
param: AFPluginData<WorkspaceMemberInvitationPB>,
|
param: AFPluginData<WorkspaceMemberInvitationPB>,
|
||||||
manager: AFPluginState<Weak<UserManager>>,
|
manager: AFPluginState<Weak<UserManager>>,
|
||||||
) -> Result<(), FlowyError> {
|
) -> Result<(), FlowyError> {
|
||||||
let param = param.try_into_inner()?;
|
let param = param.try_into_inner()?;
|
||||||
let manager = upgrade_manager(manager)?;
|
let manager = upgrade_manager(manager)?;
|
||||||
manager
|
manager
|
||||||
.invite_member_to_workspace(param.workspace_id, param.invitee_email, param.role.into())
|
.invite_workspace_members(param.workspace_id, param.invitee_email, param.role.into())
|
||||||
.await?;
|
.await?;
|
||||||
|
|
||||||
todo!()
|
todo!()
|
||||||
|
@ -67,7 +67,7 @@ pub fn init(user_manager: Weak<UserManager>) -> AFPlugin {
|
|||||||
.event(UserEvent::RenameWorkspace, rename_workspace_handler)
|
.event(UserEvent::RenameWorkspace, rename_workspace_handler)
|
||||||
.event(UserEvent::ChangeWorkspaceIcon, change_workspace_icon_handler)
|
.event(UserEvent::ChangeWorkspaceIcon, change_workspace_icon_handler)
|
||||||
|
|
||||||
.event(UserEvent::InviteMembersToWorkspace, invite_members_to_workspace_handler)
|
.event(UserEvent::InviteWorkspaceMembers, invite_workspace_members_handler)
|
||||||
.event(UserEvent::ListWorkspaceInvitations, list_workspace_invitations_handler)
|
.event(UserEvent::ListWorkspaceInvitations, list_workspace_invitations_handler)
|
||||||
.event(UserEvent::AcceptWorkspaceInvitation, accept_workspace_invitations_handler)
|
.event(UserEvent::AcceptWorkspaceInvitation, accept_workspace_invitations_handler)
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ pub enum UserEvent {
|
|||||||
ChangeWorkspaceIcon = 45,
|
ChangeWorkspaceIcon = 45,
|
||||||
|
|
||||||
#[event(input = "WorkspaceMemberInvitationPB")]
|
#[event(input = "WorkspaceMemberInvitationPB")]
|
||||||
InviteMembersToWorkspace = 46,
|
InviteWorkspaceMembers = 46,
|
||||||
|
|
||||||
#[event(output = "RepeatedWorkspaceInvitationPB")]
|
#[event(output = "RepeatedWorkspaceInvitationPB")]
|
||||||
ListWorkspaceInvitations = 47,
|
ListWorkspaceInvitations = 47,
|
||||||
|
@ -196,7 +196,7 @@ impl UserManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
pub async fn invite_member_to_workspace(
|
pub async fn invite_workspace_members(
|
||||||
&self,
|
&self,
|
||||||
workspace_id: String,
|
workspace_id: String,
|
||||||
invitee_email: String,
|
invitee_email: String,
|
||||||
@ -229,7 +229,7 @@ impl UserManager {
|
|||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
// deprecated, use invite instead
|
// Deprecated, use invite instead
|
||||||
pub async fn add_workspace_member(
|
pub async fn add_workspace_member(
|
||||||
&self,
|
&self,
|
||||||
user_email: String,
|
user_email: String,
|
||||||
|
Loading…
Reference in New Issue
Block a user