diff --git a/models/list_items.go b/models/list_items.go index ff34d3ba..9858dbef 100644 --- a/models/list_items.go +++ b/models/list_items.go @@ -75,6 +75,12 @@ func GetListItemByID(listItemID int64) (listItem ListItem, err error) { return ListItem{}, ErrListItemDoesNotExist{listItemID} } + user, _, err := GetUserByID(listItem.CreatedByID) + if err != nil { + return + } + listItem.CreatedBy = user + return } diff --git a/models/list_items_create_update.go b/models/list_items_create_update.go index f5f2b9d6..60442cda 100644 --- a/models/list_items_create_update.go +++ b/models/list_items_create_update.go @@ -10,11 +10,12 @@ func CreateOrUpdateListItem(item *ListItem) (err error) { } // Check if the user exists - _, _, err = GetUserByID(item.CreatedBy.ID) + user, _, err := GetUserByID(item.CreatedBy.ID) if err != nil { return } item.CreatedByID = item.CreatedBy.ID + item.CreatedBy = user if item.ID != 0 { _, err = x.ID(item.ID).Update(item)