From 2c95d6421e8d80bc5621d99ffd5ee45ef7750090 Mon Sep 17 00:00:00 2001 From: ychao_1983 Date: Wed, 31 Aug 2022 09:46:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=85=B3=E8=81=94=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=9B=86=E6=9D=83=E9=99=90=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- models/dataset.go | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/models/dataset.go b/models/dataset.go index 0c26f5446..22a20e328 100755 --- a/models/dataset.go +++ b/models/dataset.go @@ -121,8 +121,10 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions) for i := range datasets { if attachment.DatasetID == datasets[i].ID { - if opts.StarByMe { + if !attachment.IsPrivate{ + datasets[i].Attachments = append(datasets[i].Attachments, attachment) + }else{ permission, ok := permissionMap[datasets[i].ID] if !ok { @@ -136,7 +138,7 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions) } if !permission { isCollaborator, _ := datasets[i].Repo.IsCollaborator(opts.User.ID) - if isCollaborator { + if isCollaborator ||datasets[i].Repo.IsOwnedBy(opts.User.ID){ log.Info("Collaborator user may visit the attach.") permission = true } @@ -147,11 +149,7 @@ func (datasets DatasetList) loadAttachmentAttributes(opts *SearchDatasetOptions) if permission { datasets[i].Attachments = append(datasets[i].Attachments, attachment) - } else if !attachment.IsPrivate { - datasets[i].Attachments = append(datasets[i].Attachments, attachment) } - } else { - datasets[i].Attachments = append(datasets[i].Attachments, attachment) } }