setOpenConfirmDialog(true)}
>
diff --git a/src/containers/Organization/Video/components/VideoName.jsx b/src/containers/Organization/Video/components/VideoName.jsx
index 6e6685be..d506a336 100644
--- a/src/containers/Organization/Video/components/VideoName.jsx
+++ b/src/containers/Organization/Video/components/VideoName.jsx
@@ -1,4 +1,4 @@
-import React, { memo, useState } from "react";
+import React, { memo, useEffect, useState } from "react";
import { useSelector } from "react-redux";
//Styles
diff --git a/src/containers/Organization/Video/components/VideoPanel.jsx b/src/containers/Organization/Video/components/VideoPanel.jsx
index e02d44c2..b122689d 100644
--- a/src/containers/Organization/Video/components/VideoPanel.jsx
+++ b/src/containers/Organization/Video/components/VideoPanel.jsx
@@ -68,6 +68,7 @@ const VideoPanel = ({ setCurrentTime, setPlaying, useYtdlp, setUseYtdlp }) => {
return (
{ ((videoDetails.length === 0 && taskData?.video_url?.includes("youtube")) || useYtdlp === false) ?
+
{dispatch(setPlayer($video.current.getInternalPlayer()))}}
ref={$video}
diff --git a/src/containers/UserManagement/DailyEmailToggle.jsx b/src/containers/UserManagement/DailyEmailToggle.jsx
index ba6ec369..e8b5636f 100644
--- a/src/containers/UserManagement/DailyEmailToggle.jsx
+++ b/src/containers/UserManagement/DailyEmailToggle.jsx
@@ -18,15 +18,26 @@ const DailyEmailToggle = () => {
const [dailyEmail, setDailyEmail] = useState(false);
const [orgOwnerId, setOrgOwnerId] = useState("");
+ const [isUserOrgOwner, setIsUserOrgOwner] = useState(false);
+
useEffect(() => {
if (loggedInUser.id) {
const {
- organization: { organization_owner },
+ organization: { organization_owners },
enable_mail,
} = loggedInUser;
- setOrgOwnerId(organization_owner.id);
+ if (organization_owners && organization_owners.length > 0) {
+ const ownerIds = organization_owners.map(owner => owner.id);
+ setOrgOwnerId(ownerIds);
+
+ if (ownerIds.includes(loggedInUser.id)) {
+ setIsUserOrgOwner(true);
+ } else {
+ setIsUserOrgOwner(false);
+ }
+ }
setDailyEmail(enable_mail);
}
}, [loggedInUser]);
@@ -59,7 +70,7 @@ const DailyEmailToggle = () => {
!(
loggedInUser.id === +id ||
loggedInUser.role === "ADMIN" ||
- loggedInUser.id === orgOwnerId
+ isUserOrgOwner
)
}
/>
diff --git a/src/containers/UserManagement/EditProfile.jsx b/src/containers/UserManagement/EditProfile.jsx
index 6baae5e0..d227f98f 100644
--- a/src/containers/UserManagement/EditProfile.jsx
+++ b/src/containers/UserManagement/EditProfile.jsx
@@ -92,14 +92,24 @@ const EditProfile = () => {
const userObj = new FetchUserRolesAPI();
dispatch(APITransport(userObj));
};
+ const [isUserOrgOwner, setIsUserOrgOwner] = useState(false);
useEffect(() => {
if (loggedInUserData && loggedInUserData.id) {
const {
- organization: { organization_owner },
+ organization: { organization_owners },
} = loggedInUserData;
-
- setOrgOwnerId(organization_owner.id);
+
+ if (organization_owners && organization_owners?.length > 0) {
+ const ownerIds = organization_owners.map(owner => owner.id);
+ setOrgOwnerId(ownerIds);
+
+ if (ownerIds.includes(loggedInUserData.id)) {
+ setIsUserOrgOwner(true);
+ } else {
+ setIsUserOrgOwner(false);
+ }
+ }
}
}, [loggedInUserData]);
@@ -236,7 +246,7 @@ const EditProfile = () => {
let apiObj;
if (
loggedInUserData.role === "ADMIN" ||
- loggedInUserData.id === orgOwnerId
+ isUserOrgOwner
) {
apiObj = new UpdateProfileAPI(updateProfileReqBody, id);
} else {
@@ -248,20 +258,18 @@ const EditProfile = () => {
const getDisabledOption = (name) => {
const { id: userId, role } = loggedInUserData;
-
- if (userId === +id) {
- if (
- role === "ADMIN" ||
- userId === orgOwnerId ||
- role === "PROJECT_MANAGER"
- ) {
- return name === "org" || name === "availability";
- } else {
- return name === "role" || name === "org" || name === "availability";
- }
+
+ if (userId === +id || loggedInUserData?.role=="ORG_OWNER") {
+ if ( role === "ORG_OWNER") {
+ return false;
+ } else if ( role === "PROJECT_MANAGER") {
+ return name === "org" || name === "availability";
} else {
- return name !== "role";
+ return name === "role" || name === "org" || name === "availability";
}
+ } else {
+ return name !== "role";
+ }
};
const renderTextField = (name) => {
@@ -370,10 +378,10 @@ const EditProfile = () => {
const onSubmitClick = () => {
const { id: userId, role } = loggedInUserData;
- if (userId === +id) {
+ if (userId === +id || loggedInUserData?.role ==="ORG_OWNER" ) {
if (
role === "ADMIN" ||
- userId === orgOwnerId ||
+ isUserOrgOwner ||
role === "PROJECT_MANAGER"
) {
if (roleIsEdited) {
@@ -393,6 +401,7 @@ const EditProfile = () => {
setRoleIsEdited(false);
const body = {
+
user_id: id,
role: userDetails?.role?.value,
};
@@ -425,7 +434,7 @@ const EditProfile = () => {
{(loggedInUserData.id === +id ||
loggedInUserData.role === "ADMIN" ||
- loggedInUserData.id === orgOwnerId ||
+ isUserOrgOwner||
loggedInUserData.role === "PROJECT_MANAGER") && (
- {(loggedInUserData.id === orgOwnerId ||
+ {(isUserOrgOwner || loggedInUserData?.role==="ADMIN"||
+
loggedInUserData.role === "PROJECT_MANAGER") && (