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 defaultState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,5 +89,5 @@ export const defaultState = `
<p></p>

<h3>💬&nbsp;Messages</h3>
<p>Questions? Chat with the {workspace.brandName} team and get answers.</p>
<p>Questions? Chat with the ${brandNameAutofill} team and get answers.</p>
`
43 changes: 43 additions & 0 deletions scripts/replace-static-placeholder/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
import DBClient from '@/lib/db'

const db = DBClient.getInstance()

const run = async () => {
const faultyContent = await db.setting.findMany({
where: {
content: {
contains: ' {workspace.brandName} ',
},
},
})

console.info(
`Found ${faultyContent.length} faulty rows with hardcoded {workspace.brandName}`,
)

let counter = 0

for (const row of faultyContent) {
// Replace static placeholder with data that was supposed to be rendered
const newContent = row.content?.replaceAll(
' {workspace.brandName} ',
' <span data-type="mention" class="autofill-pill" data-id="{{workspace.brandName}}">{{workspace.brandName}}</span> ',
)
try {
// This technically can be done with an updateMany -> regex replace matcher but, meh
console.info(' > Fixing data for setting with id', row.id)
await db.setting.update({
where: { id: row.id },
data: {
content: newContent,
},
})
counter++
} catch (e) {
console.error(e)
}
}
console.info('Fixed static rows for', counter, 'entries')
}

run()
2 changes: 1 addition & 1 deletion src/app/globals.css
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ table {
margin-top: 4px;
margin-bottom: 4px;
padding: 3px 0px;
word-break:break-word;
word-break: break-word;
}

.callout-container > .callout-icon {
Expand Down
Loading