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;
|
||||
|
||||
impl EventIntegrationTest {
|
||||
|
||||
// Deprecated, use invite instead
|
||||
pub async fn add_workspace_member(&self, workspace_id: &str, email: &str) {
|
||||
EventBuilder::new(self.clone())
|
||||
.event(UserEvent::AddWorkspaceMember)
|
||||
@ -24,6 +26,18 @@ impl EventIntegrationTest {
|
||||
.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) {
|
||||
EventBuilder::new(self.clone())
|
||||
.event(UserEvent::RemoveWorkspaceMember)
|
||||
|
@ -1,6 +1,7 @@
|
||||
use event_integration::user_event::user_localhost_af_cloud;
|
||||
use event_integration::EventIntegrationTest;
|
||||
|
||||
// Deprecated, use invite instead
|
||||
#[tokio::test]
|
||||
async fn af_cloud_add_workspace_member_test() {
|
||||
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[0].email, user_1.email);
|
||||
|
||||
|
||||
|
||||
test_1
|
||||
.add_workspace_member(&user_1.workspace_id, &user_2.email)
|
||||
.await;
|
||||
@ -24,6 +27,7 @@ async fn af_cloud_add_workspace_member_test() {
|
||||
assert_eq!(members[1].email, user_2.email);
|
||||
}
|
||||
|
||||
// Deprecated, use invite instead
|
||||
#[tokio::test]
|
||||
async fn af_cloud_delete_workspace_member_test() {
|
||||
user_localhost_af_cloud().await;
|
||||
|
@ -181,7 +181,7 @@ where
|
||||
})
|
||||
}
|
||||
|
||||
// Deprecated
|
||||
// Deprecated, use invite instead
|
||||
fn add_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
|
@ -607,6 +607,7 @@ pub async fn update_reminder_event_handler(
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// Deprecated, use invite instead
|
||||
#[tracing::instrument(level = "debug", skip_all, err)]
|
||||
pub async fn add_workspace_member_handler(
|
||||
data: AFPluginData<AddWorkspaceMemberPB>,
|
||||
@ -711,14 +712,14 @@ pub async fn change_workspace_icon_handler(
|
||||
}
|
||||
|
||||
#[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>,
|
||||
manager: AFPluginState<Weak<UserManager>>,
|
||||
) -> Result<(), FlowyError> {
|
||||
let param = param.try_into_inner()?;
|
||||
let manager = upgrade_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?;
|
||||
|
||||
todo!()
|
||||
|
@ -67,7 +67,7 @@ pub fn init(user_manager: Weak<UserManager>) -> AFPlugin {
|
||||
.event(UserEvent::RenameWorkspace, rename_workspace_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::AcceptWorkspaceInvitation, accept_workspace_invitations_handler)
|
||||
}
|
||||
@ -216,7 +216,7 @@ pub enum UserEvent {
|
||||
ChangeWorkspaceIcon = 45,
|
||||
|
||||
#[event(input = "WorkspaceMemberInvitationPB")]
|
||||
InviteMembersToWorkspace = 46,
|
||||
InviteWorkspaceMembers = 46,
|
||||
|
||||
#[event(output = "RepeatedWorkspaceInvitationPB")]
|
||||
ListWorkspaceInvitations = 47,
|
||||
|
@ -196,7 +196,7 @@ impl UserManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
pub async fn invite_member_to_workspace(
|
||||
pub async fn invite_workspace_members(
|
||||
&self,
|
||||
workspace_id: String,
|
||||
invitee_email: String,
|
||||
@ -229,7 +229,7 @@ impl UserManager {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// deprecated, use invite instead
|
||||
// Deprecated, use invite instead
|
||||
pub async fn add_workspace_member(
|
||||
&self,
|
||||
user_email: String,
|
||||
|
Loading…
Reference in New Issue
Block a user