Radish alpha
r
rad:z4D5UCArafTzTQpDZNQRuqswh3ury
Radicle desktop app
Radicle
Git
Restrict diff line selection to only existing sides
Open did:key:z6MkkfM3...sVz5 opened 1 year ago

Instead of allowing users to click on left and right side of diff lines, we only should allow people to select on the available side.

If we have README.md:L1 but no R1 we shouldn’t allow users to write a comment on README.md:R1 since this will fail.

checkcheck-unit-testcheck-e2e

👉 Workflow runs 👉 Branch on GitHub

1 file changed +6 -2 f0ef0872 8c4de52b
modified src/components/Diff.svelte
@@ -359,7 +359,9 @@
              isSelected(filePath(file, "left"), hunkIdx, lineIdx)}>
            <div
              class="left"
-
              class:selection-disabled={!codeComments || thread}
+
              class:selection-disabled={!codeComments ||
+
                thread ||
+
                lineNumber(line, "left") === undefined}
              class:marker={selection?.start.side === "left" &&
                selection.start.lineNumber === lineNumber(line, "left")}
              onpointerdown={e => {
@@ -372,7 +374,9 @@

            <div
              class="right"
-
              class:selection-disabled={!codeComments || thread}
+
              class:selection-disabled={!codeComments ||
+
                thread ||
+
                lineNumber(line, "right") === undefined}
              class:marker={selection?.start.side === "right" &&
                selection.start.lineNumber === lineNumber(line, "right")}
              onpointerdown={e => {