mirror of
https://github.com/go-gitea/gitea.git
synced 2025-10-05 00:06:29 +00:00
Added button to copy file name in PR files (#35509)
The merge request file viewer has a button for copying the file path, but it is not always convenient. Often, you only want to copy the file name, which is currently not possible. This change request adds this capability. --------- Signed-off-by: wxiaoguang <wxiaoguang@gmail.com> Co-authored-by: a.kiselev <a.kiselev@reglab.ru> Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
This commit is contained in:

committed by
GitHub

parent
340aed3982
commit
efc48c36ff
@@ -13,6 +13,7 @@ import (
|
||||
"html/template"
|
||||
"io"
|
||||
"net/url"
|
||||
"path"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -403,6 +404,14 @@ func (diffFile *DiffFile) GetDiffFileName() string {
|
||||
return diffFile.Name
|
||||
}
|
||||
|
||||
// GetDiffFileBaseName returns the short name of the diff file, or its short old name in case it was deleted
|
||||
func (diffFile *DiffFile) GetDiffFileBaseName() string {
|
||||
if diffFile.Name == "" {
|
||||
return path.Base(diffFile.OldName)
|
||||
}
|
||||
return path.Base(diffFile.Name)
|
||||
}
|
||||
|
||||
func (diffFile *DiffFile) ShouldBeHidden() bool {
|
||||
return diffFile.IsGenerated || diffFile.IsViewed
|
||||
}
|
||||
|
Reference in New Issue
Block a user