16 Commits

Author SHA1 Message Date
588ab3c3de gdfsgfds 2026-01-26 10:21:44 +01:00
46fb7067ed revert 166ba96f0f
revert revert c4bb21bc31

revert possible fix for slow loading times for non logged in users
2026-01-26 09:15:37 +00:00
5815334e7b revert 6bfb200626
revert revert c4bb21bc31

revert possible fix for slow loading times for non logged in users
2026-01-26 09:15:17 +00:00
6bfb200626 revert c4bb21bc31
revert possible fix for slow loading times for non logged in users
2026-01-26 09:11:29 +00:00
166ba96f0f revert c4bb21bc31
revert possible fix for slow loading times for non logged in users
2026-01-26 09:10:48 +00:00
a2ebea2ba3 if this fails I revert 2026-01-26 10:09:11 +01:00
91546a1f0d lets try it out lmao 2026-01-26 10:04:53 +01:00
017ac4ca4c bruh 2026-01-26 10:00:59 +01:00
cb31cfd85b possible random performance improvement ? 2026-01-26 09:58:30 +01:00
a5acc22c4a possible performance improvement for random 2026-01-26 09:47:05 +01:00
dbcf39c3ba possible query optimization for random large datasets 2026-01-26 09:37:57 +01:00
4d2fd7561f possible performance optimization 2026-01-26 09:31:02 +01:00
c4bb21bc31 possible fix for slow loading times for non logged in users 2026-01-26 09:24:27 +01:00
7d58acd5ed visually enhancing comment section 2026-01-26 07:33:29 +01:00
286791de0d feat: Implement custom emojis, pinned comments, and comment locking with database schema changes and frontend rendering updates. 2026-01-25 23:01:31 +01:00
1b8a9185bb Merge pull request 'feat: Introduce custom emojis, pinned comments, and thread locking with database schema, client-side caching, and UI updates.' (#6) from comments-fix into f0bm
Reviewed-on: #6
2026-01-25 21:37:10 +00:00
6 changed files with 23 additions and 13 deletions

View File

@@ -0,0 +1 @@
CREATE INDEX CONCURRENTLY IF NOT EXISTS tags_assign_tag_id_idx ON public.tags_assign (tag_id);

View File

@@ -3848,7 +3848,7 @@ input#s_avatar {
/* Comments System */
#comments-container {
padding: 0px 5px 5px 5px;
background: var(--metadata-bg);
background: #00000087;
color: var(--white);
font-family: var(--font);
}
@@ -3941,7 +3941,7 @@ input#s_avatar {
.comment-input textarea {
width: 100%;
min-height: 80px;
background: var(--bg);
background: #000000a1;
border: 1px solid var(--gray);
color: var(--white);
padding: 10px;
@@ -4028,6 +4028,11 @@ input#s_avatar {
text-decoration: underline;
}
#comment-sort, #subscribe-btn, #lock-thread-btn {
background: none;
border: none;
}
/* Admin buttons */
.admin-edit-btn,
.admin-delete-btn {

View File

@@ -53,9 +53,8 @@ class CommentSystem {
// If comments are already rendered, we might need to re-render them to show emojis
// but usually loadComments also happens async.
// To be safe, if we just got emojis, trigger a silent update if container exists
if (this.container && this.container.querySelector('.comment-content')) {
// This is a bit heavy, but ensures emojis appear if they loaded AFTER comments
// For now let's just let it be.
if (this.container && this.lastData) {
this.render(this.lastData, this.lastUserId, this.lastIsSubscribed);
}
} else {
this.customEmojis = {};
@@ -188,6 +187,11 @@ class CommentSystem {
}
render(comments, currentUserId, isSubscribed) {
// Store for re-rendering when emojis load
this.lastData = comments;
this.lastUserId = currentUserId;
this.lastIsSubscribed = isSubscribed;
// Build two-level tree: top-level comments + all replies at one level
const map = new Map();
const roots = [];

View File

@@ -47,7 +47,7 @@ export default new class {
tmp = "items.id in (select item_id from tags_assign where tag_id = 2 group by item_id)";
break;
case 2: // untagged
tmp = "items.id not in (select item_id from tags_assign group by item_id)";
tmp = "not exists (select 1 from tags_assign where item_id = items.id)";
break;
case 3: // all
tmp = "1 = 1";
@@ -94,7 +94,7 @@ export default new class {
const untagged = +(await db`
select count(*) as total
from "items"
where id not in (select item_id from tags_assign group by item_id) and active = true
where not exists (select 1 from tags_assign where item_id = items.id) and active = true
`)[0].total;
const sfw = +(await db`
select count(*) as total

View File

@@ -33,7 +33,7 @@ export default {
${o.fav ? db`and "user".user ilike ${'%' + user + '%'}` : db``}
${!o.fav && user ? db`and items.username ilike ${'%' + user + '%'}` : db``}
${mime ? db`and items.mime ilike ${smime}` : db``}
${!o.session && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
${!o.session && globalfilter ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
group by items.id, tags.tag
`)?.length || 0;
@@ -67,7 +67,7 @@ export default {
${o.fav ? db`and "user".user ilike ${'%' + user + '%'}` : db``}
${!o.fav && user ? db`and items.username ilike ${'%' + user + '%'}` : db``}
${mime ? db`and items.mime ilike ${smime}` : db``}
${!o.session && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
${!o.session && globalfilter ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
group by items.id, tags.tag, ta.tag_id
order by items.id desc
offset ${offset}
@@ -131,7 +131,7 @@ export default {
${o.fav ? db`and "user"."user" ilike ${user}` : db``}
${!o.fav && user ? db`and items.username ilike ${'%' + user + '%'}` : db``}
${mime ? db`and items.mime ilike ${smime}` : db``}
${!o.session && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
${!o.session && globalfilter ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
group by items.id, tags.tag, ta.tag_id
order by items.id desc
`;
@@ -234,7 +234,7 @@ export default {
and "user".user ilike ${'%' + user + '%'}
and items.active = 'true'
${mime ? db`and items.mime ilike ${smime}` : db``}
${!o.session && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
${!o.session && globalfilter ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
group by items.id
order by random()
limit 1
@@ -253,7 +253,7 @@ export default {
${tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db``}
${user ? db`and items.username ilike ${'%' + user + '%'}` : db``}
${mime ? db`and items.mime ilike ${smime}` : db``}
${!o.session && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
${!o.session && globalfilter ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
group by items.id, tags.tag
order by random()
limit 1

View File

@@ -40,7 +40,7 @@ export default router => {
active = 'true'
${isFav ? db`and fu."user" = ${user}` : db`and items.username ilike ${user}`}
${tag ? db`and tags.normalized ilike '%' || slugify(${tag}) || '%'` : db``}
${!hasSession && globalfilter ? db`and items.id not in (select item_id from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
${!hasSession && globalfilter ? db`and not exists (select 1 from tags_assign where item_id = items.id and (${db.unsafe(globalfilter)}))` : db``}
order by random()
limit 1
`;