Open samschlicht opened 2 weeks ago
John and I discussed this one and didn't get entirely clear on exactly where the line between bug and desired behaviour is, but agreed there's at least something of the former.
So here's a summary of what's happening:
view-candidate-component.ts
line 206, this.fetchChat()
.)In my view the bug is one of these (and not the other):
I'll note an extra detail, which is that once the candidate is associated with a job at CV review stage, this error appears when I load their profile as a source partner admin:
2024-06-11 18:16:05.916 ERROR 79341 --- [io-8080-exec-12] o.tctalent.server.util.dto.ErrorHandler : Processing ServiceException: org.tctalent.server.exception.InvalidRequestException: Missing candidate
Finally, source_partner_id is not being saved for any of these chats, which seems like a bug and is potentially a problem for #693:
There's nothing catastrophic happening here, probably just a little tightening up needed!
Just confirming that we're getting the same error in prod (when a partner opens the full profile of a candidate with an opportunity at or past CV review stage).
Source partner ID should probably be set here (view-candidate-component.ts
in the left split):
I may be wrong, but this property seems like an important aspect of gathering a source partner's chat, per #693.
FYI @camerojo
Thanks for this analysis.
There is definitely a bug here.
The intention was that a source partner should have the option to create a chat with a candidate even if they have not been associated with a job. (A candidate prospect chat is automatically created for candidates who have a candidate job opp).
This allows source to communicate with promising candidates even before they are considered for a job.
I think one bug is that adding the Chat tab to the candidate display auto creates a chat. A solution to that bug could be to add an Open Chat button to the candidate display. A candidate tab is only displayed if that button has been pressed.
Once the button has been pressed and the tab displayed (and therefore the chat auto created if necessary), the button could change to Block Chat. Block Chat could be used to block input from the candidate if needed. Maybe that Block Candidate functionality should be added in a separate issue.
I am not sure that source partner id should be send on a Candidate Prospect chat. The source partner would be redundant data. It will always be the source partner associated with the candidate (which can change).
The source partner id on chats is present to define chats between that source partner and other partners- eg destination partners.
Note also that the CandidateProspect chat is intended to be shared across all opportunities for that Candidate as well as being used for chats between source and candidate unassisted with any job.
In other words there is only one CandidateProspect chat per candidate - irrespective of how many jobs they go for (including zero jobs).
Thanks for that, @camerojo! In that case I'll take this issue forward as a solution and enhancement relating to the creation of CandidateProspect chats. I'll adjust the title and description accordingly.
Totally take your point the source_partner_id would be redundant.
The behaviour we ideally want is
These are the code steps we'll need:
I've found the source of the bug with the method that checks if the admin belongs to a managing partner: while ngOnInit first fires the method to fetch the candidate, it is subscribed to — Angular moves on to using the candidate object in subsequent ngOnInit methods before it has arrived!
Currently a source-partner chat is also created when a candidate views their own profile (not desired behaviour)
But it's only viewable to the candidate if it has posts (desired behaviour, except that it means the chat will be visible when candidate is a prospect for a job, because that triggers an automated notification, rather than at CV review stage or later, which I understood was the intention).
I need to choose between the clickable tab or button. My preference is for the latter, but I'll run it by the team.
Team strongly preferred the button option, so I've removed the clickable tab code.
This is ready for PR but I'm going to discuss w JC first.
The evolution of this issue can be understood from the comments below.
John and I identified a bug whereby source partners create a CandidateProspect chat automatically by viewing any full-screen candidate profile (including anonymised profiles of candidates they don't manage), but the tab is not visible to any source partner except TBB (irrespective of whether they manage the candidate) — until the candidate has an opportunity at CV Review stage or later, when it is visible to TBB and the managing source partner.
UPDATE: I've also found that the candidate viewing their own profile also auto-creates a CandidateProspect chat, and that they will see the chat from the point when they are added to a submission list (due to the automated message telling them they're a prospect).
The solution to this bug is also an enhancement:
As a source partner I want to be able to create and view CandidateProspect chats So that I can correspond with promising candidates before they're associated with an opportunity at CV Review stage or later
As John suggests, I've created a separate issue for blocking these CandidateProspect chats.