clone

a personal forge on plain git: static pages, stacked-diff reviews, signed local ci, repo sites and releases

main
forge / test / scenarios / web-comment-page.sh
web-comment-page.sh 1.8K
1# A review page carries a comment form and an Approve button for whoever2# is signed in. The page is a static file, the same for everyone, so they3# start hidden and discuss.js shows them once /login/whoami names a user.4# The form posts the tip the page shows and knows the review's author,5# whose Approve button it hides. A review that isn't live has no Approve6# button. A private repo's review page has the same form.7. "$(dirname "$0")/../lib.sh"8user dami9repo dami/greet10repo --private dami/secret11for r in greet secret; do12 clone dami "dami/$r" "$T/w/$r"13 at "$T/w/$r" commit "first"14 ok push_as dami "$T/w/$r" origin main15 at "$T/w/$r" git switch -q -c dami/feature16 at "$T/w/$r" commit "feature"17 ok push_as dami "$T/w/$r" origin dami/feature18done19at "$T/w/greet" git switch -q -c dami/gone20at "$T/w/greet" commit "gone"21ok push_as dami "$T/w/greet" origin dami/gone22ok push_as dami "$T/w/greet" origin :dami/gone23build24tip=$(git --git-dir="$FORGE_ROOT/dami/greet.git" rev-parse dami/feature)2526p=$FORGE_WWW/dami/greet/reviews/1/index.html27has "$p" "<form class=\"reply panel-body\" id=\"reply\" data-post=\"/dami/greet/reviews/1/\" data-at=\"$tip\" data-author=\"dami\" hidden>"28has "$p" '<textarea class="input" aria-label="comment on #1" placeholder="Comment on #1. Markdown is fine." name="body" maxlength="32768"'29has "$p" '<button type="button" data-approve '30has "$p" '<script src="/assets/discuss\.[A-Za-z0-9_-]{10}\.js" defer>'31exists "$FORGE_WWW$(grep -o '/assets/discuss\.[A-Za-z0-9_-]*\.js' "$p")"32has "$FORGE_WWW/dami/greet/reviews/2/index.html" 'id="reply" data-post="/dami/greet/reviews/2/"'33lacks "$FORGE_WWW/dami/greet/reviews/2/index.html" 'data-approve'34has "$FORGE_ROOT/.forge/private/www/dami/secret/reviews/1/index.html" 'id="reply" data-post="/dami/secret/reviews/1/"'