Browse Source

Merge branch 'V20220830' into zouap_static

tags/v1.22.8.2^2
zouap 3 years ago
parent
commit
96740c1ac8
1 changed files with 4 additions and 6 deletions
  1. +4
    -6
      models/dataset.go

+ 4
- 6
models/dataset.go View File

@@ -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)
}

}


Loading…
Cancel
Save