Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent empty div when editing comment (#12404) #12991

Merged
merged 1 commit into from
Oct 1, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions routers/repo/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -1956,7 +1956,7 @@ func updateAttachments(item interface{}, files []string) error {
case *models.Comment:
attachments = content.Attachments
default:
return fmt.Errorf("Unknow Type")
return fmt.Errorf("Unknown Type: %T", content)
}
for i := 0; i < len(attachments); i++ {
if util.IsStringInSlice(attachments[i].UUID, files) {
Expand All @@ -1974,7 +1974,7 @@ func updateAttachments(item interface{}, files []string) error {
case *models.Comment:
err = content.UpdateAttachments(files)
default:
return fmt.Errorf("Unknow Type")
return fmt.Errorf("Unknown Type: %T", content)
}
if err != nil {
return err
Expand All @@ -1986,7 +1986,7 @@ func updateAttachments(item interface{}, files []string) error {
case *models.Comment:
content.Attachments, err = models.GetAttachmentsByCommentID(content.ID)
default:
return fmt.Errorf("Unknow Type")
return fmt.Errorf("Unknown Type: %T", content)
}
return err
}
Expand Down
4 changes: 2 additions & 2 deletions templates/repo/issue/view_content/attachments.tmpl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{range .Attachments}}
{{- range .Attachments -}}
<div class="twelve wide column" style="padding: 6px;">
<a target="_blank" rel="noopener noreferrer" href="{{.DownloadURL}}" title='{{$.ctx.i18n.Tr "repo.issues.attachment.open_tab" .Name}}'>
{{if FilenameIsImage .Name}}
Expand All @@ -12,4 +12,4 @@
<div class="four wide column" style="padding: 0px;">
<span class="ui text grey right">{{.Size | FileSize}}</span>
</div>
{{end}}
{{end -}}