Skip to content

Commit be02733

Browse files
Miscellaneous Bug Fixes (#423)
fix: Show non-resolvable notes in winbar (#417) fix: add more emojis and make emoji picker configurable (#414) fix: comment creation should not be possible for renamed and moved files (#416) fix: color highlight groups are invalid (#421) fix: plugin failing to build on Windows (#419) --------- Co-authored-by: Jakub F. Bortlík <[email protected]>
1 parent 30daecf commit be02733

File tree

17 files changed

+221
-11079
lines changed

17 files changed

+221
-11079
lines changed

cmd/app/comment_helpers.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ type LineRange struct {
2323
/* PositionData represents the position of a comment or note (relative to a file diff) */
2424
type PositionData struct {
2525
FileName string `json:"file_name"`
26+
OldFileName string `json:"old_file_name"`
2627
NewLine *int `json:"new_line,omitempty"`
2728
OldLine *int `json:"old_line,omitempty"`
2829
HeadCommitSHA string `json:"head_commit_sha"`
@@ -41,13 +42,19 @@ type RequestWithPosition interface {
4142
func buildCommentPosition(commentWithPositionData RequestWithPosition) *gitlab.PositionOptions {
4243
positionData := commentWithPositionData.GetPositionData()
4344

45+
// If the file has been renamed, then this is a relevant part of the payload
46+
oldFileName := positionData.OldFileName
47+
if oldFileName == "" {
48+
oldFileName = positionData.FileName
49+
}
50+
4451
opt := &gitlab.PositionOptions{
4552
PositionType: &positionData.Type,
4653
StartSHA: &positionData.StartCommitSHA,
4754
HeadSHA: &positionData.HeadCommitSHA,
4855
BaseSHA: &positionData.BaseCommitSHA,
4956
NewPath: &positionData.FileName,
50-
OldPath: &positionData.FileName,
57+
OldPath: &oldFileName,
5158
NewLine: positionData.NewLine,
5259
OldLine: positionData.OldLine,
5360
}

cmd/app/emoji.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import (
77
"io"
88
"net/http"
99
"os"
10-
"path"
10+
"path/filepath"
1111
"strconv"
1212
"strings"
1313

@@ -157,8 +157,8 @@ func attachEmojis(a *data, fr FileReader) error {
157157
return err
158158
}
159159

160-
binPath := path.Dir(e)
161-
filePath := fmt.Sprintf("%s/config/emojis.json", binPath)
160+
binPath := filepath.Dir(e)
161+
filePath := filepath.Join(binPath, "config", "emojis.json")
162162

163163
reader, err := fr.ReadFile(filePath)
164164

cmd/config/emojis.json

Lines changed: 1 addition & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)