Forum: search, muting members, archived topics, the public threads in the sitemap
- Search (/forum/kereses, the magnifier in the forum bar): thread titles
and posts the viewer may read, Hungarian stems and word beginnings
without accents ("alvas" finds "alvásban"), one result per thread with
the matching words marked.
- Muting a member (post menu, profile; the list in the settings): their
threads leave the lists, their posts fold up, their replies and mentions
no longer count or send e-mails. They are not told.
- The admin archives a topic (Moderálás → Témák): it stays readable but
takes no new threads or replies, and folds away on the front page.
- The public topics and threads are in the sitemap; the forum's own pages
are kept from robots.
- A reply e-mail goes to the one answered, also on the second level.
- Migration 0043 also prepares charts attached to a forum question.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_012vLHzh5qUhFtmJhzkcTbXL
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
-- Forum: archived topics, muted members, search, and charts attached to a
|
||||
-- question.
|
||||
|
||||
-- An archived topic stays readable at its address, but takes no new threads
|
||||
-- or replies, and leaves the front page lists.
|
||||
ALTER TABLE forum.topics ADD COLUMN archived_at timestamptz;
|
||||
|
||||
-- "Némítás": the muted member's threads leave the lists, their posts fold
|
||||
-- up, and their replies and mentions no longer notify. They are not told.
|
||||
CREATE TABLE forum.mutes (
|
||||
user_id uuid NOT NULL REFERENCES users ON DELETE CASCADE,
|
||||
muted_id uuid NOT NULL REFERENCES users ON DELETE CASCADE,
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
PRIMARY KEY (user_id, muted_id),
|
||||
CHECK (user_id <> muted_id)
|
||||
);
|
||||
|
||||
-- Search: Hungarian stems (szálak → szál), and the words without accents
|
||||
-- too, so "alvas" finds "alvás".
|
||||
CREATE EXTENSION IF NOT EXISTS unaccent;
|
||||
CREATE TEXT SEARCH CONFIGURATION forum.plain (COPY = simple);
|
||||
ALTER TEXT SEARCH CONFIGURATION forum.plain ALTER MAPPING FOR hword, hword_part, word WITH unaccent, simple;
|
||||
|
||||
ALTER TABLE forum.threads ADD COLUMN search tsvector GENERATED ALWAYS AS (
|
||||
to_tsvector('hungarian'::regconfig, title) || to_tsvector('forum.plain'::regconfig, title)
|
||||
) STORED;
|
||||
ALTER TABLE forum.posts ADD COLUMN search tsvector GENERATED ALWAYS AS (
|
||||
to_tsvector('hungarian'::regconfig, body) || to_tsvector('forum.plain'::regconfig, body)
|
||||
) STORED;
|
||||
CREATE INDEX threads_search_idx ON forum.threads USING gin (search);
|
||||
CREATE INDEX posts_search_idx ON forum.posts USING gin (search);
|
||||
|
||||
-- A question about one's own chart, forecast or synastry: the opening post
|
||||
-- carries a share made for the forum (see below), shown to members only.
|
||||
ALTER TABLE forum.posts ADD COLUMN share_id uuid REFERENCES shares ON DELETE SET NULL;
|
||||
|
||||
-- Shares made for the forum: never birth data, and the public view leaves
|
||||
-- out the chart names (they may be real names next to a nickname).
|
||||
ALTER TABLE shares ADD COLUMN for_forum boolean NOT NULL DEFAULT false;
|
||||
|
||||
-- A yearly forecast can be shared too (its calculation, and the detailed
|
||||
-- text if there is one), without the place of the birthday.
|
||||
ALTER TABLE shares ADD COLUMN forecast_id uuid REFERENCES forecasts ON DELETE CASCADE;
|
||||
ALTER TABLE shares DROP CONSTRAINT shares_kind_check;
|
||||
ALTER TABLE shares ADD CONSTRAINT shares_kind_check CHECK (kind IN ('chart', 'synastry', 'analysis', 'forecast'));
|
||||
ALTER TABLE shares DROP CONSTRAINT shares_target;
|
||||
ALTER TABLE shares ADD CONSTRAINT shares_target CHECK (
|
||||
(kind = 'chart' AND chart_id IS NOT NULL AND synastry_id IS NULL AND analysis_id IS NULL AND forecast_id IS NULL)
|
||||
OR (kind = 'synastry' AND synastry_id IS NOT NULL AND chart_id IS NULL AND analysis_id IS NULL AND forecast_id IS NULL)
|
||||
OR (kind = 'analysis' AND analysis_id IS NOT NULL AND chart_id IS NULL AND synastry_id IS NULL AND forecast_id IS NULL)
|
||||
OR (kind = 'forecast' AND forecast_id IS NOT NULL AND chart_id IS NULL AND synastry_id IS NULL AND analysis_id IS NULL)
|
||||
);
|
||||
Reference in New Issue
Block a user