-
Notifications
You must be signed in to change notification settings - Fork 29
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PB-2424] Feat: working with ancestors to display shared item details #1403
base: master
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
let location = '/'; | ||
if (item.view === 'Shared') { | ||
location += translate('sideNav.shared'); | ||
if (item.isFolder) { | ||
location += getPathName.length > 0 ? '/' + getPathName.shift() : ''; | ||
} | ||
} else { | ||
if (item.isFolder) { | ||
getPathName.pop(); | ||
} | ||
location += rootPathName + (getPathName.length > 0 ? '/' + getPathName.join('/') : ''); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate this logic into functions for ease of understanding and maintenance
Quality Gate failedFailed conditions |
function getSharedLocation(item: DriveItemDetails, ancestorPathNames: string[]): string { | ||
let location = translate('sideNav.shared'); | ||
if (item.isFolder && ancestorPathNames.length > 0) { | ||
location += '/' + ancestorPathNames.shift(); | ||
} | ||
return location; | ||
} | ||
|
||
function getRegularLocation(item: DriveItemDetails, ancestorPathNames: string[]): string { | ||
if (item.isFolder) { | ||
ancestorPathNames.pop(); | ||
} | ||
return item.view + (ancestorPathNames.length > 0 ? '/' + ancestorPathNames.join('/') : ''); | ||
} | ||
|
||
function getLocation(item: DriveItemDetails, ancestors: DriveItemData[]): string { | ||
const itemViewName = item.view; | ||
const ancestorPathNames = ancestors.map((ancestor) => getItemPlainName(ancestor)).reverse(); | ||
ancestorPathNames.shift(); // Remove root parent | ||
|
||
let location = '/'; | ||
|
||
if (itemViewName === 'Shared') { | ||
location += getSharedLocation(item, ancestorPathNames); | ||
return location; | ||
} | ||
|
||
location += getRegularLocation(item, ancestorPathNames); | ||
return location; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remember to add tests for these functions, you will probably need to extract them from this file to add the unit tests
@jvedrson check the comments in order to finish the task |
Description
Adapted a NEW VERSION ENDPOINT of ancestors for Workspaces.
Fixed a bug when displaying details of items in the drive and shared folders for both individual and workspace.
Related Issues
Related Pull Requests
Checklist
How Has This Been Tested?
Additional Notes
When opening the details and looking at the location, it was set to show only /Shared to avoid showing folders that the owner user does not want to reveal or share as a security measure.
The share icon has been removed from internal folders and files. The icon only appears on the item that was initially shared. This is to allow the user to know which item they need to remove share access from. However, if there are folders or files that have been shared separately and are inside another shared folder, then the icon will be displayed.
File with change: src/app/share/views/SharedLinksView/components/SharedItemList.tsx