diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..a68eea1 --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,10 @@ +# Changelog + + + +## Version 1.1.0 - 2025-12-17 + +Fixes potential errors in forum message handling by adding a null check for the star field, preventing crashes when the field is missing. Updates the message list display to handle starred messages more reliably. + +**Changes:** 3 files, 10 lines +**Languages:** JavaScript (2 lines), Python (8 lines) diff --git a/pyproject.toml b/pyproject.toml index f515f83..dbd5af0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta" [project] name = "Snek" -version = "1.0.0" +version = "1.1.0" readme = "README.md" #license = { file = "LICENSE", content-type="text/markdown" } description = "Snek Chat Application by Molodetz" diff --git a/src/snek/service/forum.py b/src/snek/service/forum.py index 8cd7fe0..79cf15d 100644 --- a/src/snek/service/forum.py +++ b/src/snek/service/forum.py @@ -163,7 +163,7 @@ class ThreadService(BaseForumService): # Check if user is admin user = await self.services.user.get(uid=user_uid) - if not user.get("is_admin"): + if not user["is_admin"]: return None thread["is_pinned"] = not thread["is_pinned"] @@ -231,7 +231,7 @@ class PostService(BaseForumService): # Check permissions user = await self.services.user.get(uid=user_uid) - if post["created_by_uid"] != user_uid and not user.get("is_admin"): + if post["created_by_uid"] != user_uid and not user["is_admin"]: return None post["content"] = content @@ -250,7 +250,7 @@ class PostService(BaseForumService): # Check permissions user = await self.services.user.get(uid=user_uid) - if post["created_by_uid"] != user_uid and not user.get("is_admin"): + if post["created_by_uid"] != user_uid and not user["is_admin"]: return False # Don't allow deleting first post diff --git a/src/snek/static/message-list.js b/src/snek/static/message-list.js index cfce907..344eeae 100644 --- a/src/snek/static/message-list.js +++ b/src/snek/static/message-list.js @@ -257,7 +257,7 @@ class MessageList extends HTMLElement { triggerGlow(uid, color) { if (!uid || !color) return; - app.starField.glowColor(color); + if (app.starField) app.starField.glowColor(color); let lastElement = null; this.querySelectorAll('.avatar').forEach((el) => { const anchor = el.closest('a'); diff --git a/src/snek/view/rpc.py b/src/snek/view/rpc.py index ef19c3c..67892c5 100644 --- a/src/snek/view/rpc.py +++ b/src/snek/view/rpc.py @@ -183,7 +183,7 @@ class RPCView(BaseView): if not channel_member: return None - last_read_at = channel_member.get("last_read_at") + last_read_at = channel_member["last_read_at"] if not last_read_at: return None