mirror of
https://github.com/CompassConnections/Compass.git
synced 2026-04-10 17:48:41 -04:00
Fix
This commit is contained in:
@@ -25,8 +25,13 @@ export const contact: APIHandler<'contact'> = async (
|
||||
|
||||
const continuation = async () => {
|
||||
try {
|
||||
let user = null
|
||||
if (userId) {
|
||||
user = await pg.oneOrNone(` select name from users where id = $1 `, [userId])
|
||||
}
|
||||
const md = jsonToMarkdown(content)
|
||||
const message: string = `**New Contact Message**\n${md}`
|
||||
const tile = user ? `New message from ${user.name}` : 'New message'
|
||||
const message: string = `**${tile}**\n${md}`
|
||||
await sendDiscordMessage(message, 'contact')
|
||||
} catch (e) {
|
||||
console.error('Failed to send discord contact', e)
|
||||
|
||||
@@ -8,7 +8,7 @@ create table if not exists
|
||||
|
||||
-- Foreign Keys
|
||||
alter table contact
|
||||
add constraint contact_user_id_fkey foreign key (user_id) references users (id);
|
||||
add constraint contact_user_id_fkey foreign key (user_id) references users (id) on delete set null;
|
||||
|
||||
-- Row Level Security
|
||||
alter table contact enable row level security;
|
||||
|
||||
@@ -8,15 +8,15 @@ create table if not exists
|
||||
id text default uuid_generate_v4 () not null,
|
||||
parent_id text,
|
||||
parent_type text,
|
||||
user_id text not null
|
||||
user_id text
|
||||
);
|
||||
|
||||
-- Foreign Keys
|
||||
alter table reports
|
||||
add constraint reports_content_owner_id_fkey foreign key (content_owner_id) references users (id);
|
||||
add constraint reports_content_owner_id_fkey foreign key (content_owner_id) references users (id) on delete set null;
|
||||
|
||||
alter table reports
|
||||
add constraint reports_user_id_fkey foreign key (user_id) references users (id);
|
||||
add constraint reports_user_id_fkey foreign key (user_id) references users (id) on delete set null;
|
||||
|
||||
-- Row Level Security
|
||||
alter table reports enable row level security;
|
||||
|
||||
Reference in New Issue
Block a user