Talent-Catalog / talentcatalog

https://tctalent.org
GNU Affero General Public License v3.0
12 stars 4 forks source link

Bug: download CV from candidate dropdown menu and clickable icon not working #1226

Closed samschlicht closed 2 months ago

samschlicht commented 2 months ago
  1. Clickable open CV(s) icon DLs non-CV files e.g. JPGs - may just be a user error?
  2. This one definitely looks like a bug: Screenshot 2024-07-31 at 10.58.07 AM.png
samschlicht commented 2 months ago

Re bug no.1, cv-icon component makes no distinction between attachments — that'll be why it DLs any file when clicked.

This block runs whenever a candidate row in search results is loaded — when the icon is clicked, the user receives whatever's in the resulting array: Screenshot 2024-08-05 at 1 16 15 PM

That's why the user receives files that aren't CVs at times when clicking the icon from search results.

On the other hand, this component is also used on the candidate 'additional info' tab, where it receives the optional @Input of a single attachment, which has already been identified as a CV. In that case it works fine, DLing the right attachment.

So, what, I've done to fix this is add a condition check as an else block on the getAttachments() method:

Screenshot 2024-08-05 at 1 30 48 PM

samschlicht commented 2 months ago

I've also addressed a smaller UX bug: clicking the CV icon was opening the candidate profile search card, which is probably not what the user intended — I've ended that by adding event.stopPropagation() to the on-click method.

samschlicht commented 2 months ago

On to bug #2, where I've started by fixing a small display niggle whereby the list divider appears at the end of the menu, even when there isn't an item after it:

Screenshot 2024-08-05 at 1 58 09 PM

Another little niggle: no divider when the reviewable option shows:

Screenshot 2024-08-05 at 2 39 20 PM

I've fixed that with another if statement.

The first part of the larger bug is that the option to DL CV is appearing on the dropdown irrespective of whether the candidate has a CV.

samschlicht commented 2 months ago

Just a note that while working on these bugs, I surfaced one in my link preview code. I've fixed that in a separate commit.

samschlicht commented 2 months ago

The issue causing #2 is that the DownloadCvRequest is not being filled. There's also a redundant candidate ID included in the URL, not needed since it's in the request.

On a separate note, one thing I'm going to suggest is that we add a label or change the title of this dropdown item to 'Download Generated CV' - we need to signpost the difference between that and the clickable CV icon, which downloads uploaded CVs.

samschlicht commented 2 months ago

2 fixed - now opens modal download-cv component which fills the request that the server needs - replicated and lightly adapted the method from view-candidate component.

Slightly amended the attendant method names, icon/dropdown item labels and component doc so that the difference between the CV DL options is clearer to devs and admins.