fix: hydrate meeting note file uploader
This commit is contained in:
@@ -335,7 +335,7 @@ func meetingNoteFilePayload(file store.MeetingNoteFile, viewer int64) map[string
|
||||
"preview_mode": file.PreviewMode,
|
||||
"preview_file_id": file.PreviewFileID,
|
||||
"uploader_user_id": formatUserID(file.UploaderID),
|
||||
"uploader": userSummary(file.UploaderID, store.UserSummary{}),
|
||||
"uploader": userSummary(file.UploaderID, file.Uploader),
|
||||
"version": file.Version,
|
||||
"permissions": map[string]any{
|
||||
"can_preview": file.Status == "active",
|
||||
|
||||
@@ -115,6 +115,28 @@ func TestMeetingNoteFilePayloadKeepsOriginalNameAndExtension(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestMeetingNoteFilePayloadUsesUploaderSummary(t *testing.T) {
|
||||
now := time.Date(2026, 9, 17, 12, 0, 0, 0, time.UTC)
|
||||
payload := meetingNoteFilePayload(store.MeetingNoteFile{
|
||||
NoteFileID: "mnote_1",
|
||||
UploaderID: 1573637795346386944,
|
||||
Uploader: store.UserSummary{
|
||||
UserID: 1573637795346386944,
|
||||
DisplayName: "jcharles3",
|
||||
},
|
||||
Status: "active",
|
||||
CreatedAt: now,
|
||||
UpdatedAt: now,
|
||||
}, 1573637795346386944)
|
||||
uploader, ok := payload["uploader"].(map[string]any)
|
||||
if !ok {
|
||||
t.Fatalf("uploader=%#v", payload["uploader"])
|
||||
}
|
||||
if uploader["display_name"] != "jcharles3" {
|
||||
t.Fatalf("uploader.display_name=%v, want jcharles3", uploader["display_name"])
|
||||
}
|
||||
}
|
||||
|
||||
func assertNoNumericUserIDs(t *testing.T, value any) {
|
||||
t.Helper()
|
||||
switch typed := value.(type) {
|
||||
|
||||
Reference in New Issue
Block a user