Monorepo for Tangled tangled.org

appview/pages: PR comment link button should specify round #1187

merged opened by oyster.cafe targeting master from lt/appview-pages-link-quote-specify-round

Using a SSR link too so that it can't be overridden by any custom browser plugin. Not the best way of doing things but works.

Labels

None yet.

assignee

None yet.

Participants 2
AT URI
at://did:plc:3fwecdnvtcscjnrx2p4n7alz/sh.tangled.repo.pull/3mhihfd4zzk22
+4 -1
Diff #0
+3 -1
appview/pages/templates/fragments/line-quote-button.html
··· 227 227 ? firstAnchor 228 228 : `${firstAnchor}~${lastAnchor}`; 229 229 230 - const md = `[\`${label}\`](${window.location.pathname}${window.location.search}#${fragment})`; 230 + const linkBase = document.getElementById('round-link-base')?.value 231 + || (window.location.pathname + window.location.search); 232 + const md = `[\`${label}\`](${linkBase}#${fragment})`; 231 233 232 234 const { selectionStart: s, selectionEnd: end, value } = ta; 233 235 const before = value.slice(0, s);
+1
appview/pages/templates/repo/pulls/pull.html
··· 99 99 {{ end }} 100 100 101 101 {{ define "contentAfter" }} 102 + <input type="hidden" id="round-link-base" value="/{{ .RepoInfo.FullName }}/pulls/{{ .Pull.PullId }}/round/{{ .ActiveRound }}" /> 102 103 {{ template "repo/fragments/diff" (list .Diff .DiffOpts $) }} 103 104 {{ end }} 104 105

History

1 round 5 comments
sign up or login to add to the discussion
oyster.cafe submitted #0
1 commit
expand
appview/pages: link quote button specify round
3/3 success
expand
expand 5 comments

appview/pages/templates/fragments/line-quote-button.html:231 why don't we do current URL - existing fragment + new fragment?

would that result in malformed links in some cases perhaps (multiline etc.)?

I think both achieve exactly the same thing, I just thought this way would look a little more explicit

using current URL approach would avoid the need for the hidden input with the active round number (the active round will be encoded in the URL always).

if I did that then there'd be no point to the PR I think, the point for me is to render the round server side so that there's no chance of getting to some magic PR state client side where my window.location doesn't have the round path, like my comments in https://tangled.org/tangled.org/core/pulls/1182/round/2

okay! lgtm!

pull request successfully merged