Skip to content

Commit

Permalink
Merge pull request #687 from codeforpdx/issue-686/fix-my-documents-ac…
Browse files Browse the repository at this point in the history
…tion-buttons

[Bug Fix] - Adjust state logic for Edit and Delete action buttons in table row
  • Loading branch information
leekahung authored Nov 14, 2024
2 parents 0e896f0 + e7572df commit a5263d5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "pass",
"homepage": ".",
"version": "1.1.0-alpha",
"version": "1.1.1-alpha",
"description": "",
"scripts": {
"start": "concurrently --kill-others \"npm run podserver\" \"npm run dev\"",
Expand Down
8 changes: 2 additions & 6 deletions src/components/Documents/DocumentsDesktop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import {
} from '@mui/x-data-grid';
// Util Imports
import { getTypeText } from '@utils';
// Hooks Imports
import { useSession } from '@hooks';
// Theme Imports
import theme from '../../theme';

Expand Down Expand Up @@ -68,9 +66,7 @@ const CustomToolbar = () => (
* @returns {React.JSX.Element} The DocumentsDesktop component
*/
const DocumentsDesktop = ({ documents, handlers }) => {
const { session } = useSession();
const location = useLocation();
const profileWebId = decodeURIComponent(location.pathname.split('/')[2]);

const columnTitlesArray = [
{ field: 'Name', minWidth: 120, flex: 1, headerAlign: 'center', align: 'center' },
Expand Down Expand Up @@ -116,7 +112,7 @@ const DocumentsDesktop = ({ documents, handlers }) => {
onClick={() => handlers.onShare('document', name, type)}
label="Share"
data-testid={`share-button-${id}`}
disabled={session.info.webId !== profileWebId}
disabled={location.pathname !== '/documents'}
/>
);
}
Expand All @@ -138,7 +134,7 @@ const DocumentsDesktop = ({ documents, handlers }) => {
onClick={() => handlers.onDelete(document)}
label="Delete"
data-testid={`delete-button-${document.id}`}
disabled={session.info.webId !== profileWebId}
disabled={location.pathname !== '/documents'}
/>
);
}
Expand Down

0 comments on commit a5263d5

Please sign in to comment.