Skip to content

Commit 78c158f

Browse files
jeremymanningclaude
andcommitted
Prompt new members for photo upload during onboarding
After form submission, the bot now: - Checks for pre-existing photos in images/people/ (already bordered or raw) - If found and bordered: uses it directly - If found but unprocessed: runs add_borders.py automatically - If not found: explicitly prompts the member to upload a photo in the DM Admin approval message now shows photo status (received vs pending). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent ffa04f2 commit 78c158f

1 file changed

Lines changed: 55 additions & 1 deletion

File tree

cdl_bot/handlers/onboard.py

Lines changed: 55 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,36 @@ def handle_onboarding_form(ack, body, client: WebClient, view):
322322
request.bio_edited = edited_bio
323323
save_request(request)
324324

325+
# Check if a photo already exists in the website repo
326+
existing_photo = image_service.find_existing_photo(request.name)
327+
has_bordered_photo = existing_photo and image_service.is_photo_bordered(existing_photo)
328+
329+
if has_bordered_photo:
330+
request.photo_processed_path = existing_photo
331+
save_request(request)
332+
photo_status = ":white_check_mark: *Photo:* Found your existing photo — looks great!"
333+
elif existing_photo:
334+
# Photo exists but needs border processing
335+
try:
336+
output_path = config.output_dir / f"{request.slack_user_id}_photo.png"
337+
processed = image_service.add_hand_drawn_border(existing_photo, output_path)
338+
request.photo_processed_path = processed
339+
save_request(request)
340+
photo_status = ":white_check_mark: *Photo:* Found and processed your photo!"
341+
except Exception as e:
342+
logger.error(f"Error processing existing photo: {e}")
343+
photo_status = (
344+
":camera: *Photo:* Please upload a profile photo by sending it "
345+
"as a message in this conversation. It will be automatically "
346+
"cropped and styled to match the lab website."
347+
)
348+
else:
349+
photo_status = (
350+
":camera: *Photo:* Please upload a profile photo by sending it "
351+
"as a message in this conversation. It will be automatically "
352+
"cropped and styled to match the lab website."
353+
)
354+
325355
# Send confirmation to the new member
326356
try:
327357
client.chat_postMessage(
@@ -339,7 +369,13 @@ def handle_onboarding_form(ack, body, client: WebClient, view):
339369
"type": "section",
340370
"text": {
341371
"type": "mrkdwn",
342-
"text": f"*What's next:*\n• GitHub: Invitation to ContextLab organization\n• Calendar: Access to lab calendars\n• Website: Your photo and bio will be added",
372+
"text": (
373+
f"*What's next:*\n"
374+
f"• GitHub: Invitation to ContextLab organization\n"
375+
f"• Calendar: Access to lab calendars\n"
376+
f"• Website: Your bio will be added to the people page\n\n"
377+
f"{photo_status}"
378+
),
343379
},
344380
},
345381
],
@@ -730,6 +766,24 @@ def _send_approval_request(
730766
},
731767
})
732768

769+
# Photo status
770+
if request.photo_processed_path and Path(request.photo_processed_path).exists():
771+
blocks.append({
772+
"type": "section",
773+
"text": {
774+
"type": "mrkdwn",
775+
"text": ":white_check_mark: *Photo:* Processed and ready",
776+
},
777+
})
778+
else:
779+
blocks.append({
780+
"type": "section",
781+
"text": {
782+
"type": "mrkdwn",
783+
"text": ":warning: *Photo:* Not yet received — member has been prompted to upload",
784+
},
785+
})
786+
733787
blocks.append({"type": "divider"})
734788

735789
# GitHub team selection

0 commit comments

Comments
 (0)