Add Popup Window Feature#18
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is 📢 Thoughts on this report? Let us know! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a site-wide popup feature: admins can create/manage popups with images stored in the S3 media store (under popups/), and end-users see an on-visit popup carousel with a “hide for 24 hours” option.
Changes:
- Add
popupspersistence (model/repo/service), plus DB auto-migration/index + SQL migration scripts. - Add HTTP endpoints for public “active popups” and admin CRUD + image upload/finalize/delete flows, with integration/handler/service/repo tests.
- Add frontend admin UI for managing popups and a user-facing popup carousel, plus shared
mediaURL()helper + i18n updates.
Reviewed changes
Copilot reviewed 38 out of 38 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| migrations/2026-06-06/999_rollback.sql | Rollback script for removing popups table. |
| migrations/2026-06-06/001_add_popups.sql | Forward migration creating popups table + index. |
| internal/storage/s3_media_test.go | Updates storage test to use the renamed in-memory media store. |
| internal/storage/memory.go | Renames in-memory store to a generic media store and updates presign URL. |
| internal/service/vm_service_test.go | Uses t.Context() for TTL reaper tests. |
| internal/service/testenv_test.go | Wires popup repo/service into the service test environment and truncation list. |
| internal/service/popup_service.go | Implements popup business logic + image upload lifecycle. |
| internal/service/popup_service_test.go | Adds unit tests for popup service behavior and validations. |
| internal/service/errors.go | Adds ErrPopupNotFound. |
| internal/service/community_service_test.go | Updates loop style for seeding likes. |
| internal/repo/testenv_test.go | Adds popups to repo test DB truncation list. |
| internal/repo/popup_repo.go | Adds Bun repo for popup CRUD + active listing query. |
| internal/repo/popup_repo_test.go | Adds repo integration tests for popup CRUD + active list. |
| internal/repo/community_repo_test.go | Updates loop style for seeding likes. |
| internal/models/popup.go | Adds models.Popup DB model. |
| internal/http/router.go | Wires popup handlers + registers public/admin popup routes. |
| internal/http/integration/testenv_test.go | Wires popup repo/service into HTTP integration env and router construction. |
| internal/http/integration/popups_test.go | Adds end-to-end tests for popup endpoints and auth/validation. |
| internal/http/integration/community_test.go | Updates loop style for like-threshold test setup. |
| internal/http/handlers/types.go | Adds request/response DTOs for popups + mapping helpers. |
| internal/http/handlers/testenv_test.go | Wires popup service into handler test environment. |
| internal/http/handlers/handler.go | Adds popup handler methods + updates handler constructor signature. |
| internal/http/handlers/handler_test.go | Adds handler-level popup endpoint tests and updates constructor call sites. |
| internal/http/handlers/errors.go | Maps ErrPopupNotFound to HTTP 404. |
| internal/db/db.go | Adds popup model to auto-migrate and creates popup index. |
| frontend/src/routes/admin/Popups.tsx | Admin UI for listing/creating/updating/deleting popups and uploading images. |
| frontend/src/routes/Admin.tsx | Adds “Popups” tab and renders admin popup management page. |
| frontend/src/locales/ko.json | Adds admin + popup carousel strings (Korean). |
| frontend/src/locales/ja.json | Adds admin + popup carousel strings (Japanese). |
| frontend/src/locales/en.json | Adds admin + popup carousel strings (English). |
| frontend/src/lib/types.ts | Adds popup-related API types. |
| frontend/src/lib/media.ts | Adds shared mediaURL() helper for S3 media CDN URLs. |
| frontend/src/lib/api.ts | Adds popup API client functions. |
| frontend/src/components/UserAvatar.tsx | Switches avatar CDN URL building to shared mediaURL(). |
| frontend/src/components/PopupCarousel.tsx | Adds user-facing popup carousel with “hide for a day” behavior. |
| frontend/src/App.tsx | Mounts popup carousel globally. |
| docs/docs/admin.md | Documents popup endpoints and image upload flow. |
| cmd/server/main.go | Wires popup repo/service into server startup and router creation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR introduces a popup window feature that displays a popup when users visit the site.
Administrators can register popup images, which will then be displayed to users upon visiting the site. The frontend includes a "Do not show for a day" option, allowing users to hide the popup for 24 hours.
The following APIs have been added:
GET /popupsPOST /popupsPUT /popups/{id}DELETE /popups/{id}POST /popups/{id}/image/uploadPUT /popups/{id}/imageDELETE /popups/{id}/imageImage uploads use the S3 Media Store.
Previously, this storage was used primarily for profile images (
/profiles/). Since it is intended as a dedicated media storage location, popup images are stored under the/popups/path.For more details, please refer to the updated source code and API documentation.