From 8bd89ca2941bdb4f41be82d0ae66fdf5ceca0fe5 Mon Sep 17 00:00:00 2001 From: singuliere <35190819+singuliere@users.noreply.github.com> Date: Sun, 6 Feb 2022 10:05:29 +0100 Subject: preserve users if restoring a repository on the same Gitea instance (#18604) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When calling DumpRepository and RestoreRepository on the same Gitea instance, the users are preserved: all labels, issues etc. belong to the external user who is, in this particular case, the local user. Dead code verifying g.gitServiceType.Name() == "" (i.e. plain git) is removed. The function is never called because the plain git downloader does not migrate anything that is associated to a user, by definition. Errors returned by GetUserIDByExternalUserID are no longer ignored. The userMap is used when the external user is not kown, which is the most common case. It was only used when the external user exists which happens less often and, as a result, every occurence of an unknown external user required a SQL query. Signed-off-by: Loïc Dachary Co-authored-by: Loïc Dachary Co-authored-by: Lunny Xiao --- integrations/dump_restore_test.go | 1 + 1 file changed, 1 insertion(+) (limited to 'integrations/dump_restore_test.go') diff --git a/integrations/dump_restore_test.go b/integrations/dump_restore_test.go index c0e583293c..57968618bc 100644 --- a/integrations/dump_restore_test.go +++ b/integrations/dump_restore_test.go @@ -129,6 +129,7 @@ func TestDumpRestore(t *testing.T) { assert.EqualValues(t, before[i].Created, after[i].Created) assert.EqualValues(t, before[i].Updated, after[i].Updated) assert.EqualValues(t, before[i].Labels, after[i].Labels) + assert.EqualValues(t, before[i].Reactions, after[i].Reactions) } } }) -- cgit v1.2.3