(inputs []NoteComment, notePath string)
| 1225 | } |
| 1226 | |
| 1227 | func normalizeComments(inputs []NoteComment, notePath string) []NoteComment { |
| 1228 | out := make([]NoteComment, 0, len(inputs)) |
| 1229 | seen := map[string]struct{}{} |
| 1230 | for _, input := range inputs { |
| 1231 | comment, ok := normalizeComment(input, notePath) |
| 1232 | if !ok { |
| 1233 | continue |
| 1234 | } |
| 1235 | if _, exists := seen[comment.ID]; exists { |
| 1236 | continue |
| 1237 | } |
| 1238 | seen[comment.ID] = struct{}{} |
| 1239 | out = append(out, comment) |
| 1240 | } |
| 1241 | sort.SliceStable(out, func(i, j int) bool { |
| 1242 | if out[i].CreatedAt == out[j].CreatedAt { |
| 1243 | return out[i].ID < out[j].ID |
| 1244 | } |
| 1245 | return out[i].CreatedAt < out[j].CreatedAt |
| 1246 | }) |
| 1247 | return out |
| 1248 | } |
| 1249 | |
| 1250 | func (v *Vault) readNoteCommentsLocked(rel string) ([]NoteComment, error) { |
| 1251 | notePath := filepath.ToSlash(rel) |
no test coverage detected