feat: review conversation photo bundles before sending (Closes #945)
This commit is contained in:
1 parent
55bd353daf
commit
5da5d7cdc4
6 files changed
+126
-6
No files matched your search
@@ -77,6 +77,40 @@ outbox.flush('timmy').then(result => process.stdout.write(JSON.stringify({{persi
|
||||
assert output["remaining"] == []
|
||||
|
||||
|
||||
def test_durable_conversation_photo_captions_stay_paired_without_local_binary_storage():
|
||||
script = f"""
|
||||
const createAuthoredOutbox = require({json.dumps(str(OUTBOX))});
|
||||
const values = new Map(); const mirrors = [];
|
||||
const storage = {{getItem:k=>values.get(k)||null,setItem:(k,v)=>values.set(k,v)}};
|
||||
const outbox = createAuthoredOutbox({{
|
||||
storage, getOwnerLogin:()=> 'timmy',
|
||||
backgroundSync:{{reconcile:async items=>mirrors.push(items),requestSync:async()=>{{}}}},
|
||||
}});
|
||||
const photo=(filename,note)=>({{filename,contentType:'image/png',blob:new Blob([filename]),note}});
|
||||
(async()=>{{
|
||||
await outbox.enqueueDurably({{
|
||||
kind:'issue-comment',repository:'o/r',number:9,body:'Before and after',operationId:'bundle-note',
|
||||
attachments:[photo('before.png','Before repair'),photo('after.png','After *repair*')],
|
||||
}});
|
||||
const metadata=JSON.parse(values.get('stackchain.authored-outbox.v1')).items[0].attachments;
|
||||
const durable=mirrors[0][0].attachments;
|
||||
process.stdout.write(JSON.stringify({{
|
||||
metadata,durable:durable.map(x=>({{filename:x.filename,note:x.note,text:x.data||null,hasBlob:x.blob instanceof Blob}})),
|
||||
}}));
|
||||
}})().catch(error=>{{console.error(error);process.exit(1);}});
|
||||
"""
|
||||
output = run_node(script)
|
||||
|
||||
assert output["metadata"] == [
|
||||
{"filename": "before.png", "contentType": "image/png", "stored": True, "note": "Before repair"},
|
||||
{"filename": "after.png", "contentType": "image/png", "stored": True, "note": "After *repair*"},
|
||||
]
|
||||
assert output["durable"] == [
|
||||
{"filename": "before.png", "note": "Before repair", "text": None, "hasBlob": True},
|
||||
{"filename": "after.png", "note": "After *repair*", "text": None, "hasBlob": True},
|
||||
]
|
||||
|
||||
|
||||
def test_authored_outbox_persists_and_delivers_revision_checked_issue_content():
|
||||
script = f"""
|
||||
const createAuthoredOutbox = require({json.dumps(str(OUTBOX))});
|
||||
|
||||
@@ -113,6 +113,38 @@ def test_mobile_conversation_composers_accept_five_ordered_photos():
|
||||
assert "maxFiles: 5" in mount.group(1), controller
|
||||
|
||||
|
||||
def test_mobile_conversation_composers_review_reorder_remove_and_caption_every_photo():
|
||||
html = INDEX.read_text()
|
||||
dashboard = DASHBOARD.read_text()
|
||||
css = CSS.read_text()
|
||||
|
||||
composers = (
|
||||
("issue-attachment", "issueAttachmentController"),
|
||||
("pull-attachment", "pullAttachmentController"),
|
||||
("update-reply-attachment", "updateReplyAttachmentController"),
|
||||
)
|
||||
for attachment_id, controller in composers:
|
||||
assert f'id="{attachment_id}-tray"' in html
|
||||
assert f'id="{attachment_id}-note" maxlength="240"' in html
|
||||
assert f'id="move-{attachment_id}-earlier"' in html
|
||||
assert f'id="remove-{attachment_id}"' in html
|
||||
assert f'id="move-{attachment_id}-later"' in html
|
||||
mount = re.search(
|
||||
rf"const {controller} = issueAttachment\.mount\(\{{(.*?)\n \}}\);",
|
||||
dashboard,
|
||||
re.DOTALL,
|
||||
)
|
||||
assert mount, controller
|
||||
assert f"tray: qs('#{attachment_id}-tray')" in mount.group(1)
|
||||
assert f"earlier: qs('#move-{attachment_id}-earlier')" in mount.group(1)
|
||||
assert f"later: qs('#move-{attachment_id}-later')" in mount.group(1)
|
||||
assert f"note: qs('#{attachment_id}-note')" in mount.group(1)
|
||||
|
||||
assert ".conversation-evidence-review" in css
|
||||
assert ".conversation-evidence-review .issue-evidence-review-actions button" in css
|
||||
assert "min-height:44px" in css
|
||||
|
||||
|
||||
def test_mobile_evidence_bundle_reorders_selected_image_for_serialization_and_upload():
|
||||
script = f"""
|
||||
const attachment = require({json.dumps(str(ATTACHMENT))});
|
||||
|
||||
Reference in new issue
Block a user