[go: up one dir, main page]

Skip to content

Allow user to copy suggestion as a diff

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

When someone makes a suggestion in a comment on an MR, your options are to apply it, or add it to a batch to apply it. This will add another commit to the MR, which is not always what the MR author wants to do.

We add a copy button to the top left corner of all code blocks -- why isn't it present on a suggestion as well? A suggestion should be rendered as a copyable code block where the type is diff.

Here's a code block with a copy button that contains a diff:

diff --git a/db/structure.sql b/db/structure.sql
index bfcdfc1ed612..e8ed94485879 100644
--- a/db/structure.sql
+++ b/db/structure.sql
@@ -1009,7 +1009,7 @@ PARTITION BY RANGE (process_at);
 
 CREATE TABLE loose_foreign_keys_deleted_records (
     id bigint NOT NULL,
-    partition bigint DEFAULT 1 NOT NULL,
+    partition bigint DEFAULT 2 NOT NULL,
     primary_key_value bigint NOT NULL,
     status smallint DEFAULT 1 NOT NULL,
     created_at timestamp with time zone DEFAULT now() NOT NULL,

Proposed solution

Use the same code block copy button for suggestions that is used for other code blocks, so that if the MR author wants to they can apply the diff manually on their local instead of adding it to a suggestion commit via the MR interface in GitLab.

Edited by 🤖 GitLab Bot 🤖