# Suggestion Box

## Installation

Apply `database/migrations/20261016_suggestion_box.sql` before opening this update. Copy updated source files while preserving live environment configuration and private uploads, then hard refresh (Ctrl+F5). The full schema includes the new tables for fresh installations. Earlier migrations remain required for their features.

## Student experience

The former Messages menu now opens Suggestion Box. Students can share a title, category and idea with the school community, like/unlike suggestions, and add comments. Names are visible: this is a shared school feed, not anonymous or private messaging. Categories cover Learning, Facilities, Software & ICT, Student life and Other. My suggestions, category filtering and search help find relevant discussions.

Suggestions load newest-first in batches of 10 using an ID cursor. Comments load only when opened, 20 at a time, with Load older comments. Likes and comments update their own card without reloading the feed. Search is debounced. No automatic feed polling, external social-network SDK, image upload or heavyweight feed dependency is added. Use Refresh to retrieve new contributions. The existing notice badge retains its separate lightweight count refresh.

## Accounts and permissions

Only students create suggestions. Signed-in students, HODs, administrators and staff can read, like and comment. Administrator/HOD comments show their role. Authors can remove their own suggestions or comments; administrators can moderate school content. Removal requires a confirmation dialog and hides content from the active feed. Original private conversations and messaging records remain in the database and are not copied into the public suggestion feed. Legacy message-page URLs now open Suggestion Box.

## Reliability

Each like is keyed by suggestion and account. Like/unlike requests state the desired result, so retries do not add extra votes. Post-row locks and transactions keep counters consistent when likes or comments arrive together. POST requests require a valid session and CSRF token, content is rendered as text, and server-side rate limits apply. Titles are limited to 160 bytes, suggestions to 5,000 bytes and comments to 2,000 bytes. Student data exposed in the feed is limited to author ID, display name and role.

New tables: suggestions, suggestion_likes and suggestion_comments.

## Verification

Passed: PHP syntax, paginated feed and lazy-comment controller tests, targeted like/unlike/comment updates, post/removal flows, owner/admin permission checks and repeated-like counter consistency against the actual SQL statements. Existing notices, badge, papers and project controller tests also passed. Live MySQL installation, concurrent requests, authenticated role checks and visual browser validation remain to be checked on the deployment server.

Commands: node tests/suggestions_ui.cjs; php tests/suggestions_rules.php.
