Compare commits
2 Commits
release-92
...
release-94
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
99bc1f4e0f | ||
|
|
3166349dfb |
@@ -275,7 +275,7 @@ CREATE OR REPLACE FUNCTION handle_suggestion_status_change()
|
|||||||
RETURNS TRIGGER AS $$
|
RETURNS TRIGGER AS $$
|
||||||
DECLARE
|
DECLARE
|
||||||
service_name TEXT;
|
service_name TEXT;
|
||||||
service_visibility "ServiceVisibility";
|
service_visibility "serviceVisibility";
|
||||||
is_user_admin_or_moderator BOOLEAN;
|
is_user_admin_or_moderator BOOLEAN;
|
||||||
BEGIN
|
BEGIN
|
||||||
-- Award karma for first approval
|
-- Award karma for first approval
|
||||||
@@ -283,7 +283,7 @@ BEGIN
|
|||||||
-- and ensure it wasn't already APPROVED.
|
-- and ensure it wasn't already APPROVED.
|
||||||
IF OLD.status IS DISTINCT FROM 'APPROVED' AND NEW.status = 'APPROVED' THEN
|
IF OLD.status IS DISTINCT FROM 'APPROVED' AND NEW.status = 'APPROVED' THEN
|
||||||
-- Fetch service details for the description
|
-- Fetch service details for the description
|
||||||
SELECT name, visibility INTO service_name, service_visibility FROM "Service" WHERE id = NEW."serviceId";
|
SELECT name, serviceVisibility INTO service_name, service_visibility FROM "Service" WHERE id = NEW."serviceId";
|
||||||
|
|
||||||
-- Only award karma if the service is public
|
-- Only award karma if the service is public
|
||||||
IF service_visibility = 'PUBLIC' THEN
|
IF service_visibility = 'PUBLIC' THEN
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import { Icon } from 'astro-icon/components'
|
|||||||
import BadgeSmall from '../../components/BadgeSmall.astro'
|
import BadgeSmall from '../../components/BadgeSmall.astro'
|
||||||
import CommentModeration from '../../components/CommentModeration.astro'
|
import CommentModeration from '../../components/CommentModeration.astro'
|
||||||
import MyPicture from '../../components/MyPicture.astro'
|
import MyPicture from '../../components/MyPicture.astro'
|
||||||
|
import Pagination from '../../components/Pagination.astro'
|
||||||
import TimeFormatted from '../../components/TimeFormatted.astro'
|
import TimeFormatted from '../../components/TimeFormatted.astro'
|
||||||
import UserBadge from '../../components/UserBadge.astro'
|
import UserBadge from '../../components/UserBadge.astro'
|
||||||
import {
|
import {
|
||||||
@@ -27,7 +28,7 @@ if (!user || (!user.admin && !user.moderator)) {
|
|||||||
const { data: params } = zodParseQueryParamsStoringErrors(
|
const { data: params } = zodParseQueryParamsStoringErrors(
|
||||||
{
|
{
|
||||||
status: commentStatusFiltersZodEnum.default('all'),
|
status: commentStatusFiltersZodEnum.default('all'),
|
||||||
page: z.number().int().positive().default(1),
|
page: z.coerce.number().int().positive().default(1),
|
||||||
},
|
},
|
||||||
Astro
|
Astro
|
||||||
)
|
)
|
||||||
@@ -241,29 +242,5 @@ const totalPages = Math.ceil(totalComments / PAGE_SIZE)
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Pagination -->
|
<!-- Pagination -->
|
||||||
{
|
{totalPages > 1 && <Pagination currentPage={params.page} totalPages={totalPages} class="mt-8" />}
|
||||||
totalPages > 1 && (
|
|
||||||
<div class="mt-8 flex justify-center gap-2">
|
|
||||||
{params.page > 1 && (
|
|
||||||
<a
|
|
||||||
href={urlWithParams(Astro.url, { page: params.page - 1 })}
|
|
||||||
class="font-title rounded-md border border-zinc-700 px-3 py-1 text-sm transition-colors hover:border-green-500/50"
|
|
||||||
>
|
|
||||||
Previous
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
<span class="font-title px-3 py-1 text-sm">
|
|
||||||
Page {params.page} of {totalPages}
|
|
||||||
</span>
|
|
||||||
{params.page < totalPages && (
|
|
||||||
<a
|
|
||||||
href={urlWithParams(Astro.url, { page: params.page + 1 })}
|
|
||||||
class="font-title rounded-md border border-zinc-700 px-3 py-1 text-sm transition-colors hover:border-green-500/50"
|
|
||||||
>
|
|
||||||
Next
|
|
||||||
</a>
|
|
||||||
)}
|
|
||||||
</div>
|
|
||||||
)
|
|
||||||
}
|
|
||||||
</BaseLayout>
|
</BaseLayout>
|
||||||
|
|||||||
@@ -7,10 +7,9 @@ import { makeSearchFiltersOptions } from '../../lib/searchFiltersOptions'
|
|||||||
import type { APIRoute } from 'astro'
|
import type { APIRoute } from 'astro'
|
||||||
|
|
||||||
export const GET: APIRoute = async ({ site }) => {
|
export const GET: APIRoute = async ({ site }) => {
|
||||||
if (!site) {
|
if (!site) return new Response('Site URL not configured', { status: 500 })
|
||||||
return new Response('Site URL not configured', { status: 500 })
|
|
||||||
}
|
|
||||||
|
|
||||||
|
try {
|
||||||
const searchUrls = await generateSEOSitemapUrls(site.href)
|
const searchUrls = await generateSEOSitemapUrls(site.href)
|
||||||
|
|
||||||
const result = `
|
const result = `
|
||||||
@@ -25,10 +24,13 @@ export const GET: APIRoute = async ({ site }) => {
|
|||||||
'Content-Type': 'application/xml',
|
'Content-Type': 'application/xml',
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
} catch (error) {
|
||||||
|
console.error('Failed to generate SEO sitemap URLs:', error)
|
||||||
|
return new Response('Failed to generate SEO sitemap URLs', { status: 500 })
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
async function generateSEOSitemapUrls(siteUrl: string) {
|
async function generateSEOSitemapUrls(siteUrl: string) {
|
||||||
try {
|
|
||||||
const [categories, attributes] = await Promise.all([
|
const [categories, attributes] = await Promise.all([
|
||||||
prisma.category.findMany({
|
prisma.category.findMany({
|
||||||
select: {
|
select: {
|
||||||
@@ -185,8 +187,4 @@ async function generateSEOSitemapUrls(siteUrl: string) {
|
|||||||
url.search = queryParams.toString()
|
url.search = queryParams.toString()
|
||||||
return url.href
|
return url.href
|
||||||
})
|
})
|
||||||
} catch (error) {
|
|
||||||
console.error('Failed to generate SEO sitemap URLs:', error)
|
|
||||||
return []
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user