Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
88 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
import { generateModels } from './connectionResolver'; | ||
import { sendContactsMessage } from './messageBroker'; | ||
|
||
export default { | ||
collectItems: async ({ subdomain, data }) => { | ||
const { contentId } = data; | ||
|
||
const customer = await sendContactsMessage({ | ||
subdomain, | ||
action: 'customers.findOne', | ||
isRPC: true, | ||
data: { | ||
_id: contentId | ||
} | ||
}); | ||
|
||
if (!customer) { | ||
return { | ||
status: 'success', | ||
data: [] | ||
}; | ||
} | ||
|
||
const models = await generateModels(subdomain); | ||
const messages = await models.Messages.find({ | ||
'to.address': customer.primaryEmail | ||
}); | ||
|
||
const results: any = []; | ||
|
||
for (const message of messages) { | ||
results.push({ | ||
_id: message._id, | ||
contentType: 'imap:customer', | ||
createdAt: message.createdAt, | ||
contentTypeDetail: message | ||
}); | ||
} | ||
|
||
return { | ||
status: 'success', | ||
data: results | ||
}; | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
import React from 'react'; | ||
|
||
type Props = { | ||
contentType: string; | ||
activity: any; | ||
currentUser: any; | ||
}; | ||
|
||
class ActivityItem extends React.Component<Props> { | ||
render() { | ||
const { activity } = this.props; | ||
const { contentTypeDetail } = activity; | ||
const { body, subject } = contentTypeDetail; | ||
|
||
return ( | ||
<div> | ||
<span> | ||
<strong>Sent an email</strong> | ||
</span> | ||
|
||
<p> | ||
<span>Subject:</span> | ||
<div>{subject}</div> | ||
</p> | ||
|
||
<p> | ||
<span>Content:</span> | ||
<div dangerouslySetInnerHTML={{ __html: body }} /> | ||
</p> | ||
</div> | ||
); | ||
} | ||
} | ||
|
||
export default ActivityItem; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.