Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/src/api/automation/automationSlackCallback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export default async (req, res) => {

await SettingsService.save({ slackWebHook: url }, req)
await Axios.post(url, {
text: 'Crowd.dev Notifier has been successfully connected.',
text: 'crowd.dev notifier has been successfully connected.',
})

res.redirect(redirectUrl)
Expand Down
3 changes: 3 additions & 0 deletions backend/src/database/repositories/automationRepository.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ export default class AutomationRepository extends RepositoryBase<
a.settings,
a.state,
a."createdAt",
a."updatedAt",
le."executedAt" as "lastExecutionAt",
le.state as "lastExecutionState",
le.error as "lastExecutionError",
Expand All @@ -189,6 +190,7 @@ export default class AutomationRepository extends RepositoryBase<
left join latest_executions le on a.id = le."automationId"
where ${conditionsString}
${this.getPaginationString(criteria)}
order by "updatedAt" desc
`
// fetch all automations for a tenant
// and include the latest execution data if available
Expand Down Expand Up @@ -219,6 +221,7 @@ export default class AutomationRepository extends RepositoryBase<
settings: row.settings,
state: row.state,
createdAt: row.createdAt,
updatedAt: row.updatedAt,
lastExecutionAt: row.lastExecutionAt,
lastExecutionState: row.lastExecutionState,
lastExecutionError: row.lastExecutionError,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,26 @@ const computeEngagementLevel = (score) => {
return ''
}

const replacements: Record<string, string> = {
'/images/integrations/linkedin-reactions/like.svg': ':thumbsup:',
'/images/integrations/linkedin-reactions/maybe.svg': ':thinking_face:',
'/images/integrations/linkedin-reactions/praise.svg': ':clap:',
'/images/integrations/linkedin-reactions/appreciation.svg': ':heart_hands:',
'/images/integrations/linkedin-reactions/empathy.svg': ':heart:',
'/images/integrations/linkedin-reactions/entertainment.svg': ':laughing:',
'/images/integrations/linkedin-reactions/interest.svg': ':bulb:',
'href="/': `href="${API_CONFIG.frontendUrl}/`,
}

const replaceHeadline = (text) => {
Object.keys(replacements).forEach((key) => {
text = text.replaceAll(key, replacements[key])
})
return text
}

export const newActivityBlocks = (activity) => {
const display = htmlToMrkdwn(`${activity.display.default}`)
const display = htmlToMrkdwn(replaceHeadline(`${activity.display.default}`))
const reach = activity.member.reach?.[activity.platform] || activity.member.reach?.total
const memberProperties = []
if (activity.member.attributes.jobTitle?.default) {
Expand All @@ -35,8 +53,8 @@ export const newActivityBlocks = (activity) => {
if (engagementLevel.length > 0) {
memberProperties.push(`*Engagement level:* ${engagementLevel}`)
}
if (activity.member.username) {
const platforms = Object.keys(activity.member.username)
if (activity.member.activeOn) {
const platforms = activity.member.activeOn
.map((platform) => integrationLabel[platform] || platform)
.join(' | ')
memberProperties.push(`*Active on:* ${platforms}`)
Expand Down Expand Up @@ -98,9 +116,11 @@ export const newActivityBlocks = (activity) => {
type: 'section',
text: {
type: 'mrkdwn',
text: `${activity.title ? `*${htmlToMrkdwn(activity.title).text}* \n ` : ''}${
htmlToMrkdwn(activity.body).text
}`,
text: `${
activity.title && activity.title !== activity.display.default
? `*${htmlToMrkdwn(activity.title).text}* \n `
: ''
}${htmlToMrkdwn(activity.body).text}`,
},
},
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { API_CONFIG } from '../../../../../../config'
import { integrationLabel } from '../../../../../../types/integrationEnums'

export const newMemberBlocks = (member) => {
const platforms = Object.keys(member.username)
const platforms = member.activeOn
const reach = member.reach?.[platforms[0]] || member.reach?.total
return {
blocks: [
Expand Down Expand Up @@ -39,75 +39,88 @@ export const newMemberBlocks = (member) => {
{
type: 'divider',
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Title/Role:*',
},
{
type: 'mrkdwn',
text: member.attributes.jobTitle?.default || '-',
},
],
},
{
type: 'divider',
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Organization:*',
},
{
type: 'mrkdwn',
text:
member.organizations.length > 0
? `<${`${API_CONFIG.frontendUrl}/organizations/${member.organizations[0].id}`}|${
...(member.attributes.jobTitle?.default
? [
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Title/Role:*',
},
{
type: 'mrkdwn',
text: member.attributes.jobTitle?.default || '-',
},
],
},
{
type: 'divider',
},
]
: []),
...(member.organizations.length > 0
? [
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Organization:*',
},
{
type: 'mrkdwn',
text: `<${`${API_CONFIG.frontendUrl}/organizations/${member.organizations[0].id}`}|${
member.organizations[0].name
}>`
: '-',
},
],
},
{
type: 'divider',
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Followers:*',
},
{
type: 'mrkdwn',
text: reach > 0 ? `${reach}` : '-',
},
],
},
{
type: 'divider',
},
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Location:*',
},
{
type: 'mrkdwn',
text: member.attributes?.location?.default || '-',
},
],
},
{
type: 'divider',
},
}>`,
},
],
},
{
type: 'divider',
},
]
: []),
...(reach > 0
? [
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Followers:*',
},
{
type: 'mrkdwn',
text: reach > 0 ? `${reach}` : '-',
},
],
},
{
type: 'divider',
},
]
: []),
...(member.attributes?.location?.default
? [
{
type: 'section',
fields: [
{
type: 'mrkdwn',
text: '*Location:*',
},
{
type: 'mrkdwn',
text: member.attributes?.location?.default || '-',
},
],
},
{
type: 'divider',
},
]
: []),
{
type: 'actions',
elements: [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
>
<i class="ri-pencil-line mr-2" /><span
class="text-xs"
>Edit webhook</span>
>Edit automation</span>
</el-dropdown-item>
<el-divider class="border-gray-200 my-2" />
<el-dropdown-item
Expand All @@ -30,7 +30,7 @@
>
<i
class="ri-delete-bin-line mr-2 text-red-500"
/><span class="text-xs text-red-500">Delete webhook</span>
/><span class="text-xs text-red-500">Delete automation</span>
</el-dropdown-item>
</template>
</el-dropdown>
Expand Down Expand Up @@ -68,7 +68,7 @@ const isReadOnly = computed(() => new AutomationPermissions(

const doDestroyWithConfirm = () => ConfirmDialog({
type: 'danger',
title: 'Delete webhook',
title: 'Delete automation',
message:
"Are you sure you want to proceed? You can't undo this action",
confirmButtonText: 'Confirm',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
:data="automations"
row-key="id"
border
:default-sort="{ prop: 'updatedAt', order: 'descending' }"
>
<el-table-column label="Name">
<el-table-column label="Name" prop="name" sortable>
<template #default="scope">
<div class="flex items-center py-4">
<div class="w-6">
Expand All @@ -32,7 +33,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="Created on" width="150">
<el-table-column label="Created on" width="150" prop="createdAt" sortable>
<template #default="scope">
<div class="h-full flex items-center">
<el-tooltip
Expand All @@ -44,7 +45,19 @@
</div>
</template>
</el-table-column>
<el-table-column label="Last execution" width="155">
<el-table-column label="Last updated" width="150" prop="updatedAt" sortable>
<template #default="scope">
<div class="h-full flex items-center">
<el-tooltip
:content="formattedDate(scope.row.updatedAt)"
placement="top"
>
{{ timeAgo(scope.row.updatedAt) }}
</el-tooltip>
</div>
</template>
</el-table-column>
<el-table-column label="Last execution" width="165" prop="lastExecutionAt" sortable>
<template #default="scope">
<div class="h-full flex items-center">
<el-tooltip
Expand All @@ -63,7 +76,7 @@
</div>
</template>
</el-table-column>
<el-table-column label="Status" width="130">
<el-table-column label="Status" width="130" prop="status" sortable>
<template #default="scope">
<div class="h-full flex items-center">
<app-automation-toggle :automation="scope.row" />
Expand Down Expand Up @@ -113,6 +126,7 @@ const { automations } = storeToRefs(automationsStore);
const timeAgo = (date) => formatDateToTimeAgo(date);
const formattedDate = (date) => moment(date).format('YYYY-MM-DD HH:mm:ss');
const translate = (key) => i18n(key);

</script>

<script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@
description="Send Slack notifications when a new activity happens, or a new member joins your community"
/>
<app-empty-state-cta
v-else-if="filter.type === 'webhooks'"
v-else-if="filter.type === 'webhook'"
icon="ri-flow-chart"
title="No Webhooks yet"
description="Create webhook actions when a new activity happens, or a new member joins your community"
Expand Down Expand Up @@ -143,7 +143,7 @@ const options = ref([
},
{
label: 'Webhooks',
value: 'webhooks',
value: 'webhook',
},
]);
const openAutomationForm = ref(false);
Expand Down