From 9d682aea1cebf25ccd8fd2f64d4e7e53d2910f16 Mon Sep 17 00:00:00 2001 From: Faithy4444 <161722786+Faithy4444@users.noreply.github.com> Date: Sat, 24 Jan 2026 00:53:58 +0200 Subject: [PATCH 1/3] hashtag link fixed --- backend/data/blooms.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/data/blooms.py b/backend/data/blooms.py index 7e280cf..db3c369 100644 --- a/backend/data/blooms.py +++ b/backend/data/blooms.py @@ -16,7 +16,11 @@ class Bloom: def add_bloom(*, sender: User, content: str) -> Bloom: - hashtags = [word[1:] for word in content.split(" ") if word.startswith("#")] + + if len(content) > 280: + raise ValueError("Bloom content cannot exceed 280 characters") + + hashtags = re.findall(r'#(\w+)', content) now = datetime.datetime.now(tz=datetime.UTC) bloom_id = int(now.timestamp() * 1000000) From 99677a8e930f6cad7b44beb025da7f62d6778c70 Mon Sep 17 00:00:00 2001 From: Faithy4444 <161722786+Faithy4444@users.noreply.github.com> Date: Sun, 25 Jan 2026 23:34:48 +0200 Subject: [PATCH 2/3] changed to only fetch hashtags when the hashtag changes --- front-end/index.html | 6 +++--- front-end/views/hashtag.mjs | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/front-end/index.html b/front-end/index.html index 89d6b13..b1793d4 100644 --- a/front-end/index.html +++ b/front-end/index.html @@ -4,14 +4,14 @@ Purple Forest - +

Purple Forest Share a Bloom

Please enable JavaScript in your browser.

- + diff --git a/front-end/views/hashtag.mjs b/front-end/views/hashtag.mjs index 7b7e996..45293de 100644 --- a/front-end/views/hashtag.mjs +++ b/front-end/views/hashtag.mjs @@ -17,7 +17,11 @@ import {createHeading} from "../components/heading.mjs"; function hashtagView(hashtag) { destroy(); - apiService.getBloomsByHashtag(hashtag); +// changed to only fetch hashtags when hashtag changes + if (state.currentHashtag !== hashtag) { + state.currentHashtag = hashtag; + apiService.getBloomsByHashtag(hashtag); + } renderOne( state.isLoggedIn, From 3e648c1512b3205b28cc8353de2edd4252f55f26 Mon Sep 17 00:00:00 2001 From: Faithy4444 <161722786+Faithy4444@users.noreply.github.com> Date: Sun, 25 Jan 2026 23:55:44 +0200 Subject: [PATCH 3/3] extra rendering logic removed --- front-end/views/hashtag.mjs | 29 ++++------------------------- 1 file changed, 4 insertions(+), 25 deletions(-) diff --git a/front-end/views/hashtag.mjs b/front-end/views/hashtag.mjs index 45293de..86bb048 100644 --- a/front-end/views/hashtag.mjs +++ b/front-end/views/hashtag.mjs @@ -1,46 +1,25 @@ -import {renderOne, renderEach, destroy} from "../lib/render.mjs"; +import {renderOne, renderEach,} from "../lib/render.mjs"; import { state, apiService, - getLogoutContainer, - getLoginContainer, getTimelineContainer, getHeadingContainer, } from "../index.mjs"; -import {createLogin, handleLogin} from "../components/login.mjs"; -import {createLogout, handleLogout} from "../components/logout.mjs"; import {createBloom} from "../components/bloom.mjs"; import {createHeading} from "../components/heading.mjs"; // Hashtag view: show all tweets containing this tag function hashtagView(hashtag) { - destroy(); -// changed to only fetch hashtags when hashtag changes + // changed to only fetch hashtags when hashtag changes if (state.currentHashtag !== hashtag) { state.currentHashtag = hashtag; + state.isLoadingHashtag = true; apiService.getBloomsByHashtag(hashtag); } - renderOne( - state.isLoggedIn, - getLogoutContainer(), - "logout-template", - createLogout - ); - document - .querySelector("[data-action='logout']") - ?.addEventListener("click", handleLogout); - renderOne( - state.isLoggedIn, - getLoginContainer(), - "login-template", - createLogin - ); - document - .querySelector("[data-action='login']") - ?.addEventListener("click", handleLogin); + renderOne( state.currentHashtag,