Augment post details with recipient information
This commit is contained in:
parent
7f0b5ebf34
commit
7b193a06a0
@ -19,15 +19,19 @@ var _ backupHandler[models.Conversationable, models.Postable] = &conversationsBa
|
|||||||
type conversationsBackupHandler struct {
|
type conversationsBackupHandler struct {
|
||||||
ac api.Conversations
|
ac api.Conversations
|
||||||
protectedResource string
|
protectedResource string
|
||||||
|
// SMTP address for the group
|
||||||
|
resourceEmail string
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewConversationBackupHandler(
|
func NewConversationBackupHandler(
|
||||||
protectedResource string,
|
protectedResource string,
|
||||||
ac api.Conversations,
|
ac api.Conversations,
|
||||||
|
email string,
|
||||||
) conversationsBackupHandler {
|
) conversationsBackupHandler {
|
||||||
return conversationsBackupHandler{
|
return conversationsBackupHandler{
|
||||||
ac: ac,
|
ac: ac,
|
||||||
protectedResource: protectedResource,
|
protectedResource: protectedResource,
|
||||||
|
resourceEmail: email,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -134,6 +138,13 @@ func (bh conversationsBackupHandler) augmentItemInfo(
|
|||||||
dgi *details.GroupsInfo,
|
dgi *details.GroupsInfo,
|
||||||
c models.Conversationable,
|
c models.Conversationable,
|
||||||
) {
|
) {
|
||||||
|
// Posts are always sent to the group email address, along with additional
|
||||||
|
// recipients if any. Currently, we don't have a way to get the unique
|
||||||
|
// recipient list for individual posts due to graph api limitations.
|
||||||
|
//
|
||||||
|
// Store the group mail address so that we can use it to populate the 'To'
|
||||||
|
// field during Post -> EML exports.
|
||||||
|
dgi.Post.Recipients = []string{bh.resourceEmail}
|
||||||
dgi.Post.Topic = ptr.Val(c.GetTopic())
|
dgi.Post.Topic = ptr.Val(c.GetTopic())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,6 +3,7 @@ package groups
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"strings"
|
||||||
|
|
||||||
"github.com/alcionai/clues"
|
"github.com/alcionai/clues"
|
||||||
"github.com/kopia/kopia/repo/manifest"
|
"github.com/kopia/kopia/repo/manifest"
|
||||||
@ -319,10 +320,18 @@ func backupConversations(
|
|||||||
counter *count.Bus,
|
counter *count.Bus,
|
||||||
errs *fault.Bus,
|
errs *fault.Bus,
|
||||||
) ([]data.BackupCollection, error) {
|
) ([]data.BackupCollection, error) {
|
||||||
|
groupEmail := strings.Clone(ptr.Val(bc.group.GetMail()))
|
||||||
|
// This is unlikely, but if it does happen in the wild, we should investigate it.
|
||||||
|
if len(groupEmail) == 0 {
|
||||||
|
return nil, clues.New("group has no mail address")
|
||||||
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
bh = groups.NewConversationBackupHandler(
|
bh = groups.NewConversationBackupHandler(
|
||||||
bc.producerConfig.ProtectedResource.ID(),
|
bc.producerConfig.ProtectedResource.ID(),
|
||||||
bc.apiCli.Conversations())
|
bc.apiCli.Conversations(),
|
||||||
|
groupEmail,
|
||||||
|
)
|
||||||
colls []data.BackupCollection
|
colls []data.BackupCollection
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -61,11 +61,12 @@ type GroupsInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type ConversationPostInfo struct {
|
type ConversationPostInfo struct {
|
||||||
CreatedAt time.Time `json:"createdAt,omitempty"`
|
CreatedAt time.Time `json:"createdAt,omitempty"`
|
||||||
Creator string `json:"creator,omitempty"`
|
Creator string `json:"creator,omitempty"`
|
||||||
Preview string `json:"preview,omitempty"`
|
Preview string `json:"preview,omitempty"`
|
||||||
Size int64 `json:"size,omitempty"`
|
Recipients []string `json:"recipients,omitempty"`
|
||||||
Topic string `json:"topic,omitempty"`
|
Size int64 `json:"size,omitempty"`
|
||||||
|
Topic string `json:"topic,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ChannelMessageInfo struct {
|
type ChannelMessageInfo struct {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user