RocketChat / RocketChat/Rocket.Chat
Chore: Simplify `getNodeIconType` utility in WebDAV File Picker
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 46.1k
- Forks
- 13.9k
- Avg merge
- 3d 3h
- Merged PRs (30d)
- 130
Description
Description
Currently, the getNodeIconType utility function in the WebDAV File Picker returns an object containing { icon, type, extension }. However, looking at the codebase and the inline // TODO, this function's callers only ever use the icon property.
Returning the unused type and extension variables adds unnecessary complexity. This issue proposes simplifying the function to directly return the icon name and updating its consumers and unit tests accordingly.
Expected Behavior
getNodeIconType.tsreturns anIconNamestring instead of an object.- Unused
typeandextensionlocal variables are removed from the function. - WebDAV table and grid components consume the simplified return type.
Actual Behavior
- The function calculates and returns unused data, and caller components have to destruct the object:
const { icon } = getNodeIconType(...)
Context
This was noted as a // TODO in apps/meteor/client/views/room/webdav/WebdavFilePickerModal/lib/getNodeIconType.ts. Cleaning this up will improve code maintainability.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with apps/meteor/client/views/room/webdav/WebdavFilePickerModal/lib/getNodeIconType.ts and inspect the WebDAV table and grid consumers. Update the callers and unit tests to use the direct IconName result, and confirm the unused type and extension data are gone.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100