Fix attachment issues on cmp&msg
This commit is contained in:
parent
fb32fa151c
commit
8fa00d04d7
@ -348,6 +348,7 @@ func (svc attachment) create(name string, size int64, fh io.ReadSeeker, att *typ
|
||||
|
||||
// preset attachment ID because we need ref for storage
|
||||
att.ID = nextID()
|
||||
att.CreatedAt = *now()
|
||||
|
||||
if att.OwnerID == 0 {
|
||||
att.OwnerID = auth.GetIdentityFromContext(svc.ctx).Identity()
|
||||
|
||||
@ -116,10 +116,8 @@ func (svc attachment) CreateMessageAttachment(name string, size int64, fh io.Rea
|
||||
}
|
||||
|
||||
att = &types.Attachment{
|
||||
ID: nextID(),
|
||||
OwnerID: currentUserID,
|
||||
Name: strings.TrimSpace(name),
|
||||
CreatedAt: *now(),
|
||||
OwnerID: currentUserID,
|
||||
Name: strings.TrimSpace(name),
|
||||
}
|
||||
|
||||
err = svc.create(name, size, fh, att)
|
||||
@ -139,6 +137,7 @@ func (svc attachment) CreateMessageAttachment(name string, size int64, fh io.Rea
|
||||
ChannelID: channelID,
|
||||
ReplyTo: replyTo,
|
||||
UserID: currentUserID,
|
||||
CreatedAt: *now(),
|
||||
}
|
||||
|
||||
if strings.HasPrefix(att.Meta.Original.Mimetype, "image/") {
|
||||
@ -169,6 +168,9 @@ func (svc attachment) create(name string, size int64, fh io.ReadSeeker, att *typ
|
||||
aProps = &attachmentActionProps{}
|
||||
)
|
||||
|
||||
att.ID = nextID()
|
||||
att.CreatedAt = *now()
|
||||
|
||||
if svc.files == nil {
|
||||
return fmt.Errorf("can not create attachment: store handler not set")
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user