polish(share): picker avatars + target name + pre-warm video poster

Follow-ups from testing the share flow (which now works end-to-end):
- Send-to picker showed only initials — now shows the real profile photo when the
  chat has one (matching the sidebar/forward avatars), coloured initials otherwise.
- During send it only said "Uploading 60%" with no idea WHO to — now the header and
  progress name the target ("Sending to Manasa Rapolu · 60%").
- After sending, a video bubble sat blank (just a timestamp) for a second or two
  while the poster generated on first view. media.js now warms the poster thumbnail
  at UPLOAD (temp-then-rename), and the on-demand /thumbs handler also writes via a
  temp, so the two can't serve a half-written JPEG. The bubble shows its poster
  right away.

Web + server only — live on deploy. Does NOT address the share extension failing to
auto-open the app (an iOS limitation, handled next in the native build).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-24 16:21:02 +05:30
parent 4836b1e197
commit 0c3487fdb0
3 changed files with 38 additions and 7 deletions
+12 -5
View File
@@ -1197,7 +1197,7 @@
</head>
<body>
<script src="/icons.js?v=6"></script>
<script>window.__BUILD='2026-07-24-batch167';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
<script>window.__BUILD='2026-07-24-batch168';console.log('%cBiz Connect','color:#1F3B73;font-weight:bold','build '+window.__BUILD);
// Emoji are rendered with the OS's own (colour) emoji font — instant, zero network.
//
// We used to run Twemoji over every emoji, which swapped each one for an <img> pulled INDIVIDUALLY from
@@ -3599,7 +3599,10 @@ function openSharePicker(items){
q=(q||'').toLowerCase().trim();
const shown=rows.filter(r=>!q||String(r.name||'').toLowerCase().includes(q));
listEl.innerHTML=shown.length?shown.map(r=>{
const av='<span class="sr-ic">'+(r.kind==='group'?ic('users',16):initials(r.name))+'</span>';
// Match the sidebar/forward avatars: real photo if the row has one, else coloured initials.
const inner = r.kind==='group' ? ic('users',16)
: (r.avatar ? '<img src="'+pEsc(r.avatar)+'" alt="" onerror="this.remove()">' : pEsc(initials(r.name)));
const av='<span class="sr-ic" style="background:'+avColor(r.name||'?')+';color:#334155">'+inner+'</span>';
return '<div class="stor-row share-to" data-kind="'+pEsc(r.kind)+'" data-id="'+pEsc(r.id)+'">'+av
+'<span class="sr-m"><span class="sr-n">'+pEsc(r.name||'Chat')+'</span>'
+'<span class="sr-s">'+(r.kind==='group'?'Group':'Direct message')+'</span></span>'
@@ -3614,17 +3617,21 @@ function openSharePicker(items){
}
async function sendSharedTo(kind, id, files, texts, ov, close){
if(ov.dataset.busy) return; ov.dataset.busy='1';
const target=((rowFor(kind,id)||{}).name)||'chat';
const sub=ov.querySelector('.gi-sub'); if(sub) sub.textContent='Sending to '+target;
const body=ov.querySelector('#shareList');
const prog=document.createElement('div'); prog.className='stor-empty'; prog.textContent='Sending…';
const prog=document.createElement('div'); prog.className='stor-empty'; prog.textContent='Sending to '+target+'…';
if(body){ body.innerHTML=''; body.appendChild(prog); }
const many=files.length>1;
const post=(payload)=>postJSON('/api/messages', kind==='group'?Object.assign({group:id},payload):Object.assign({to:id},payload));
try{
let first=true;
// Files first (each its own message), then any shared text/link as a final message.
for(let i=0;i<files.length;i++){
prog.textContent='Sending '+(i+1)+' of '+files.length+'';
const of=many?(' ('+(i+1)+' of '+files.length+')'):'';
prog.textContent='Sending to '+target+of+'…';
const f=await bzShareItemToFile(files[i]);
const meta=await bzUploadBlob(f, p=>{ prog.textContent='Uploading '+(i+1)+' of '+files.length+' · '+p+'%'; });
const meta=await bzUploadBlob(f, p=>{ prog.textContent='Uploading to '+target+of+' · '+p+'%'; });
await post({ body:(first&&texts.length&&files.length===1)?texts.join('\n'):'', attachmentId:meta.id, mentions:[] });
first=false;
}