Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

REmove github special case #303

Merged
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
26 changes: 9 additions & 17 deletions utils/actions/markdownHelpers/helper.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { MarkdownRequest, MarkdownResponse } from "../../../types/watermelon";
import getRelativeDate from "../../getRelativeDate";
import getRelativeDate from "../../getRelativeDate";

type generalMarkdown = MarkdownRequest & {
systemName: string;
Expand All @@ -20,22 +20,14 @@ const generalMarkdownHelper = ({
let markdown: MarkdownResponse = ``;
if (Array.isArray(value.data) && value?.data?.length) {
markdown = `\n #### ${systemResponseName}`;

if (systemName === "GitHub") {
markdown += (value?.data || [])
.map(
({ number, title, link, body, created_at, author}) =>
`\n - [#${number} - ${title}](${link}) - By ${author} ${getRelativeDate(created_at || "")} \n`
)
.join("");
} else {
markdown += (value?.data || [])
.map(
({ number, title, link, body }) =>
`\n - [#${number} - ${title}](${link})\n`
)
.join("");
}
markdown += (value?.data || [])
.map(
({ number, title, link, body, author, created_at }) =>
`\n - [#${number} - ${title}](${link}) ${
author ? ` - By ${author}` : ""
} ${created_at ? `${getRelativeDate(created_at ?? "")}` : ""}\n`
)
.join("");
} else {
markdown += `\n No results found in **${systemResponseName}** :( \n`;
}
Expand Down