Open platform to collect and prioritize feedback
New posts / ideas - revised UI / UX (#1318)
Matt Robertsf78a433759b1
diff --git a/.github/workflows/locale.yml b/.github/workflows/locale.ymlindex 29de153fb..513a1f72a 100644--- a/.github/workflows/locale.yml+++ b/.github/workflows/locale.yml@@ -42,7 +42,7 @@ jobs:uses: peter-evans/create-pull-request@v6with:commit-message: "Auto-translate missing keys in locales"- title: "Auto-translate missing keys in locales"+ title: "[${{ github.head_ref || github.ref_name }}] Auto-translate missing keys in locales"body: "This PR adds machine-translated values for any missing locale keys."branch: auto/translate-missing-keysadd-paths: |diff --git a/CLAUDE.md b/CLAUDE.mdnew file mode 100644index 000000000..055e41378--- /dev/null+++ b/CLAUDE.md@@ -0,0 +1,215 @@+# CLAUDE.md++This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.++## Common Development Commands++### Building++- `make build` - Build both server and UI+- `make build-server` - Build Go server binary+- `make build-ui` - Build UI assets with webpack+- `make build-ssr` - Build SSR script and compile locales++### Running++- `make run` - Run Fider server (requires build first)+- `make watch` - Start both server and UI in watch mode (recommended for development)+- `make watch-server` - Run server in watch mode with air+- `make watch-ui` - Run UI in watch mode with webpack+- `make migrate` - Run database migrations++### Testing++- `make test` - Run both server and UI tests+- `make test-server` - Run Go server tests (includes migration)+- `make test-ui` - Run Jest tests for React components+- `make coverage-server` - Run server tests with coverage+- `make test-e2e-server` - Run E2E tests for server features+- `make test-e2e-ui` - Run E2E tests for UI features++### Linting++- `make lint` - Lint both server and UI code+- `make lint-server` - Run golangci-lint on Go code+- `make lint-ui` - Run ESLint on TypeScript/React code++### Other++- `make clean` - Remove build artifacts+- `make help` - Show all available make targets++## Project Architecture++### Backend (Go)++Fider uses a layered architecture with clean separation of concerns:++**Core Structure:**++- `main.go` - Entry point with command routing (ping, migrate, server)+- `app/cmd/` - Command implementations and server bootstrap+- `app/cmd/routes.go` - All routes are defined here+- `app/handlers/` - HTTP handlers organized by functionality+- `app/middlewares/` - HTTP middleware chain+- `app/models/` - Data models (cmd, dto, entity, enum, query)+- `app/services/` - Service implementations with dependency injection+- `app/pkg/` - Reusable packages and utilities++**Key Patterns:**++- **Bus Architecture**: Uses `app/pkg/bus` for service registration and dispatch+- **CQRS**: Commands and queries are separated in `app/models/`+- **Service Layer**: All external services (email, blob storage, oauth) are abstracted+- **Middleware Chain**: Authentication, tenant resolution, CORS, etc.++**Database:**++- PostgreSQL with custom migration system in `migrations/`+- SQL-based data access through service interfaces+- Tenant-aware data isolation++### Frontend (React/TypeScript)++Modern React application with TypeScript:++**Structure:**++- `public/index.tsx` - Application entry point with React 18+- `public/components/` - Reusable UI components+- `public/pages/` - Page-level components organized by feature+- `public/services/` - Client-side services and utilities+- `public/hooks/` - Custom React hooks++**Key Features:**++- **SSR Support**: Server-side rendering with hydration+- **Internationalization**: LinguiJS for i18n with locale switching+- **Component Library**: Extensive set of reusable components+- **State Management**: React Context for global state+- **Error Boundaries**: Comprehensive error handling++**Build System:**++- Webpack for bundling with CSS extraction+- ESBuild for SSR compilation+- SCSS for styling with utility classes+- Asset optimization and code splitting++### API Design++RESTful API with multiple access levels:++- `/api/v1/` - Public API (no auth required)+- Member API - Authenticated users+- Staff API - Collaborators and administrators+- Admin API - Administrators only++### Key Services++The application includes pluggable services for:++- **Email**: SMTP, Mailgun, AWS SES+- **Blob Storage**: Filesystem, S3, SQL+- **OAuth**: Custom providers, GitHub, Google, etc.+- **Billing**: Paddle integration (optional)+- **Webhooks**: Outbound event notifications++## Development Setup Requirements++1. **Go 1.22+** - Backend development+2. **Node.js 21/22** - Frontend build tools and TypeScript+3. **Docker** - PostgreSQL and local SMTP (MailHog)+4. **Air** - Go hot reload: `go install github.com/cosmtrek/air`+5. **Godotenv** - Environment loading: `go install github.com/joho/godotenv/cmd/godotenv`+6. **golangci-lint** - Go linting: `go install github.com/golangci/golangci-lint/cmd/[email protected]`++**Environment Setup:**++- Copy `.example.env` to `.env` for local configuration+- Run `docker compose up -d` for PostgreSQL and MailHog+- MailHog UI available at http://localhost:8025++## Testing Strategy++**Backend Testing:**++- Unit tests alongside source files (`*_test.go`)+- Integration tests with test database+- E2E tests using Cucumber for server features++**Frontend Testing:**++- Jest for unit/component tests+- Testing Library for React components+- E2E tests using Cucumber + Playwright++**Test Environment:**++- Uses `.test.env` for test-specific configuration+- Automated database migrations before test runs+- Coverage reporting available++## Code Organization Principles++### Backend Model Naming Conventions++Follow these strict naming patterns for `app/models/`:++- **`action.<something>`** - User interactions for POST/PUT/PATCH requests, map 1-to-1 with Commands (e.g., `action.CreateNewUser`)+- **`dto.<something>`** - Data transfer objects between packages/services (e.g., `dto.NewUserInfo`)+- **`entity.<something>`** - Objects mapped to database tables (e.g., `entity.User`)+- **`cmd.<something>`** - Commands that must be executed and potentially return values (e.g., `cmd.HttpRequest`, `cmd.LogDebug`, `cmd.SendMail`, `cmd.CreateNewUser`)+- **`query.<something>`** - Queries to get information from somewhere (e.g., `query.GetUserById`, `query.GetAllPosts`)++### Frontend Structure Conventions++- **Page Organization**: Each page has its own folder under `public/pages/` with:+ - `index.ts` - Module exporter+ - `[PageName].page.tsx` - Main page component+ - `[PageName].page.scss` - Page-specific styles+ - `[PageName].page.spec.tsx` - Unit tests+ - `./components/` - Page-specific components++### CSS Naming Conventions++Fider uses BEM methodology combined with utility classes:++- **`p-<page_name>`** - HTML ID for each page component (e.g., `p-home`, `p-user-settings`)+- **`c-<component_name>`** - Block class for components (e.g., `c-toggle`)+- **`c-<component_name>__<element>`** - Element classes (e.g., `c-toggle__label`)+- **`c-<component_name>--<state>`** - State modifiers (e.g., `c-toggle--checked`)+- **`is-<state>`, `has-<state>`** - Global state modifiers+- **Utility classes** - No prefix, used for common styling patterns. All utility classes are defined in public/assets/styles/utility/++### General Principles++**Backend:**++- Services are dependency-injected through the bus system+- All external dependencies are abstracted behind interfaces+- Database queries are centralized in query objects+- Handlers focus on HTTP concerns, business logic in services++**Frontend:**++- Page components are lazy-loaded for performance+- Shared components in `components/common/`+- Business logic in services, not components+- Type-safe API calls with proper error handling++## Build and Deployment++**Local Development:**++- `make watch` for development with hot reload+- Webpack dev server for fast UI rebuilds+- Air for Go server hot reload++**Production Build:**++- `make build` creates optimized binaries and assets+- SSR compilation for better SEO and performance+- Asset optimization and minification++This is a mature, production-ready feedback platform with comprehensive testing, i18n support, and a clean, maintainable architecture.diff --git a/app/actions/image.go b/app/actions/image.gonew file mode 100644index 000000000..e1b166826--- /dev/null+++ b/app/actions/image.go@@ -0,0 +1,41 @@+package actions++import (+ "context"++ "github.com/getfider/fider/app/models/dto"+ "github.com/getfider/fider/app/models/entity"+ "github.com/getfider/fider/app/pkg/validate"+)++// UploadImage is used to upload an image without associating it with a post or comment+type UploadImage struct {+ Image *dto.ImageUpload `json:"image"`+}++// Initialize the model+func (input *UploadImage) Initialize() {}++// IsAuthorized returns true if current user is authorized to perform this action+func (input *UploadImage) IsAuthorized(ctx context.Context, user *entity.User) bool {+ return user != nil+}++// Validate if current model is valid+func (input *UploadImage) Validate(ctx context.Context, user *entity.User) *validate.Result {+ result := validate.Success()++ messages, err := validate.ImageUpload(ctx, input.Image, validate.ImageUploadOpts{+ IsRequired: true,+ MinHeight: 50,+ MinWidth: 50,+ ExactRatio: false,+ MaxKilobytes: 5120,+ })++ if err != nil {+ return validate.Error(err)+ }+ result.AddFieldFailure("image", messages...)+ return result+}diff --git a/app/actions/post.go b/app/actions/post.goindex 061b0d27f..52489faa2 100644--- a/app/actions/post.go+++ b/app/actions/post.go@@ -37,16 +37,17 @@ func (input *CreateNewPost) OnPreExecute(ctx context.Context) error {if err := bus.Dispatch(ctx, getTag); err != nil {break}-+input.Tags = append(input.Tags, getTag.Result)}}-+return nil}// IsAuthorized returns true if current user is authorized to perform this actionfunc (action *CreateNewPost) IsAuthorized(ctx context.Context, user *entity.User) bool {+if user == nil {return false} else if env.Config.PostCreationWithTagsEnabled && !user.IsCollaborator() {@@ -343,21 +344,18 @@ func (action *EditComment) Validate(ctx context.Context, user *entity.User) *val}if len(action.Attachments) > 0 {- getAttachments := &query.GetAttachments{Post: action.Post, Comment: action.Comment}- err := bus.Dispatch(ctx, getAttachments)- if err != nil {- return validate.Error(err)++ nonRemovedCount := 0+ for _, v := range action.Attachments {+ if !v.Remove {+ nonRemovedCount+++ }}- messages, err := validate.MultiImageUpload(ctx, getAttachments.Result, action.Attachments, validate.MultiImageUploadOpts{- MaxUploads: 2,- MaxKilobytes: 5120,- ExactRatio: false,- })- if err != nil {- return validate.Error(err)+ if nonRemovedCount > 2 {+ result.AddFieldFailure("content", i18n.T(ctx, "validation.custom.maxattachments", i18n.Params{"number": 2}))}- result.AddFieldFailure("attachments", messages...)+}return resultdiff --git a/app/actions/signin.go b/app/actions/signin.goindex e69c6ba49..982fce940 100644--- a/app/actions/signin.go+++ b/app/actions/signin.go@@ -15,6 +15,7 @@ import (// SignInByEmail happens when user request to sign in by emailtype SignInByEmail struct {Email string `json:"email" format:"lower"`+ Code string `json:"code"`VerificationKey string}@@ -54,22 +55,22 @@ func (action *SignInByEmail) Validate(ctx context.Context, user *entity.User) *vreturn result}-//GetEmail returns the email being verified+// GetEmail returns the email being verifiedfunc (action *SignInByEmail) GetEmail() string {return action.Email}-//GetName returns empty for this kind of process+// GetName returns empty for this kind of processfunc (action *SignInByEmail) GetName() string {return ""}-//GetUser returns the current user performing this action+// GetUser returns the current user performing this actionfunc (action *SignInByEmail) GetUser() *entity.User {return nil}-//GetKind returns EmailVerificationKindSignIn+// GetKind returns EmailVerificationKindSignInfunc (action *SignInByEmail) GetKind() enum.EmailVerificationKind {return enum.EmailVerificationKindSignIn}diff --git a/app/cmd/routes.go b/app/cmd/routes.goindex d8c8e9db6..4fdd01da5 100644--- a/app/cmd/routes.go+++ b/app/cmd/routes.go@@ -25,6 +25,7 @@ func routes(r *web.Engine) *web.Engine {mw := middlewares.Chain(middlewares.WebSetup(),middlewares.Tenant(),+ middlewares.NoIndex(),middlewares.User(),)next := mw(func(c *web.Context) error {@@ -49,6 +50,7 @@ func routes(r *web.Engine) *web.Engine {feed.Use(middlewares.CORS())feed.Use(middlewares.WebSetup())feed.Use(middlewares.Tenant())+ feed.Use(middlewares.NoIndex())feed.Use(middlewares.ClientCache(5 * time.Minute))feed.Get("/feed/global.atom", handlers.GlobalFeed())@@ -63,6 +65,7 @@ func routes(r *web.Engine) *web.Engine {r.Use(middlewares.Maintenance())r.Use(middlewares.WebSetup())r.Use(middlewares.Tenant())+ r.Use(middlewares.NoIndex())r.Use(middlewares.User())r.Get("/privacy", handlers.LegalPage("Privacy Policy", "privacy.md"))@@ -113,6 +116,7 @@ func routes(r *web.Engine) *web.Engine {r.Use(middlewares.BlockPendingTenants())r.Get("/signin", handlers.SignInPage())+ r.Get("/loginemailsent", handlers.LoginEmailSentPage())r.Get("/not-invited", handlers.NotInvitedPage())r.Get("/signin/verify", handlers.VerifySignInKey(enum.EmailVerificationKindSignIn))r.Get("/invite/verify", handlers.VerifySignInKey(enum.EmailVerificationKindUserInvitation))@@ -192,11 +196,13 @@ func routes(r *web.Engine) *web.Engine {// Does not require authenticationpublicApi := r.Group(){+ publicApi.Get("/api/v1/similarposts", apiv1.FindSimilarPosts())publicApi.Get("/api/v1/posts", apiv1.SearchPosts())publicApi.Get("/api/v1/tags", apiv1.ListTags())publicApi.Get("/api/v1/posts/:number", apiv1.GetPost())publicApi.Get("/api/v1/posts/:number/comments", apiv1.ListComments())publicApi.Get("/api/v1/posts/:number/comments/:id", apiv1.GetComment())+ publicApi.Get("/api/v1/taggable-users", apiv1.ListTaggableUsers())}// Operations used to manage the content of a site@@ -212,7 +218,6 @@ func routes(r *web.Engine) *web.Engine {membersApi.Post("/api/v1/posts/:number/comments", apiv1.PostComment())membersApi.Put("/api/v1/posts/:number/comments/:id", apiv1.UpdateComment())membersApi.Delete("/api/v1/posts/:number/comments/:id", apiv1.DeleteComment())- membersApi.Get("/api/v1/taggable-users", apiv1.ListTaggableUsers())membersApi.Post("/api/v1/posts/:number/votes", apiv1.AddVote())membersApi.Delete("/api/v1/posts/:number/votes", apiv1.RemoveVote())membersApi.Post("/api/v1/posts/:number/votes/toggle", apiv1.ToggleVote())diff --git a/app/handlers/apiv1/post.go b/app/handlers/apiv1/post.goindex 74412629d..fa1134c7f 100644--- a/app/handlers/apiv1/post.go+++ b/app/handlers/apiv1/post.go@@ -39,6 +39,19 @@ func SearchPosts() web.HandlerFunc {}}+// FindSimilarPosts return posts similar to query+func FindSimilarPosts() web.HandlerFunc {+ return func(c *web.Context) error {+ searchPosts := &query.FindSimilarPosts{+ Query: c.QueryParam("query"),+ }+ if err := bus.Dispatch(c, searchPosts); err != nil {+ return c.Failure(err)+ }+ return c.Ok(searchPosts.Result)+ }+}+// CreatePost creates a new post on current tenantfunc CreatePost() web.HandlerFunc {return func(c *web.Context) error {@@ -112,25 +125,31 @@ func UpdatePost() web.HandlerFunc {return c.HandleValidation(result)}+ updatePost := &cmd.UpdatePost{+ Post: action.Post,+ Title: action.Title,+ Description: action.Description,+ }+err := bus.Dispatch(c,&cmd.UploadImages{Images: action.Attachments,Folder: "attachments",},- &cmd.UpdatePost{- Post: action.Post,- Title: action.Title,- Description: action.Description,- },+ updatePost,&cmd.SetAttachments{Post: action.Post,Attachments: action.Attachments,},)+if err != nil {return c.Failure(err)}+ // Notify about mentions in the updated post+ c.Enqueue(tasks.NotifyAboutUpdatedPost(updatePost.Result))+return c.Ok(web.Map{})}}@@ -479,9 +498,8 @@ func ListVotes() web.HandlerFunc {return c.Failure(err)}- listVotes := &query.ListPostVotes{PostID: getPost.Result.ID, IncludeEmail: true}- err = bus.Dispatch(c, listVotes)- if err != nil {+ listVotes := &query.ListPostVotes{PostID: getPost.Result.ID}+ if err := bus.Dispatch(c, listVotes); err != nil {return c.Failure(err)}@@ -500,9 +518,8 @@ func addOrRemove(c *web.Context, getCommand func(post *entity.Post, user *entityreturn c.Failure(err)}- cmd := getCommand(getPost.Result, c.User())- err = bus.Dispatch(c, cmd)- if err != nil {+ command := getCommand(getPost.Result, c.User())+ if err := bus.Dispatch(c, command); err != nil {return c.Failure(err)}diff --git a/app/handlers/post.go b/app/handlers/post.goindex 2d629dcb8..f2b7ea41f 100644--- a/app/handlers/post.go+++ b/app/handlers/post.go@@ -7,6 +7,7 @@ import ("github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus""github.com/getfider/fider/app/pkg/csv"+ "github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/pkg/markdown""github.com/getfider/fider/app/pkg/web")@@ -42,14 +43,17 @@ func Index() web.HandlerFunc {description = "We'd love to hear what you're thinking about. What can we do better? This is the place for you to vote, discuss and share posts."}+ data := web.Map{+ "searchNoiseWords": env.SearchNoiseWords(),+ "posts": searchPosts.Result,+ "tags": getAllTags.Result,+ "countPerStatus": countPerStatus.Result,+ }+return c.Page(http.StatusOK, web.Props{Page: "Home/Home.page",Description: description,- Data: web.Map{- "posts": searchPosts.Result,- "tags": getAllTags.Result,- "countPerStatus": countPerStatus.Result,- },+ Data: data,})}}diff --git a/app/handlers/signin.go b/app/handlers/signin.goindex 3db0388ce..f359de44f 100644--- a/app/handlers/signin.go+++ b/app/handlers/signin.go@@ -33,6 +33,19 @@ func SignInPage() web.HandlerFunc {}}+func LoginEmailSentPage() web.HandlerFunc {+ return func(c *web.Context) error {++ return c.Page(http.StatusOK, web.Props{+ Page: "SignIn/LoginEmailSent.page",+ Title: "Login email sent",+ Data: web.Map{+ "email": c.QueryParam("email")},+ })++ }+}+// NotInvitedPage renders the not invited pagefunc NotInvitedPage() web.HandlerFunc {return func(c *web.Context) error {@@ -61,7 +74,7 @@ func SignInByEmail() web.HandlerFunc {return c.Failure(err)}- c.Enqueue(tasks.SendSignInEmail(action.Email, action.VerificationKey))+ c.Enqueue(tasks.SendSignInEmail(action.Email, action.Code, action.VerificationKey))return c.Ok(web.Map{})}@@ -90,6 +103,7 @@ func VerifySignInKey(kind enum.EmailVerificationKind) web.HandlerFunc {Data: web.Map{"kind": kind,"k": key,+ "c": c.QueryParam("c"),},})}@@ -103,7 +117,11 @@ func VerifySignInKey(kind enum.EmailVerificationKind) web.HandlerFunc {webutil.AddAuthUserCookie(c, userByEmail.Result)- return c.Redirect(c.BaseURL())+ baseURL := c.BaseURL()+ if codeQs := c.QueryParam("c"); codeQs != "" {+ return c.Redirect(baseURL + "?c=" + codeQs)+ }+ return c.Redirect(baseURL)}}diff --git a/app/middlewares/noindex.go b/app/middlewares/noindex.gonew file mode 100644index 000000000..91a14c9d9--- /dev/null+++ b/app/middlewares/noindex.go@@ -0,0 +1,18 @@+package middlewares++import (+ "github.com/getfider/fider/app/pkg/web"+)++// NoIndex adds noindex headers for tenants that have prevent_indexing enabled+func NoIndex() web.MiddlewareFunc {+ return func(next web.HandlerFunc) web.HandlerFunc {+ return func(c *web.Context) error {+ tenant := c.Tenant()+ if tenant != nil && tenant.PreventIndexing {+ c.Response.Header().Set("X-Robots-Tag", "noindex, nofollow, noarchive, nosnippet, notranslate, noimageindex")+ }+ return next(c)+ }+ }+}\ No newline at end of filediff --git a/app/models/cmd/mention_notification.go b/app/models/cmd/mention_notification.goindex dd9af79ce..640df5691 100644--- a/app/models/cmd/mention_notification.go+++ b/app/models/cmd/mention_notification.go@@ -3,4 +3,5 @@ package cmdtype AddMentionNotification struct {UserID int `db:"user_id"`CommentID int `db:"comment_id"`+ PostID int `db:"post_id"`}diff --git a/app/models/dto/user.go b/app/models/dto/user.goindex 78515e402..b03e17015 100644--- a/app/models/dto/user.go+++ b/app/models/dto/user.go@@ -1,6 +1,5 @@package dtotype UserNames struct {- ID int `json:"id"`Name string `json:"name"`}diff --git a/app/models/entity/mention_notification.go b/app/models/entity/mention_notification.goindex ce681740b..19172d24f 100644--- a/app/models/entity/mention_notification.go+++ b/app/models/entity/mention_notification.go@@ -10,5 +10,6 @@ type MentionNotification struct {TenantID int `json:"-" db:"tenant_id"`UserID int `json:"userId" db:"user_id"`CommentID int `json:"commentId,omitempty" db:"comment_id"`+ PostID int `json:"postId,omitempty" db:"post_id"`CreatedAt time.Time `json:"createdAt" db:"created_on"`}diff --git a/app/models/entity/tenant.go b/app/models/entity/tenant.goindex d05263d59..58b56b148 100644--- a/app/models/entity/tenant.go+++ b/app/models/entity/tenant.go@@ -17,6 +17,7 @@ type Tenant struct {CustomCSS string `json:"-"`IsEmailAuthAllowed bool `json:"isEmailAuthAllowed"`IsFeedEnabled bool `json:"isFeedEnabled"`+ PreventIndexing bool `json:"preventIndexing"`}func (t *Tenant) IsDisabled() bool {diff --git a/app/models/enum/notification.go b/app/models/enum/notification.goindex 21f38a2a0..90a8fffaa 100644--- a/app/models/enum/notification.go+++ b/app/models/enum/notification.go@@ -54,11 +54,9 @@ var (}//NotificationEventMention is triggered when a new comment is posted with the user @-mentionedNotificationEventMention = NotificationEvent{- UserSettingsKeyName: "event_notification_mention",- DefaultSettingValue: strconv.Itoa(int(NotificationChannelWeb | NotificationChannelEmail)),- RequiresSubscriptionUserRoles: []Role{- RoleVisitor,- },+ UserSettingsKeyName: "event_notification_mention",+ DefaultSettingValue: strconv.Itoa(int(NotificationChannelWeb | NotificationChannelEmail)),+ RequiresSubscriptionUserRoles: []Role{},DefaultEnabledUserRoles: []Role{RoleAdministrator,RoleCollaborator,diff --git a/app/models/query/notification.go b/app/models/query/notification.goindex 18dbac63c..ac6bc7cc4 100644--- a/app/models/query/notification.go+++ b/app/models/query/notification.go@@ -28,6 +28,7 @@ type GetActiveSubscribers struct {type GetMentionNotifications struct {CommentID int+ PostID intResult []*entity.MentionNotification}diff --git a/app/models/query/oauth.go b/app/models/query/oauth.goindex 892bd6af6..993486fde 100644--- a/app/models/query/oauth.go+++ b/app/models/query/oauth.go@@ -19,6 +19,8 @@ type GetOAuthAuthorizationURL struct {Provider stringRedirect stringIdentifier string+ // Code is optional, used to store code of the draft post in the state that is passed through the OAuth flow+ Code stringResult string}diff --git a/app/models/query/post.go b/app/models/query/post.goindex 6c2530aef..99d423649 100644--- a/app/models/query/post.go+++ b/app/models/query/post.go@@ -44,6 +44,12 @@ type SearchPosts struct {Result []*entity.Post}+type FindSimilarPosts struct {+ Query string++ Result []*entity.Post+}+type GetAllPosts struct {Result []*entity.Post}diff --git a/app/pkg/dbx/setup.sql b/app/pkg/dbx/setup.sqlindex d249935a1..71a21eeb8 100644--- a/app/pkg/dbx/setup.sql+++ b/app/pkg/dbx/setup.sql@@ -2,8 +2,8 @@ TRUNCATE TABLE blobs RESTART IDENTITY CASCADE;TRUNCATE TABLE logs RESTART IDENTITY CASCADE;TRUNCATE TABLE tenants RESTART IDENTITY CASCADE;-INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled)-VALUES ('Demonstration', 'demo', now(), '', '', '', 1, false, '', '', 'en', true, true);+INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)+VALUES ('Demonstration', 'demo', now(), '', '', '', 1, false, '', '', 'en', true, true, false);INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)VALUES ('Jon Snow', '[email protected]', 1, now(), 3, 1, 2, '');@@ -18,8 +18,8 @@ VALUES (2, 1, 'google', 'GO5678', now());INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)VALUES ('Sansa Stark', '[email protected]', 1, now(), 1, 1, 2, '');-INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled)-VALUES ('Avengers', 'avengers', now(), 'feedback.avengers.com', '', '', 1, false, '', '', 'en', true, true);+INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)+VALUES ('Avengers', 'avengers', now(), 'feedback.avengers.com', '', '', 1, false, '', '', 'en', true, true, false);INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)VALUES ('Tony Stark', '[email protected]', 2, now(), 3, 1, 2, '');@@ -32,8 +32,8 @@ INSERT INTO user_providers (user_id, tenant_id, provider, provider_uid, created_VALUES (5, 2, 'google', 'GO1111', now());-- Create a tenant that has reached the end of it's trial period-INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled)-VALUES ('Trial Expired', 'trial-expired', now(), 'feedback.trial-expired.com', '', '', 1, false, '', '', 'en', true, true);+INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)+VALUES ('Trial Expired', 'trial-expired', now(), 'feedback.trial-expired.com', '', '', 1, false, '', '', 'en', true, true, false);INSERT INTO tenants_billing (tenant_id, paddle_plan_id, paddle_subscription_id, status, subscription_ends_at, trial_ends_at)VALUES (3, 1, 1,1, now(), CURRENT_DATE - INTERVAL '10 days');INSERT INTO users (name, email, tenant_id, created_at, role, status, avatar_type, avatar_bkey)diff --git a/app/pkg/env/env.go b/app/pkg/env/env.goindex 8015af06f..3d3bc1aa0 100644--- a/app/pkg/env/env.go+++ b/app/pkg/env/env.go@@ -141,7 +141,8 @@ type config struct {Message string `env:"MAINTENANCE_MESSAGE"`Until string `env:"MAINTENANCE_UNTIL"`}- GoogleAnalytics string `env:"GOOGLE_ANALYTICS"`+ GoogleAnalytics string `env:"GOOGLE_ANALYTICS"`+ SearchNoiseWords string `env:"SEARCH_NOISE_WORDS,default=add|support|for|implement|create|make|allow|enable|provide|some|also|include|very|make|and|for|to|a|able|function|feature|app"`}// Config is a strongly typed reference to all configuration parsed from Environment Variables@@ -247,6 +248,11 @@ func IsProduction() bool {return Config.Environment == "production" || (!IsTest() && !IsDevelopment())}+// SearchNoiseWords returns a list of words that should be ignored on search+func SearchNoiseWords() []string {+ return strings.Split(Config.SearchNoiseWords, "|")+}+// IsTest returns true on Fider test environmentfunc IsTest() bool {return Config.Environment == "test"diff --git a/app/pkg/jwt/jwt.go b/app/pkg/jwt/jwt.goindex 33e27fe85..6d571d2d9 100644--- a/app/pkg/jwt/jwt.go+++ b/app/pkg/jwt/jwt.go@@ -45,8 +45,9 @@ type OAuthClaims struct {// OAuthStateClaims represents what goes into JWT tokens used for OAuth state parametertype OAuthStateClaims struct {- Redirect string `json:"oauthstate/redirect"`- Identifier string `json:"oauthstate/identifier"`+ Redirect string `json:"oauthstate/redirect"`+ Identifier string `json:"oauthstate/identifier"`+ Code string `json:"oauthstate/code"`Metadata}diff --git a/app/pkg/web/react_test.go b/app/pkg/web/react_test.goindex cce931da5..b6921cba8 100644--- a/app/pkg/web/react_test.go+++ b/app/pkg/web/react_test.go@@ -52,7 +52,7 @@ func TestReactRenderer_RenderEmptyHomeHTML(t *testing.T) {},})Expect(html).ContainsSubstring(`<div class="c-dev-banner">DEV</div>`)- Expect(html).ContainsSubstring(`<input class="c-input" id="input-title" type="text"`)+ Expect(html).ContainsSubstring(`<button type="submit" class="c-button c-button--default c-button--secondary c-input">Enter your suggestion here...</button>`)Expect(html).ContainsSubstring(`What can we do better? This is the place for you to vote, discuss and share ideas.`)Expect(html).ContainsSubstring(`No posts have been created yet.`)Expect(html).ContainsSubstring(`Powered by Fider`)@@ -81,7 +81,7 @@ func TestReactRenderer_RenderEmptyHomeHTML_Portuguese(t *testing.T) {},})Expect(html).ContainsSubstring(`<div class="c-dev-banner">DEV</div>`)- Expect(html).ContainsSubstring(`<input class="c-input" id="input-title" type="text"`)+ Expect(html).ContainsSubstring(`<button type="submit" class="c-button c-button--default c-button--secondary c-input">Insira sua sugestão aqui...</button`)Expect(html).ContainsSubstring(`O que podemos fazer melhor? Este é o lugar para você votar, discutir e compartilhar ideias.`)Expect(html).ContainsSubstring(`Nenhuma postagem foi criada ainda.`)Expect(html).ContainsSubstring(`Powered by Fider`)diff --git a/app/pkg/web/testdata/home_ssr.html b/app/pkg/web/testdata/home_ssr.htmlindex 64aeb9d3d..6138dee0a 100755--- a/app/pkg/web/testdata/home_ssr.html+++ b/app/pkg/web/testdata/home_ssr.html@@ -45,7 +45,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","description":"My Page Description","page":"Test.page","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"en","isPrivate":false,"logoBlobKey":"","isEmailAuthAllowed":false,"isFeedEnabled":false},"title":"My Page Title · "}+ {"contextID":"CONTEXT_ID","description":"My Page Description","page":"Test.page","props":{"countPerStatus":{},"posts":[],"tags":[]},"sessionID":"","settings":{"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"en","isPrivate":false,"logoBlobKey":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"My Page Title · "}</script>diff --git a/app/pkg/web/testdata/tenant.html b/app/pkg/web/testdata/tenant.htmlindex 24917cd8b..fee3ae671 100755--- a/app/pkg/web/testdata/tenant.html+++ b/app/pkg/web/testdata/tenant.html@@ -45,7 +45,7 @@<script id="server-data" type="application/json">- {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"","isPrivate":false,"logoBlobKey":"","isEmailAuthAllowed":false,"isFeedEnabled":false},"title":"Game of Thrones"}+ {"contextID":"CONTEXT_ID","page":"","props":{},"sessionID":"","settings":{"assetsURL":"https://demo.test.fider.io:3000","baseURL":"https://demo.test.fider.io:3000","domain":".test.fider.io","environment":"test","googleAnalytics":"","hasLegal":true,"isBillingEnabled":false,"locale":"en","localeDirection":"ltr","mode":"multi","oauth":[],"postWithTags":true},"tenant":{"id":0,"name":"Game of Thrones","subdomain":"","invitation":"","welcomeMessage":"","cname":"","status":0,"locale":"","isPrivate":false,"logoBlobKey":"","isEmailAuthAllowed":false,"isFeedEnabled":false,"preventIndexing":false},"title":"Game of Thrones"}</script>diff --git a/app/services/oauth/oauth.go b/app/services/oauth/oauth.goindex a71484c0b..80fcc8624 100644--- a/app/services/oauth/oauth.go+++ b/app/services/oauth/oauth.go@@ -210,6 +210,7 @@ func getOAuthAuthorizationURL(ctx context.Context, q *query.GetOAuthAuthorizatiostate, err := jwt.Encode(jwt.OAuthStateClaims{Redirect: q.Redirect,Identifier: q.Identifier,+ Code: q.Code,})if err != nil {diff --git a/app/services/sqlstore/postgres/attachment.go b/app/services/sqlstore/postgres/attachment.goindex bac0a74db..ee7e83371 100644--- a/app/services/sqlstore/postgres/attachment.go+++ b/app/services/sqlstore/postgres/attachment.go@@ -35,10 +35,19 @@ func setAttachments(ctx context.Context, c *cmd.SetAttachments) error {return errors.Wrap(err, "failed to delete attachment")}} else {- if _, err := trx.Execute(- "INSERT INTO attachments (tenant_id, post_id, comment_id, user_id, attachment_bkey) VALUES ($1, $2, $3, $4, $5)",- tenant.ID, postID, commentID, user.ID, attachment.BlobKey,- ); err != nil {+ // Use a conditional INSERT that only adds the attachment if it doesn't already exist+ if _, err := trx.Execute(`+ INSERT INTO attachments (tenant_id, post_id, comment_id, user_id, attachment_bkey)+ SELECT $1, $2, $3, $4, $5+ WHERE NOT EXISTS (+ SELECT 1 FROM attachments+ WHERE tenant_id = $6+ AND post_id = $7+ AND (comment_id = $8 OR ($8 IS NULL AND comment_id IS NULL))+ AND attachment_bkey = $9+ )+ `, tenant.ID, postID, commentID, user.ID, attachment.BlobKey,+ tenant.ID, postID, commentID, attachment.BlobKey); err != nil {return errors.Wrap(err, "failed to insert attachment")}}@@ -86,16 +95,17 @@ func getAttachments(ctx context.Context, q *query.GetAttachments) error {func uploadImage(ctx context.Context, c *cmd.UploadImage) error {if c.Image.Upload != nil && len(c.Image.Upload.Content) > 0 {- bkey := fmt.Sprintf("%s/%s-%s", c.Folder, rand.String(64), blob.SanitizeFileName(c.Image.Upload.FileName))+ if c.Image.BlobKey == "" {+ c.Image.BlobKey = fmt.Sprintf("%s/%s-%s", c.Folder, rand.String(64), blob.SanitizeFileName(c.Image.Upload.FileName))+ }err := bus.Dispatch(ctx, &cmd.StoreBlob{- Key: bkey,+ Key: c.Image.BlobKey,Content: c.Image.Upload.Content,ContentType: c.Image.Upload.ContentType,})if err != nil {return errors.Wrap(err, "failed to upload new blob")}- c.Image.BlobKey = bkey}return nil}diff --git a/app/services/sqlstore/postgres/mention_notification.go b/app/services/sqlstore/postgres/mention_notification.goindex 3fac2fa75..25fa68137 100644--- a/app/services/sqlstore/postgres/mention_notification.go+++ b/app/services/sqlstore/postgres/mention_notification.go@@ -2,6 +2,8 @@ package postgresimport ("context"+ "database/sql"+ "fmt""time""github.com/getfider/fider/app/models/cmd"@@ -15,15 +17,38 @@ func AddMentionNotification(ctx context.Context, c *cmd.AddMentionNotification)return using(ctx, func(trx *dbx.Trx, tenant *entity.Tenant, user *entity.User) error {now := time.Now()+ // Create NullInt64 variables for CommentID and PostID+ var commentID sql.NullInt64+ var postID sql.NullInt64++ // Only set Valid=true if the ID is not 0+ if c.CommentID != 0 {+ commentID.Int64 = int64(c.CommentID)+ commentID.Valid = true+ }++ if c.PostID != 0 {+ postID.Int64 = int64(c.PostID)+ postID.Valid = true+ }+query := `- INSERT INTO mention_notifications (tenant_id, user_id, comment_id, created_on)- VALUES ($1, $2, $3, $4)- ON CONFLICT (tenant_id, user_id, comment_id) DO NOTHING+ INSERT INTO mention_notifications (tenant_id, user_id, comment_id, post_id, created_on)+ SELECT $1, $2, $3, $4, $5+ WHERE NOT EXISTS (+ SELECT 1+ FROM mention_notifications+ WHERE tenant_id = $1+ AND user_id = $2+ AND COALESCE(comment_id, -1) = COALESCE($3, -1)+ AND COALESCE(post_id, -1) = COALESCE($4, -1)+ );`_, err := trx.Execute(query,tenant.ID,c.UserID,- c.CommentID,+ commentID,+ postID,now)if err != nil {@@ -40,16 +65,28 @@ func getMentionsNotifications(ctx context.Context, q *query.GetMentionNotificatiparams := []interface{}{tenant.ID,- q.CommentID,}query := `- SELECT id, tenant_id, user_id, comment_id, created_on+ SELECT id, tenant_id, user_id, comment_id, post_id, created_onFROM mention_notifications- WHERE tenant_id = $1- AND comment_id = $2+ WHERE tenant_id = $1`+ paramCount := 1++ if q.CommentID > 0 {+ paramCount+++ query += fmt.Sprintf(" AND comment_id = $%d", paramCount)+ params = append(params, q.CommentID)+ }++ if q.PostID > 0 {+ paramCount+++ query += fmt.Sprintf(" AND post_id = $%d", paramCount)+ params = append(params, q.PostID)+ }+query += " ORDER BY created_on DESC"err := trx.Select(&q.Result, query, params...)diff --git a/app/services/sqlstore/postgres/post.go b/app/services/sqlstore/postgres/post.goindex ca11cad49..9b12dc05d 100644--- a/app/services/sqlstore/postgres/post.go+++ b/app/services/sqlstore/postgres/post.go@@ -5,6 +5,7 @@ import ("database/sql""fmt""strconv"+ "strings""time""github.com/getfider/fider/app/models/entity"@@ -14,6 +15,7 @@ import ("github.com/lib/pq""github.com/getfider/fider/app/pkg/bus"+ "github.com/getfider/fider/app/pkg/env""github.com/getfider/fider/app/models/cmd""github.com/getfider/fider/app/pkg/dbx"@@ -360,6 +362,71 @@ func getPostByNumber(ctx context.Context, q *query.GetPostByNumber) error {})}+func preprocessSearchQuery(query string) string {+ // Common noise words that don't add search value++ noiseWords := env.SearchNoiseWords()++ words := strings.Fields(strings.ToLower(query))+ var filteredWords []string++ for _, word := range words {+ isNoise := false+ for _, noise := range noiseWords {+ if word == noise {+ isNoise = true+ break+ }+ }+ if !isNoise && len(word) > 2 { // Also filter very short words+ filteredWords = append(filteredWords, word)+ }+ }++ return strings.Join(filteredWords, " ")+}++func findSimilarPosts(ctx context.Context, q *query.FindSimilarPosts) error {+ return using(ctx, func(trx *dbx.Trx, tenant *entity.Tenant, user *entity.User) error {+ innerQuery := buildPostQuery(user, "p.tenant_id = $1 AND p.status = ANY($2)")++ filteredQuery := preprocessSearchQuery(q.Query)++ var (+ posts []*dbPost+ err error+ )++ if filteredQuery == "" {+ q.Result = make([]*entity.Post, 0)+ } else {+ scoreField := "ts_rank(setweight(to_tsvector(title), 'A') || setweight(to_tsvector(description), 'B'), to_tsquery('english', $3)) + similarity(title, $4) + similarity(description, $4)"+ sql := fmt.Sprintf(`+ SELECT * FROM (%s) AS q+ WHERE %s > 0.5+ ORDER BY %s DESC+ LIMIT 5+ `, innerQuery, scoreField, scoreField)+ err = trx.Select(&posts, sql, tenant.ID, pq.Array([]enum.PostStatus{+ enum.PostOpen,+ enum.PostStarted,+ enum.PostPlanned,+ enum.PostCompleted,+ enum.PostDeclined,+ }), ToTSQuery(filteredQuery), SanitizeString(filteredQuery))+ }+ if err != nil {+ return errors.Wrap(err, "failed to find similar posts")+ }++ q.Result = make([]*entity.Post, len(posts))+ for i, post := range posts {+ q.Result[i] = post.toModel(ctx)+ }+ return nil+ })+}+func searchPosts(ctx context.Context, q *query.SearchPosts) error {return using(ctx, func(trx *dbx.Trx, tenant *entity.Tenant, user *entity.User) error {innerQuery := buildPostQuery(user, "p.tenant_id = $1 AND p.status = ANY($2)")@@ -386,7 +453,7 @@ func searchPosts(ctx context.Context, q *query.SearchPosts) error {scoreField := "ts_rank(setweight(to_tsvector(title), 'A') || setweight(to_tsvector(description), 'B'), to_tsquery('english', $3)) + similarity(title, $4) + similarity(description, $4)"sql := fmt.Sprintf(`SELECT * FROM (%s) AS q- WHERE %s > 0.1+ WHERE %s > 0.4ORDER BY %s DESCLIMIT %s`, innerQuery, scoreField, scoreField, q.Limit)diff --git a/app/services/sqlstore/postgres/postgres.go b/app/services/sqlstore/postgres/postgres.goindex 6761de539..b8bbf9847 100644--- a/app/services/sqlstore/postgres/postgres.go+++ b/app/services/sqlstore/postgres/postgres.go@@ -63,6 +63,7 @@ func (s Service) Init() {bus.AddHandler(getPostBySlug)bus.AddHandler(getPostByNumber)bus.AddHandler(searchPosts)+ bus.AddHandler(findSimilarPosts)bus.AddHandler(getAllPosts)bus.AddHandler(countPostPerStatus)bus.AddHandler(markPostAsDuplicate)diff --git a/app/services/sqlstore/postgres/tenant.go b/app/services/sqlstore/postgres/tenant.goindex 92cad0717..d2e9ac5e4 100644--- a/app/services/sqlstore/postgres/tenant.go+++ b/app/services/sqlstore/postgres/tenant.go@@ -30,6 +30,7 @@ type dbTenant struct {CustomCSS string `db:"custom_css"`IsEmailAuthAllowed bool `db:"is_email_auth_allowed"`IsFeedEnabled bool `db:"is_feed_enabled"`+ PreventIndexing bool `db:"prevent_indexing"`}func (t *dbTenant) toModel() *entity.Tenant {@@ -51,6 +52,7 @@ func (t *dbTenant) toModel() *entity.Tenant {CustomCSS: t.CustomCSS,IsEmailAuthAllowed: t.IsEmailAuthAllowed,IsFeedEnabled: t.IsFeedEnabled,+ PreventIndexing: t.PreventIndexing,}return tenant@@ -236,8 +238,8 @@ func createTenant(ctx context.Context, c *cmd.CreateTenant) error {var id interr := trx.Get(&id,- `INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled)- VALUES ($1, $2, $3, '', '', '', $4, false, '', '', $5, true, true)+ `INSERT INTO tenants (name, subdomain, created_at, cname, invitation, welcome_message, status, is_private, custom_css, logo_bkey, locale, is_email_auth_allowed, is_feed_enabled, prevent_indexing)+ VALUES ($1, $2, $3, '', '', '', $4, false, '', '', $5, true, true, true)RETURNING id`, c.Name, c.Subdomain, now, c.Status, env.Config.Locale)if err != nil {return err@@ -265,7 +267,7 @@ func getFirstTenant(ctx context.Context, q *query.GetFirstTenant) error {tenant := dbTenant{}err := trx.Get(&tenant, `- SELECT id, name, subdomain, cname, invitation, locale, welcome_message, status, is_private, logo_bkey, custom_css, is_email_auth_allowed, is_feed_enabled+ SELECT id, name, subdomain, cname, invitation, locale, welcome_message, status, is_private, logo_bkey, custom_css, is_email_auth_allowed, is_feed_enabled, prevent_indexingFROM tenantsORDER BY id LIMIT 1`)@@ -284,7 +286,7 @@ func getTenantByDomain(ctx context.Context, q *query.GetTenantByDomain) error {tenant := dbTenant{}err := trx.Get(&tenant, `- SELECT id, name, subdomain, cname, invitation, locale, welcome_message, status, is_private, logo_bkey, custom_css, is_email_auth_allowed, is_feed_enabled+ SELECT id, name, subdomain, cname, invitation, locale, welcome_message, status, is_private, logo_bkey, custom_css, is_email_auth_allowed, is_feed_enabled, prevent_indexingFROM tenants tWHERE subdomain = $1 OR subdomain = $2 OR cname = $3ORDER BY cname DESCdiff --git a/app/services/sqlstore/postgres/user.go b/app/services/sqlstore/postgres/user.goindex 9cf5f1cf9..b3930d9da 100644--- a/app/services/sqlstore/postgres/user.go+++ b/app/services/sqlstore/postgres/user.go@@ -392,11 +392,11 @@ func getAllUsersNames(ctx context.Context, q *query.GetAllUsersNames) error {return using(ctx, func(trx *dbx.Trx, tenant *entity.Tenant, user *entity.User) error {var users []*dbUsererr := trx.Select(&users, `- SELECT id, name+ SELECT nameFROM usersWHERE tenant_id = $1- AND status != $2- ORDER BY id`, tenant.ID, enum.UserDeleted)+ AND status = $2+ ORDER BY id`, tenant.ID, enum.UserActive)if err != nil {return errors.Wrap(err, "failed to get all users")}@@ -404,7 +404,6 @@ func getAllUsersNames(ctx context.Context, q *query.GetAllUsersNames) error {q.Result = make([]*dto.UserNames, len(users))for i, user := range users {q.Result[i] = &dto.UserNames{- ID: int(user.ID.Int64),Name: user.Name.String,}}diff --git a/app/tasks/new_comment.go b/app/tasks/new_comment.goindex 7bf0aa2b8..4aad3cf99 100644--- a/app/tasks/new_comment.go+++ b/app/tasks/new_comment.go@@ -118,7 +118,7 @@ func NotifyAboutNewComment(comment *entity.Comment, post *entity.Post) worker.Ta}}- sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventNewComment)+ sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventNewComment, "new_comment")// Mentionsto = make([]dto.Recipient, 0)@@ -152,7 +152,7 @@ func NotifyAboutNewComment(comment *entity.Comment, post *entity.Post) worker.Ta}- sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventMention)+ sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventMention, "new_comment")tenant := c.Tenant()baseURL, logoURL := web.BaseURL(c), web.LogoURL(c)@@ -273,13 +273,13 @@ func NotifyAboutUpdatedComment(post *entity.Post, comment *entity.Comment) worke}}- sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventMention)+ sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventMention, "new_comment")return nil})}-func sendEmailNotifications(c *worker.Context, post *entity.Post, to []dto.Recipient, comment string, event enum.NotificationEvent) {+func sendEmailNotifications(c *worker.Context, post *entity.Post, to []dto.Recipient, comment string, event enum.NotificationEvent, templateName string) {// Short circuit if there is no one to notifyif len(to) == 0 {return@@ -309,7 +309,7 @@ func sendEmailNotifications(c *worker.Context, post *entity.Post, to []dto.Recipbus.Publish(c, &cmd.SendMail{From: dto.Recipient{Name: author.Name},To: to,- TemplateName: "new_comment",+ TemplateName: templateName,Props: mailProps,})}diff --git a/app/tasks/new_post.go b/app/tasks/new_post.goindex 8517384e2..258a41ce6 100644--- a/app/tasks/new_post.go+++ b/app/tasks/new_post.go@@ -2,22 +2,30 @@ package tasksimport ("fmt"+ "slices""github.com/getfider/fider/app/models/cmd""github.com/getfider/fider/app/models/dto""github.com/getfider/fider/app/models/entity""github.com/getfider/fider/app/models/enum"+ "github.com/getfider/fider/app/models/query""github.com/getfider/fider/app/pkg/bus""github.com/getfider/fider/app/pkg/i18n"+ "github.com/getfider/fider/app/pkg/log""github.com/getfider/fider/app/pkg/markdown""github.com/getfider/fider/app/pkg/web""github.com/getfider/fider/app/pkg/webhook""github.com/getfider/fider/app/pkg/worker")-//NotifyAboutNewPost sends a notification (web and email) to subscribers+// NotifyAboutNewPost sends a notification (web and email) to subscribersfunc NotifyAboutNewPost(post *entity.Post) worker.Task {return describe("Notify about new post", func(c *worker.Context) error {+ // Parse mentions from post description+ contentString := entity.CommentString(post.Description)+ mentions := contentString.ParseMentions()+ var mentionNotifications []*entity.MentionNotification+// Web notificationusers, err := getActiveSubscribers(c, post, enum.NotificationChannelWeb, enum.NotificationEventNewPost)if err != nil {@@ -41,6 +49,56 @@ func NotifyAboutNewPost(post *entity.Post) worker.Task {}}+ // Web notification - mentions+ if len(mentions) > 0 {+ title = fmt.Sprintf("**%s** mentioned you in **%s**", author.Name, post.Title)++ users, err = getActiveSubscribers(c, post, enum.NotificationChannelWeb, enum.NotificationEventMention)+ if err != nil {+ return c.Failure(err)+ }++ // Get the existing mentions that have been sent for this post+ mN := &query.GetMentionNotifications{+ PostID: post.ID,+ }+ err := bus.Dispatch(c, mN)+ if err != nil {+ return c.Failure(err)+ }+ mentionNotifications = mN.Result++ // Iterate the mentions+ for _, mention := range mentions {+ // Check if the user is in the list of mention subscribers (users)+ for _, u := range users {+ if u.Name == mention && !slices.ContainsFunc(mentionNotifications,+ func(n *entity.MentionNotification) bool {+ return n.UserID == u.ID+ }) {+ err = bus.Dispatch(c, &cmd.AddNewNotification{+ User: u,+ Title: title,+ Link: link,+ PostID: post.ID,+ })+ if err != nil {+ return c.Failure(err)+ }++ // Also send the notification log+ err = bus.Dispatch(c, &cmd.AddMentionNotification{+ UserID: u.ID,+ PostID: post.ID,+ })+ if err != nil {+ return c.Failure(err)+ }+ }+ }+ }+ }+// Email notificationusers, err = getActiveSubscribers(c, post, enum.NotificationChannelEmail, enum.NotificationEventNewPost)if err != nil {@@ -61,7 +119,7 @@ func NotifyAboutNewPost(post *entity.Post) worker.Task {"title": post.Title,"siteName": tenant.Name,"userName": author.Name,- "content": markdown.Full(post.Description),+ "content": markdown.Full(contentString.SanitizeMentions()),"postLink": linkWithText(fmt.Sprintf("#%d", post.Number), baseURL, "/posts/%d/%s", post.Number, post.Slug),"view": linkWithText(i18n.T(c, "email.subscription.view"), baseURL, "/posts/%d/%s", post.Number, post.Slug),"change": linkWithText(i18n.T(c, "email.subscription.change"), baseURL, "/settings"),@@ -75,6 +133,38 @@ func NotifyAboutNewPost(post *entity.Post) worker.Task {Props: mailProps,})+ // Email notification - mentions+ to = make([]dto.Recipient, 0)+ if len(mentions) > 0 {+ users, err = getActiveSubscribers(c, post, enum.NotificationChannelEmail, enum.NotificationEventMention)+ if err != nil {+ return c.Failure(err)+ }++ for _, mention := range mentions {+ for _, u := range users {+ if u.Name == mention && !slices.ContainsFunc(mentionNotifications,+ func(n *entity.MentionNotification) bool {+ return n.UserID == u.ID+ }) {+ to = append(to, dto.NewRecipient(u.Name, u.Email, dto.Props{}))++ // Also send the notification log+ err = bus.Dispatch(c, &cmd.AddMentionNotification{+ UserID: u.ID,+ PostID: post.ID,+ })+ if err != nil {+ return c.Failure(err)+ }+ }+ }+ }+ }++ // Send mention email notifications+ sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventMention, "new_comment")+webhookProps := webhook.Props{}webhookProps.SetPost(post, "post", baseURL, false, false)webhookProps.SetUser(author, "author")@@ -91,3 +181,105 @@ func NotifyAboutNewPost(post *entity.Post) worker.Task {return nil})}++// NotifyAboutUpdatedPost sends notifications about mentions in an updated post+func NotifyAboutUpdatedPost(post *entity.Post) worker.Task {+ return describe("Notify about updated post", func(c *worker.Context) error {+ contentString := entity.CommentString(post.Description)+ mentions := contentString.ParseMentions()+ var mentionNotifications []*entity.MentionNotification++ log.Infof(c, "Post updated: @{Post:Yellow}. Mentions @{MentionsCount}", dto.Props{+ "Post": post.Title,+ "MentionsCount": len(mentions),+ })++ author := c.User()+ title := fmt.Sprintf("**%s** mentioned you in **%s**", author.Name, post.Title)+ link := fmt.Sprintf("/posts/%d/%s", post.Number, post.Slug)+ mentionNotificationSent := false+ if len(mentions) > 0 {+ users, err := getActiveSubscribers(c, post, enum.NotificationChannelWeb, enum.NotificationEventMention)+ if err != nil {+ return c.Failure(err)+ }++ // Get the existing mentions that have been sent for this post+ mN := &query.GetMentionNotifications{+ PostID: post.ID,+ }+ err = bus.Dispatch(c, mN)+ if err != nil {+ return c.Failure(err)+ }+ mentionNotifications = mN.Result++ // Iterate the mentions+ for _, mention := range mentions {+ // Check if the user is in the list of mention subscribers (users)+ for _, u := range users {+ if u.Name == mention && !slices.ContainsFunc(mentionNotifications,+ func(n *entity.MentionNotification) bool {+ return n.UserID == u.ID+ }) {+ err = bus.Dispatch(c, &cmd.AddNewNotification{+ User: u,+ Title: title,+ Link: link,+ PostID: post.ID,+ })+ if err != nil {+ return c.Failure(err)+ }++ // Also send the notification log+ err = bus.Dispatch(c, &cmd.AddMentionNotification{+ UserID: u.ID,+ PostID: post.ID,+ })+ if err != nil {+ return c.Failure(err)+ }+ mentionNotificationSent = true+ }+ }+ }+ }++ to := make([]dto.Recipient, 0)+ if len(mentions) > 0 {+ users, err := getActiveSubscribers(c, post, enum.NotificationChannelEmail, enum.NotificationEventMention)+ if err != nil {+ return c.Failure(err)+ }++ for _, mention := range mentions {+ // Check if the user is in the list of mention subscribers (users)+ for _, u := range users {+ if u.Name == mention && !slices.ContainsFunc(mentionNotifications,+ func(n *entity.MentionNotification) bool {+ return n.UserID == u.ID+ }) {+ to = append(to, dto.NewRecipient(u.Name, u.Email, dto.Props{}))++ // Also send the notification log+ if !mentionNotificationSent {+ err = bus.Dispatch(c, &cmd.AddMentionNotification{+ UserID: u.ID,+ PostID: post.ID,+ })+ if err != nil {+ return c.Failure(err)+ }+ }+ }+ }+ }+ }++ // Send email notifications for mentions+ sendEmailNotifications(c, post, to, contentString.SanitizeMentions(), enum.NotificationEventMention, "new_comment")++ return nil+ })+}diff --git a/app/tasks/new_post_test.go b/app/tasks/new_post_test.goindex d2a554cba..b250d3e28 100644--- a/app/tasks/new_post_test.go+++ b/app/tasks/new_post_test.go@@ -109,3 +109,86 @@ func TestNotifyAboutNewPostTask(t *testing.T) {"tenant_url": "http://domain.com",})}++func TestNotifyAboutNewPostTask_WithMention(t *testing.T) {+ RegisterT(t)+ bus.Init(emailmock.Service{})++ var addNewNotification *cmd.AddNewNotification+ bus.AddHandler(func(ctx context.Context, c *cmd.AddNewNotification) error {+ addNewNotification = c+ return nil+ })++ addNotificationLogs := make([]*cmd.AddMentionNotification, 0)+ bus.AddHandler(func(ctx context.Context, c *cmd.AddMentionNotification) error {+ addNotificationLogs = append(addNotificationLogs, c)+ return nil+ })++ bus.AddHandler(func(ctx context.Context, q *query.GetActiveSubscribers) error {+ if q.Event.UserSettingsKeyName == "event_notification_mention" {+ q.Result = []*entity.User{+ mock.JonSnow,+ }+ } else {+ q.Result = []*entity.User{}+ }+ return nil+ })++ bus.AddHandler(func(ctx context.Context, q *query.GetMentionNotifications) error {+ q.Result = []*entity.MentionNotification{}+ return nil+ })++ var triggerWebhooks *cmd.TriggerWebhooks+ bus.AddHandler(func(ctx context.Context, c *cmd.TriggerWebhooks) error {+ triggerWebhooks = c+ return nil+ })++ worker := mock.NewWorker()+ post := &entity.Post{+ ID: 1,+ Number: 1,+ Title: "Add support for TypeScript",+ Slug: "add-support-for-typescript",+ Description: "TypeScript is great, please add support for it @[Jon Snow]",+ }+ task := tasks.NotifyAboutNewPost(post)++ err := worker.+ OnTenant(mock.DemoTenant).+ AsUser(mock.AryaStark).+ WithBaseURL("http://domain.com").+ Execute(task)++ Expect(err).IsNil()+ Expect(emailmock.MessageHistory).HasLen(2)++ // Check standard notification email+ Expect(emailmock.MessageHistory[0].TemplateName).Equals("new_post")+ Expect(emailmock.MessageHistory[0].Tenant).Equals(mock.DemoTenant)+ Expect(emailmock.MessageHistory[0].Props["content"]).Equals(template.HTML("<p>TypeScript is great, please add support for it @Jon Snow</p>"))++ // Check mention notification email+ Expect(emailmock.MessageHistory[1].TemplateName).Equals("new_comment")+ Expect(emailmock.MessageHistory[1].Props["messageLocaleString"]).Equals("email.new_mention.text")+ Expect(emailmock.MessageHistory[1].To).HasLen(1)+ Expect(emailmock.MessageHistory[1].To[0].Name).Equals("Jon Snow")++ Expect(addNewNotification).IsNotNil()+ Expect(addNewNotification.PostID).Equals(post.ID)+ Expect(addNewNotification.Title).Equals("**Arya Stark** mentioned you in **Add support for TypeScript**")+ Expect(addNewNotification.User).Equals(mock.JonSnow)++ Expect(addNotificationLogs).HasLen(2)+ Expect(addNotificationLogs[0].UserID).Equals(mock.JonSnow.ID)+ Expect(addNotificationLogs[0].PostID).Equals(post.ID)+ Expect(addNotificationLogs[1].UserID).Equals(mock.JonSnow.ID)+ Expect(addNotificationLogs[1].PostID).Equals(post.ID)++ Expect(triggerWebhooks).IsNotNil()+ Expect(triggerWebhooks.Type).Equals(enum.WebhookNewPost)+}diff --git a/app/tasks/signin.go b/app/tasks/signin.goindex dad392de4..07609e8d1 100644--- a/app/tasks/signin.go+++ b/app/tasks/signin.go@@ -8,12 +8,12 @@ import ("github.com/getfider/fider/app/pkg/worker")-//SendSignInEmail is used to send the sign in email to requestor-func SendSignInEmail(email, verificationKey string) worker.Task {+// SendSignInEmail is used to send the sign in email to requestor+func SendSignInEmail(email, code, verificationKey string) worker.Task {return describe("Send sign in email", func(c *worker.Context) error {to := dto.NewRecipient("", email, dto.Props{"siteName": c.Tenant().Name,- "link": link(web.BaseURL(c), "/signin/verify?k=%s", verificationKey),+ "link": link(web.BaseURL(c), "/signin/verify?k=%s&c=%s", verificationKey, code),})bus.Publish(c, &cmd.SendMail{diff --git a/app/tasks/signin_test.go b/app/tasks/signin_test.goindex ee3ce22da..af05c1549 100644--- a/app/tasks/signin_test.go+++ b/app/tasks/signin_test.go@@ -16,7 +16,7 @@ func TestSendSignInEmailTask(t *testing.T) {bus.Init(emailmock.Service{})worker := mock.NewWorker()- task := tasks.SendSignInEmail("[email protected]", "9876")+ task := tasks.SendSignInEmail("[email protected]", "9876", "9876")err := worker.OnTenant(mock.DemoTenant).@@ -39,7 +39,7 @@ func TestSendSignInEmailTask(t *testing.T) {Address: "[email protected]",Props: dto.Props{"siteName": mock.DemoTenant.Name,- "link": "<a href='http://domain.com/signin/verify?k=9876'>http://domain.com/signin/verify?k=9876</a>",+ "link": "<a href='http://domain.com/signin/verify?k=9876&c=9876'>http://domain.com/signin/verify?k=9876&c=9876</a>",},})}diff --git a/e2e/features/ui/post.feature b/e2e/features/ui/post.featureindex ba0d12d8b..4344fdbd4 100644--- a/e2e/features/ui/post.feature+++ b/e2e/features/ui/post.feature@@ -3,11 +3,11 @@ Feature: PostScenario: Admin can create a postGiven I go to the home pageAnd I sign in as "admin"- And I type "Feature Request Example" as the title+ And I click enter your suggestionAnd I type "This is just an example of a feature suggestion in fider" as the description- And I click submit new post+ And I click submit your feedbackThen I should be on the show post page- And I should see "Feature Request Example" as the post title+ And I should see "This is just an example of a feature suggestion in fider" as the post titleAnd I should see 1 vote(s)Scenario: Non-logged in user can view a post@@ -15,5 +15,20 @@ Feature: PostAnd I search for "Feature Request Example"And I click on the first postThen I should be on the show post page- And I should see "Feature Request Example" as the post title- And I should see 1 vote(s)\ No newline at end of file+ And I should see "This is just an example of a feature suggestion in fider" as the post title+ And I should see 1 vote(s)++ Scenario: Non-logged in user can draft a post and submit once signed up+ Given I go to the home page+ And I click enter your suggestion+ And I type "This is a draft post from a new user" as the description+ And I type my email address+ And I click continue with email+ Then I should be on the confirmation link page+ Given I click on the confirmation link+ Then I should be on the complete profile page+ Given I enter my name as "Matt"+ And I click submit+ Then I should be on the home page+ And I should see the new post modal+ And I should see "This is a draft post from a new user" as the draft post title\ No newline at end of filediff --git a/e2e/step_definitions/home.steps.ts b/e2e/step_definitions/home.steps.tsindex 9c50e6ad4..8ca282a53 100644--- a/e2e/step_definitions/home.steps.ts+++ b/e2e/step_definitions/home.steps.ts@@ -1,14 +1,15 @@import { Given, Then } from "@cucumber/cucumber"import { FiderWorld } from "../world"import expect from "expect"+import { getLatestLinkSentTo } from "./fns"Given("I go to the home page", async function (this: FiderWorld) {await this.page.goto(`https://${this.tenantName}.dev.fider.io:3000/`)})Then("I should be on the home page", async function (this: FiderWorld) {- const container = await this.page.$$("#p-home")- expect(container).toBeDefined()+ const container = await this.page.locator("#p-home")+ await expect(container).toBeVisible()})Then("I click on the first post", async function (this: FiderWorld) {@@ -24,9 +25,59 @@ Given("I type {string} as the title", async function (this: FiderWorld, title: s})Given("I type {string} as the description", async function (this: FiderWorld, description: string) {- await this.page.type("#input-description", description)+ const editor = this.page.getByTestId("tiptap-editor")+ // Click to focus, then type+ await editor.click()+ await this.page.keyboard.type(description)})-Given("I click submit new post", async function () {- await this.page.click(".p-home__welcome-col .c-button--primary")+Given("I click enter your suggestion", async function () {+ await this.page.click(".p-home__welcome-col .c-button--default")+})++Given("I type my email address", async function (this: FiderWorld) {+ const userEmail = `$user-${this.tenantName}@fider.io`+ await this.page.type("#input-email", userEmail)+})++Given("I click continue with email", async function () {+ await this.page.click(".c-signin-control button[type='submit']")+})++Given("I click submit your feedback", async function () {+ await this.page.click(".c-share-feedback__content .c-button--primary")+})++Given("I click on the confirmation link", async function (this: FiderWorld) {+ const userEmail = `$user-${this.tenantName}@fider.io`+ const activationLink = await getLatestLinkSentTo(userEmail)+ await this.page.goto(activationLink)+})++Then("I should be on the complete profile page", async function (this: FiderWorld) {+ const container = await this.page.$$("#p-complete-profile")+ await expect(container).toBeDefined()+})++Then("I should see the new post modal", async function (this: FiderWorld) {+ const container = await this.page.getByTestId("modal")+ await expect(container).toBeVisible()+})++Given("I enter my name as {string}", async function (this: FiderWorld, name: string) {+ await this.page.type("#input-name", name)+})++Given("I click submit", async function () {+ await this.page.click("button[type='submit']")+})++Then("I should be on the confirmation link page", async function (this: FiderWorld) {+ const userEmail = `$user-${this.tenantName}@fider.io`+ await expect(this.page.getByText(`We have just sent a confirmation link to ${userEmail}`)).toBeVisible()+})++Then("I should see {string} as the draft post title", async function (this: FiderWorld, title: string) {+ const postTitle = await this.page.locator("#input-title").inputValue()+ await expect(postTitle).toBe(title)})diff --git a/locale/ar/client.json b/locale/ar/client.jsonindex 54cca26be..40b96252d 100644--- a/locale/ar/client.json+++ b/locale/ar/client.json@@ -2,12 +2,14 @@"action.cancel": "إلغاء","action.change": "تغيير","action.close": "إغلاق",+ "action.commentsfeed": "تغذية التعليقات","action.confirm": "تأكيد","action.copylink": "نسخ الرابط","action.delete": "حذف","action.edit": "تعديل","action.markallasread": "تمييز الكل كمقروءة","action.ok": "حسناً",+ "action.postsfeed": "تغذية المنشورات","action.respond": "رد","action.save": "احفظ","action.signin": "تسجيل الدخول",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "مع","home.tagsfilter.selected.none": "أي وسم","label.actions": "أجراءات",+ "label.addtags": "أضف العلامات...","label.avatar": "الصورة الرمزية","label.custom": "تخصيص","label.description": "الوصف",@@ -75,6 +78,7 @@"label.notagsselected": "لم يتم تحديد أي علامات","label.notifications": "الإشعارات","label.or": "أو",+ "label.searchtags": "علامات البحث...","label.selecttags": "حدد وسوم...","label.subscribe": "إشترِك","label.tags": "وسوم",@@ -104,6 +108,8 @@"modal.notifications.nonew": "لا توجد إشعارات جديدة","modal.notifications.previous": "الإشعارات السابقة","modal.notifications.unread": "إشعارات غير مقروءة",+ "modal.rss.description": "للاشتراك في موجز ATOM هذا، انسخ ولصق عنوان URL هذا في قارئ RSS/ATOM الخاص بك.",+ "modal.rss.title": "اشترك في موجز ATOM","modal.showvotes.message.zeromatches": "لم يتم العثور على مستخدمين مطابقين ل <0>{0}</0>.","modal.showvotes.query.placeholder": "البحث عن المستخدمين بالاسم...","modal.signin.header": "أرسل ملاحظاتك",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "منشور جديد","mysettings.notification.event.newpost.staff": "المنشورات الجديدة على هذا الموقع","mysettings.notification.event.newpost.visitors": "المنشورات الجديدة على هذا الموقع",+ "mysettings.notification.event.newpostcreated": "تمت إضافة فكرتك 👍","mysettings.notification.event.statuschanged": "تم تغيير الحالة","mysettings.notification.event.statuschanged.staff": "تغيير الحالة على جميع المنشورات ما لم يتم إلغاء الاشتراك بها بشكل فردي","mysettings.notification.event.statuschanged.visitors": "تغيير الحالة على المنشورات التي اشتركت بها",@@ -145,6 +152,12 @@"mysettings.notification.title": "استخدم اللوحة التالية لاختيار الأحداث التي ترغب في تلقي الإشعار","mysettings.page.subtitle": "إدارة إعدادات ملفك الشخصي","mysettings.page.title": "إعدادات",+ "newpost.modal.addimage": "إضافة الصور",+ "newpost.modal.description.placeholder": "أخبرنا عنها. اشرحها بالتفصيل، لا تتردد، فكلما زادت المعلومات كان ذلك أفضل.",+ "newpost.modal.submit": "أرسل فكرتك",+ "newpost.modal.title": "شارك بفكرتك...",+ "newpost.modal.title.label": "أعط فكرتك عنوانًا",+ "newpost.modal.title.placeholder": "شيء قصير وموجز، لخصه في بضع كلمات","page.backhome": "خذني إلى <0>{0}</0> الصفحة الرئيسية.","page.notinvited.text": "لم نتمكن من العثور على حساب لعنوان بريدك الإلكتروني.","page.notinvited.title": "لم تتم دعوتك",@@ -182,5 +195,7 @@"signin.message.private.text": "إذا كان لديك حساب أو دعوت، فيمكنك استخدام الخيارات التالية لتسجيل الدخول.","signin.message.private.title": "<0>{0}</0> مساحة خاصة، يجب عليك تسجيل الدخول للمشاركة والتصويت.","signin.message.socialbutton.intro": "تسجيل الدخول بواسطة",+ "validation.custom.maxattachments": "يُسمح بحد أقصى {number} من المرفقات.",+ "validation.custom.maximagesize": "يجب أن يكون حجم الصورة أصغر من {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, zero {}one {# وسم} two {# وسوم} few {# وسوم} many {# وسوم} other {# وسوم}}"}\ No newline at end of filediff --git a/locale/cs/client.json b/locale/cs/client.jsonindex 1f3b4981b..58b344004 100644--- a/locale/cs/client.json+++ b/locale/cs/client.json@@ -182,5 +182,20 @@"signin.message.private.title": "<0>{0}</0> je soukromý prostor, pro účast a hlasování se musíte přihlásit.","signin.message.socialbutton.intro": "Přihlásit se pomocí","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}",- "labels.notagsselected": "Žádné štítky nejsou vybrány"+ "labels.notagsselected": "Žádné štítky nejsou vybrány",+ "action.commentsfeed": "Zdroj komentářů",+ "action.postsfeed": "RSS kanál příspěvků",+ "label.addtags": "Přidat štítky...",+ "label.searchtags": "Hledat štítky...",+ "mysettings.notification.event.newpostcreated": "Váš nápad byl přidán 👍",+ "newpost.modal.addimage": "Přidat obrázky",+ "newpost.modal.description.placeholder": "Řekněte nám o tom. Vysvětlete to podrobně, nezdráhejte se, čím více informací, tím lépe.",+ "newpost.modal.title": "Podělte se o svůj nápad...",+ "newpost.modal.title.label": "Dejte svému nápadu název",+ "newpost.modal.title.placeholder": "Něco krátkého a výstižného, shrňte to do pár slov",+ "newpost.modal.submit": "Odešlete svůj nápad",+ "validation.custom.maxattachments": "Maximální povolený počet příloh je {number}.",+ "validation.custom.maximagesize": "Velikost obrázku musí být menší než {kilobytes}KB.",+ "modal.rss.description": "Chcete-li se přihlásit k odběru tohoto kanálu ATOM, zkopírujte a vložte tuto URL adresu do své čtečky RSS/ATOM.",+ "modal.rss.title": "Přihlásit se k odběru kanálu ATOM"}\ No newline at end of filediff --git a/locale/de/client.json b/locale/de/client.jsonindex 278b41008..490a58d4a 100644--- a/locale/de/client.json+++ b/locale/de/client.json@@ -2,12 +2,14 @@"action.cancel": "Abbrechen","action.change": "ändern","action.close": "Schließen",+ "action.commentsfeed": "Kommentar-Feed","action.confirm": "Bestätigen","action.copylink": "Link kopieren","action.delete": "Löschen","action.edit": "Bearbeiten","action.markallasread": "Alle als gelesen markieren","action.ok": "OK",+ "action.postsfeed": "Beiträge-Feed","action.respond": "Antworten","action.save": "Sichern","action.signin": "Anmelden",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "mit","home.tagsfilter.selected.none": "Jegliche Tags","label.actions": "Aktionen",+ "label.addtags": "Tags hinzufügen...","label.avatar": "Profilbild","label.custom": "Benutzerdefiniert","label.description": "Beschreibung",@@ -75,6 +78,7 @@"label.notagsselected": "Keine Tags ausgewählt","label.notifications": "Benachrichtigungen","label.or": "ODER",+ "label.searchtags": "Tags suchen...","label.selecttags": "Tags auswählen...","label.subscribe": "Abonnieren","label.tags": "Tags",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Keine neuen Benachrichtigungen","modal.notifications.previous": "Vorherige Benachrichtigungen","modal.notifications.unread": "Ungelesene Benachrichtigungen",+ "modal.rss.description": "Um diesen ATOM-Feed zu abonnieren, kopiere diese URL und füge sie in deinen RSS/ATOM-Reader ein.",+ "modal.rss.title": "ATOM-Feed abonnieren","modal.showvotes.message.zeromatches": "Keine Benutzer gefunden, die <0>{0}</0> entsprechen.","modal.showvotes.query.placeholder": "Suche nach Benutzern nach Namen...","modal.signin.header": "Reiche dein Feedback ein",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Neuer Beitrag","mysettings.notification.event.newpost.staff": "neue Beiträge auf dieser Seite","mysettings.notification.event.newpost.visitors": "neue Beiträge auf dieser Seite",+ "mysettings.notification.event.newpostcreated": "Deine Idee wurde hinzugefügt 👍","mysettings.notification.event.statuschanged": "Status geändert","mysettings.notification.event.statuschanged.staff": "Status bei allen Beiträgen ändern, es sei denn, sie wurden einzeln abgemeldet","mysettings.notification.event.statuschanged.visitors": "Status Änderungen bei Beiträgen, die du abonniert hast",@@ -145,6 +152,12 @@"mysettings.notification.title": "Folgendes Panel verwenden, um zu wählen, für welche Ereignisse du Benachrichtigungen erhalten möchtest","mysettings.page.subtitle": "Profileinstellungen verwalten","mysettings.page.title": "Einstellungen",+ "newpost.modal.addimage": "Bilder hinzufügen",+ "newpost.modal.description.placeholder": "Erzähl uns von deiner Idee. Erkläre sie ausführlich, halte dich nicht zurück, je mehr Informationen, umso besser.",+ "newpost.modal.submit": "Reiche deine Idee ein",+ "newpost.modal.title": "Teile deine Idee ...",+ "newpost.modal.title.label": "Gib deiner Idee einen Titel",+ "newpost.modal.title.placeholder": "Eine kurze und knappe Zusammenfassung in wenigen Worten","page.backhome": "Zurück zur <0>{0}</0> Homepage.","page.notinvited.text": "Wir konnten kein Account für deine E-Mail-Adresse finden.","page.notinvited.title": "Nicht eingeladen",@@ -182,5 +195,7 @@"signin.message.private.text": "Wenn du ein Konto oder eine Einladung hast, kannst du folgende Optionen nutzen, um dich anzumelden.","signin.message.private.title": "<0>{0}</0> ist ein privater Raum, du musst dich anmelden, um teilzunehmen und abstimmen zu können.","signin.message.socialbutton.intro": "Einloggen mit",+ "validation.custom.maxattachments": "Es sind maximal {number} Anhänge zulässig.",+ "validation.custom.maximagesize": "Die Bildgröße muss kleiner als {kilobytes}KB sein.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# Tag} other {# Tags}}"}\ No newline at end of filediff --git a/locale/el/client.json b/locale/el/client.jsonindex a8dbec54d..285154b93 100644--- a/locale/el/client.json+++ b/locale/el/client.json@@ -2,12 +2,14 @@"action.cancel": "Ακύρωση","action.change": "αλλαγή","action.close": "Κλείσιμο",+ "action.commentsfeed": "Ροή σχολίων","action.confirm": "Επιβεβαίωση","action.copylink": "Αντιγραφή συνδέσμου","action.delete": "Διαγραφή","action.edit": "Επεξεργασία","action.markallasread": "Σήμανση όλων ως αναγνωσμένων","action.ok": "ΟΚ",+ "action.postsfeed": "Ροή αναρτήσεων","action.respond": "Απάντηση","action.save": "Αποθήκευση","action.signin": "Είσοδος",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "με","home.tagsfilter.selected.none": "Οποιαδήποτε ετικέτα","label.actions": "Ενέργειες",+ "label.addtags": "Προσθήκη ετικετών...","label.avatar": "Φωτογραφία προφίλ","label.custom": "Προσαρμοσμένη","label.description": "Περιγραφή",@@ -75,6 +78,7 @@"label.notagsselected": "Δεν έχουν επιλεγεί ετικέτες","label.notifications": "Ειδοποιήσεις","label.or": "Ή",+ "label.searchtags": "Αναζήτηση ετικετών...","label.selecttags": "Επιλογή ετικετών...","label.subscribe": "Εγγραφείτε","label.tags": "Ετικέτες",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Δεν υπάρχουν νέες ειδοποιήσεις","modal.notifications.previous": "Προηγούμενες ειδοποιήσεις","modal.notifications.unread": "Μη αναγνωσμένες ειδοποιήσεις",+ "modal.rss.description": "Για να εγγραφείτε σε αυτήν την ροή ATOM, αντιγράψτε και επικολλήστε αυτήν τη διεύθυνση URL στον αναγνώστη RSS/ATOM.",+ "modal.rss.title": "Εγγραφείτε στη ροή ATOM","modal.showvotes.message.zeromatches": "Δεν βρέθηκαν χρήστες που να ταιριάζουν <0>{0}</0>.","modal.showvotes.query.placeholder": "Αναζήτηση χρηστών με όνομα...","modal.signin.header": "Υποβάλετε τα σχόλιά σας",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Νέα Δημοσίευση","mysettings.notification.event.newpost.staff": "νέες δημοσιεύσεις σε αυτήν την ιστοσελίδα","mysettings.notification.event.newpost.visitors": "νέες δημοσιεύσεις σε αυτήν την ιστοσελίδα",+ "mysettings.notification.event.newpostcreated": "Η ιδέα σου προστέθηκε 👍","mysettings.notification.event.statuschanged": "Η Κατάσταση Άλλαξε","mysettings.notification.event.statuschanged.staff": "αλλαγή κατάστασης σε όλες τις δημοσιεύσεις εκτός αν διαγραφούν μεμονωμένα","mysettings.notification.event.statuschanged.visitors": "αλλαγή κατάστασης στις αναρτήσεις στις οποίες έχετε εγγραφεί",@@ -145,6 +152,12 @@"mysettings.notification.title": "Χρησιμοποιήστε τον παρακάτω πίνακα για να επιλέξετε για ποια γεγονότα θα θέλατε να λαμβάνετε ειδοποίηση","mysettings.page.subtitle": "Διαχείριση των ρυθμίσεων του προφίλ σας","mysettings.page.title": "Ρυθμίσεις",+ "newpost.modal.addimage": "Προσθήκη εικόνων",+ "newpost.modal.description.placeholder": "Πείτε μας γι' αυτό. Εξηγήστε το πλήρως, μην διστάζετε, όσο περισσότερες πληροφορίες τόσο το καλύτερο.",+ "newpost.modal.submit": "Υποβάλετε την ιδέα σας",+ "newpost.modal.title": "Μοιραστείτε την ιδέα σας...",+ "newpost.modal.title.label": "Δώστε έναν τίτλο στην ιδέα σας",+ "newpost.modal.title.placeholder": "Κάτι σύντομο και περιεκτικό, συνοψίστε το σε λίγες λέξεις","page.backhome": "Επιστρέψτε με στην αρχική σελίδα <0>{0}</0>.","page.notinvited.text": "Δεν μπορέσαμε να βρούμε λογαριασμό για τη διεύθυνση email σας.","page.notinvited.title": "Δεν έχει προσκληθεί",@@ -182,5 +195,7 @@"signin.message.private.text": "Αν έχετε λογαριασμό ή πρόσκληση, μπορείτε να χρησιμοποιήσετε τις παρακάτω επιλογές για να συνδεθείτε.","signin.message.private.title": "<0>{0}</0> είναι ένας ιδιωτικός χώρος, πρέπει να συνδεθείτε για να συμμετάσχετε και να ψηφίσετε.","signin.message.socialbutton.intro": "Συνδεθείτε με",+ "validation.custom.maxattachments": "Επιτρέπονται έως {number} συνημμένα.",+ "validation.custom.maximagesize": "Το μέγεθος της εικόνας πρέπει να είναι μικρότερο από {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# ετικέτα} other {# ετικέτες}}"}\ No newline at end of filediff --git a/locale/en/client.json b/locale/en/client.jsonindex d0f2018ed..abf3194b4 100644--- a/locale/en/client.json+++ b/locale/en/client.json@@ -2,12 +2,14 @@"action.cancel": "Cancel","action.change": "change","action.close": "Close",+ "action.commentsfeed": "Comment Feed","action.confirm": "Confirm","action.copylink": "Copy link","action.delete": "Delete","action.edit": "Edit","action.markallasread": "Mark All as Read","action.ok": "OK",+ "action.postsfeed": "Posts Feed","action.respond": "Respond","action.save": "Save","action.signin": "Sign in",@@ -34,8 +36,8 @@"error.notinvited.title": "Not Invited","error.pagenotfound.text": "The link you clicked may be broken or the page may have been removed.","error.pagenotfound.title": "Page not found",- "error.unauthorized.text": "You are not authorized to view this page.",- "error.unauthorized.title": "Not Authorized",+ "error.unauthorized.text": "You need to sign in before accessing this page.",+ "error.unauthorized.title": "Unauthorized","home.filter.label": "Filter","home.filter.search.label": "Search in filters...","home.form.defaultinvitation": "Enter your suggestion here...",@@ -53,11 +55,11 @@"home.postscontainer.label.viewmore": "View more posts","home.postscontainer.query.placeholder": "Search","home.postsort.label": "Sort by:",- "home.similar.subtitle": "Consider voting on existing posts instead.",- "home.similar.title": "Similar posts",+ "home.similar.title": "We have similar posts, is your idea already on the list?","home.tagsfilter.label.with": "with","home.tagsfilter.selected.none": "Any tag","label.actions": "Actions",+ "label.addtags": "Add tags...","label.avatar": "Avatar","label.custom": "Custom","label.description": "Description",@@ -75,6 +77,7 @@"label.notagsselected": "No tags selected","label.notifications": "Notifications","label.or": "OR",+ "label.searchtags": "Search tags...","label.selecttags": "Select tags...","label.subscribe": "Subscribe","label.tags": "Tags",@@ -104,9 +107,11 @@"modal.notifications.nonew": "No new notifications","modal.notifications.previous": "Previous notifications","modal.notifications.unread": "Unread notifications",- "modal.showvotes.message.zeromatches": "No users found matching <0>{0}</0>.",+ "modal.rss.description": "To subscribe to this ATOM feed, copy and paste this URL into your RSS/ATOM reader.",+ "modal.rss.title": "Subscribe to ATOM feed",+ "modal.showvotes.message.zeromatches": "No users found matching <0>{query}</0>.","modal.showvotes.query.placeholder": "Search for users by name...",- "modal.signin.header": "Submit your feedback",+ "modal.signin.header": "Join the conversation","mynotifications.label.readrecently": "Read on last 30 days.","mynotifications.message.nounread": "No unread notifications.","mynotifications.page.subtitle": "Stay up to date with what's happening",@@ -128,13 +133,14 @@"mysettings.message.privateemail": "Your email is private and will never be publicly displayed.","mysettings.notification.channelemail": "Email","mysettings.notification.channelweb": "Web",- "mysettings.notification.event.discussion": "Discussion",+ "mysettings.notification.event.discussion": "New Comments","mysettings.notification.event.discussion.staff": "comments on all posts unless individually unsubscribed","mysettings.notification.event.discussion.visitors": "comments on posts you've subscribed to","mysettings.notification.event.mention": "Mentions","mysettings.notification.event.newpost": "New Post","mysettings.notification.event.newpost.staff": "new posts on this site","mysettings.notification.event.newpost.visitors": "new posts on this site",+ "mysettings.notification.event.newpostcreated": "Your idea has been added 👍","mysettings.notification.event.statuschanged": "Status Changed","mysettings.notification.event.statuschanged.staff": "status change on all posts unless individually unsubscribed","mysettings.notification.event.statuschanged.visitors": "status change on posts you've subscribed to",@@ -142,18 +148,24 @@"mysettings.notification.message.none": "You'll <0>NOT</0> receive any notification about this event.","mysettings.notification.message.webandemail": "You'll receive <0>web</0> and <1>email</1> notifications about {about}.","mysettings.notification.message.webonly": "You'll receive <0>web</0> notifications about {about}.",- "mysettings.notification.title": "Use following panel to choose which events you'd like to receive notification",+ "mysettings.notification.title": "Choose the events to receive a notification for.","mysettings.page.subtitle": "Manage your profile settings","mysettings.page.title": "Settings",+ "newpost.modal.addimage": "Add Images",+ "newpost.modal.description.placeholder": "Tell us about it. Explain it fully, don't hold back, the more information the better.",+ "newpost.modal.submit": "Submit your idea",+ "newpost.modal.title": "Share your idea...",+ "newpost.modal.title.label": "Give your idea a title",+ "newpost.modal.title.placeholder": "Something short and snappy, sum it up in a few words","page.backhome": "Take me back to <0>{0}</0> home page.","page.notinvited.text": "We could not find an account for your email address.","page.notinvited.title": "Not invited","page.pendingactivation.text": "We sent you a confirmation email with a link to activate your site.","page.pendingactivation.text2": "Please check your inbox to activate it.","page.pendingactivation.title": "Your account is pending activation",- "showpost.comment.copylink.error": "Failed to copy comment link, please copy page URL",- "showpost.comment.copylink.success": "Comment link copied to clipboard",- "showpost.comment.unknownhighlighted": "Invalid comment ID #{id}",+ "showpost.comment.copylink.error": "Could not copy comment link, please copy page URL",+ "showpost.comment.copylink.success": "Successfully copied comment link to clipboard",+ "showpost.comment.unknownhighlighted": "Unknown comment ID #{id}","showpost.commentinput.placeholder": "Leave a comment","showpost.copylink.success": "Link copied to clipboard","showpost.discussionpanel.emptymessage": "No one has commented yet.",@@ -173,7 +185,7 @@"showpost.votespanel.more": "+{extraVotesCount} more","showpost.votespanel.seedetails": "see details","signin.email.placeholder": "Email address",- "signin.message.email": "Continue with email",+ "signin.message.email": "Continue with Email","signin.message.emaildisabled": "Email authentication has been disabled by an administrator. If you have an administrator account and need to bypass this restriction, please <0>click here</0>.","signin.message.emailsent": "We have just sent a confirmation link to <0>{email}</0>. Click the link and you’ll be signed in.","signin.message.locked.text": "To reactivate this site, sign in with an administrator account and update the required settings.",@@ -181,6 +193,8 @@"signin.message.onlyadmins": "Currently only allowed to sign in to an administrator account","signin.message.private.text": "If you have an account or an invitation, you may use following options to sign in.","signin.message.private.title": "<0>{0}</0> is a private space, you must sign in to participate and vote.",- "signin.message.socialbutton.intro": "Log in with",+ "signin.message.socialbutton.intro": "Continue with",+ "validation.custom.maxattachments": "A maximum of {number} attachments are allowed.",+ "validation.custom.maximagesize": "The image size must be smaller than {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}diff --git a/locale/es-ES/client.json b/locale/es-ES/client.jsonindex 0e045cbe7..03ad16bfa 100644--- a/locale/es-ES/client.json+++ b/locale/es-ES/client.json@@ -2,12 +2,14 @@"action.cancel": "Cancelar","action.change": "cambiar","action.close": "Cerrar",+ "action.commentsfeed": "Feed de comentarios","action.confirm": "Confirmar","action.copylink": "Copiar enlace","action.delete": "Eliminar","action.edit": "Editar","action.markallasread": "Marcar Todo como Leído","action.ok": "Aceptar",+ "action.postsfeed": "Feed de publicaciones","action.respond": "Responder","action.save": "Guardar","action.signin": "Iniciar sesión",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "con","home.tagsfilter.selected.none": "Cualquier etiqueta","label.actions": "Acciones",+ "label.addtags": "Añadir etiquetas...","label.avatar": "Avatar","label.custom": "Personalizado","label.description": "Descripción",@@ -75,6 +78,7 @@"label.notagsselected": "No hay etiquetas seleccionadas","label.notifications": "Notificaciones","label.or": "O",+ "label.searchtags": "Buscar etiquetas...","label.selecttags": "Seleccionar etiquetas...","label.subscribe": "Suscribete","label.tags": "Etiquetas",@@ -104,6 +108,8 @@"modal.notifications.nonew": "No hay nuevas notificaciones","modal.notifications.previous": "Notificaciones anteriores","modal.notifications.unread": "Notificaciones no leídas",+ "modal.rss.description": "Para suscribirse a este feed ATOM, copie y pegue esta URL en su lector RSS/ATOM.",+ "modal.rss.title": "Suscríbete al feed de ATOM","modal.showvotes.message.zeromatches": "No se encontraron usuarios que coincidan con <0>{0}</0>.","modal.showvotes.query.placeholder": "Buscar usuarios por nombre...","modal.signin.header": "Envíe sus comentarios",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nueva Publicación","mysettings.notification.event.newpost.staff": "nuevas publicaciones en este sitio","mysettings.notification.event.newpost.visitors": "nuevas publicaciones en este sitio",+ "mysettings.notification.event.newpostcreated": "Tu idea ha sido añadida 👍","mysettings.notification.event.statuschanged": "Estado Modificado","mysettings.notification.event.statuschanged.staff": "cambio de estado en todas las publicaciones a menos que se cancele la suscripción individualmente","mysettings.notification.event.statuschanged.visitors": "cambio de estado en las publicaciones a las que te has suscrito",@@ -145,6 +152,12 @@"mysettings.notification.title": "Utiliza el siguiente panel para elegir sobre cuáles eventos quieres recibir notificaciones","mysettings.page.subtitle": "Administra la configuración de tu perfil","mysettings.page.title": "Configuración",+ "newpost.modal.addimage": "Agregar imágenes",+ "newpost.modal.description.placeholder": "Cuéntanoslo. Explícalo con todo detalle, sin reservas. Cuanta más información, mejor.",+ "newpost.modal.submit": "Envía tu idea",+ "newpost.modal.title": "Comparte tu idea...",+ "newpost.modal.title.label": "Dale un título a tu idea",+ "newpost.modal.title.placeholder": "Algo corto y conciso, resúmalo en pocas palabras.","page.backhome": "Llévame a la página de inicio de <0>{0}</0>.","page.notinvited.text": "No pudimos encontrar una cuenta asociada a tu correo electrónico.","page.notinvited.title": "Sin invitación",@@ -182,5 +195,7 @@"signin.message.private.text": "Si tienes una cuenta o una invitación, puedes usar las siguientes opciones para iniciar sesión.","signin.message.private.title": "<0>{0}</0> es un espacio privado, debes iniciar sesión para participar y votar.","signin.message.socialbutton.intro": "Iniciar sesión con",+ "validation.custom.maxattachments": "Se permite un máximo de {number} archivos adjuntos.",+ "validation.custom.maximagesize": "El tamaño de la imagen debe ser menor que {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# etiqueta} other {# etiquetas}}"}\ No newline at end of filediff --git a/locale/fr/client.json b/locale/fr/client.jsonindex bb596301b..a523c0309 100644--- a/locale/fr/client.json+++ b/locale/fr/client.json@@ -2,12 +2,14 @@"action.cancel": "Annuler","action.change": "changer","action.close": "Fermer",+ "action.commentsfeed": "Flux de commentaires","action.confirm": "Confirmer","action.copylink": "Copier le lien","action.delete": "Supprimer","action.edit": "Modifier","action.markallasread": "Tout marquer comme lu","action.ok": "D'ACCORD",+ "action.postsfeed": "Flux de publications","action.respond": "Répondre","action.save": "Enregistrer","action.signin": "Se connecter",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "avec","home.tagsfilter.selected.none": "N'importe quel tag","label.actions": "Actes",+ "label.addtags": "Ajouter des balises...","label.avatar": "Avatar","label.custom": "Personnalisé","label.description": "Description",@@ -75,6 +78,7 @@"label.notagsselected": "Aucune balise sélectionnée","label.notifications": "Notifications","label.or": "OU",+ "label.searchtags": "Rechercher des balises...","label.selecttags": "Séléctionner des étiquettes...","label.subscribe": "S'abonner","label.tags": "Mots clés",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Pas de nouvelles notifications","modal.notifications.previous": "Notifications précédentes","modal.notifications.unread": "Notifications non lues",+ "modal.rss.description": "Pour vous abonner à ce flux ATOM, copiez et collez cette URL dans votre lecteur RSS/ATOM.",+ "modal.rss.title": "Abonnez-vous au flux ATOM","modal.showvotes.message.zeromatches": "Aucun utilisateur correspondant à <0>{0}</0>.","modal.showvotes.query.placeholder": "Rechercher des utilisateurs par nom...","modal.signin.header": "Envoyer vos commentaires",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nouveau message","mysettings.notification.event.newpost.staff": "nouveaux messages sur ce site","mysettings.notification.event.newpost.visitors": "nouveaux messages sur ce site",+ "mysettings.notification.event.newpostcreated": "Votre idée a été ajoutée 👍","mysettings.notification.event.statuschanged": "Statut modifié","mysettings.notification.event.statuschanged.staff": "changement de statut sur tous les messages sauf si désabonné individuellement","mysettings.notification.event.statuschanged.visitors": "changement de statut sur les messages auxquels vous vous êtes abonné",@@ -145,6 +152,12 @@"mysettings.notification.title": "Utiliser le panneau suivant pour choisir pour quels événements vous souhaitez recevoir une notification","mysettings.page.subtitle": "Gérer les paramètres de votre profil","mysettings.page.title": "Paramètres",+ "newpost.modal.addimage": "Ajouter des images",+ "newpost.modal.description.placeholder": "Parlez-nous-en. Expliquez-nous tout en détail, sans retenue : plus vous donnez d'informations, mieux c'est.",+ "newpost.modal.submit": "Soumettez votre idée",+ "newpost.modal.title": "Partagez votre idée...",+ "newpost.modal.title.label": "Donnez un titre à votre idée",+ "newpost.modal.title.placeholder": "Quelque chose de court et percutant, résumez-le en quelques mots","page.backhome": "Ramenez-moi à la page d'accueil de <0>{0}</0>.","page.notinvited.text": "Nous n'avons pas trouvé de compte avec cette adresse e-mail.","page.notinvited.title": "Non invité",@@ -182,5 +195,7 @@"signin.message.private.text": "Si vous avez un compte ou une invitation, vous pouvez utiliser les options suivantes pour vous connecter.","signin.message.private.title": "<0>{0}</0> est un espace privé, vous devez vous connecter pour participer et voter.","signin.message.socialbutton.intro": "Se connecter avec",+ "validation.custom.maxattachments": "Un maximum de {number} pièces jointes est autorisé.",+ "validation.custom.maximagesize": "La taille de l'image doit être inférieure à {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/it/client.json b/locale/it/client.jsonindex e9f3a9b60..7ae0a96c6 100644--- a/locale/it/client.json+++ b/locale/it/client.json@@ -2,12 +2,14 @@"action.cancel": "Cancella","action.change": "modifica","action.close": "Chiudi",+ "action.commentsfeed": "Feed dei commenti","action.confirm": "Conferma","action.copylink": "Copia il collegamento","action.delete": "Cancella","action.edit": "Modifica","action.markallasread": "Segna tutto come letto","action.ok": "OK",+ "action.postsfeed": "Feed dei post","action.respond": "Rispondi","action.save": "Salva","action.signin": "Accedi",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "con","home.tagsfilter.selected.none": "Qualsiasi tag","label.actions": "Azioni",+ "label.addtags": "Aggiungi tag...","label.avatar": "Foto profilo","label.custom": "Personalizzato","label.description": "Descrizione",@@ -75,6 +78,7 @@"label.notagsselected": "Nessun tag selezionato","label.notifications": "Notifiche","label.or": "OPPURE",+ "label.searchtags": "Cerca tag...","label.selecttags": "Seleziona i tag...","label.subscribe": "Abbonati","label.tags": "Etichette",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Nessuna nuova notifica","modal.notifications.previous": "Notifiche precedenti","modal.notifications.unread": "Notifiche non lette",+ "modal.rss.description": "Per iscriverti a questo feed ATOM, copia e incolla questo URL nel tuo lettore RSS/ATOM.",+ "modal.rss.title": "Iscriviti al feed ATOM","modal.showvotes.message.zeromatches": "Nessun utente trovato corrispondente a <0>{0}</0>.","modal.showvotes.query.placeholder": "Cerca gli utenti per nome...","modal.signin.header": "Invia il tuo feedback",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nuovo post","mysettings.notification.event.newpost.staff": "nuovi post su questo sito","mysettings.notification.event.newpost.visitors": "nuovi post su questo sito",+ "mysettings.notification.event.newpostcreated": "La tua idea è stata aggiunta 👍","mysettings.notification.event.statuschanged": "Stato modificato","mysettings.notification.event.statuschanged.staff": "cambio di stato su tutti i post a meno che non vi sia una sottoscrizione individuale","mysettings.notification.event.statuschanged.visitors": "cambio di stato sui post a cui ti sei iscritto",@@ -145,6 +152,12 @@"mysettings.notification.title": "Usa il pannello seguente per scegliere quali eventi vuoi ricevere una notifica","mysettings.page.subtitle": "Gestisci le impostazioni del profilo","mysettings.page.title": "Impostazioni",+ "newpost.modal.addimage": "Aggiungi immagini",+ "newpost.modal.description.placeholder": "Raccontacelo. Spiegalo in dettaglio, non esitare, più informazioni hai, meglio è.",+ "newpost.modal.submit": "Invia la tua idea",+ "newpost.modal.title": "Condividi la tua idea...",+ "newpost.modal.title.label": "Dai un titolo alla tua idea",+ "newpost.modal.title.placeholder": "Qualcosa di breve e conciso, riassumilo in poche parole","page.backhome": "Portami indietro alla <0>{0}</0> pagina principale.","page.notinvited.text": "Non siamo riusciti a trovare un account per il tuo indirizzo email.","page.notinvited.title": "Nessun invito",@@ -182,5 +195,7 @@"signin.message.private.text": "Se si dispone di un account o di un invito, è possibile utilizzare le seguenti opzioni per accedere.","signin.message.private.title": "<0>{0}</0> è uno spazio privato, è necessario registrarsi per partecipare e votare.","signin.message.socialbutton.intro": "Accedi con",+ "validation.custom.maxattachments": "Sono consentiti al massimo {number} allegati.",+ "validation.custom.maximagesize": "La dimensione dell'immagine deve essere inferiore a {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/ja/client.json b/locale/ja/client.jsonindex 51d2b231f..f1bc26cdb 100644--- a/locale/ja/client.json+++ b/locale/ja/client.json@@ -2,12 +2,14 @@"action.cancel": "キャンセル","action.change": "変更","action.close": "閉じる",+ "action.commentsfeed": "コメントフィード","action.confirm": "確認","action.copylink": "リンクをコピー","action.delete": "削除","action.edit": "編集","action.markallasread": "すべて既読にする","action.ok": "わかりました",+ "action.postsfeed": "投稿フィード","action.respond": "回答","action.save": "保存","action.signin": "ログイン",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "と","home.tagsfilter.selected.none": "任意のタグ","label.actions": "アクション",+ "label.addtags": "タグを追加...","label.avatar": "アバター","label.custom": "カスタム","label.description": "説明",@@ -75,6 +78,7 @@"label.notagsselected": "タグが選択されていません","label.notifications": "通知","label.or": "または",+ "label.searchtags": "タグを検索...","label.selecttags": "タグを選択...","label.subscribe": "購読する","label.tags": "タグ",@@ -104,6 +108,8 @@"modal.notifications.nonew": "新しい通知はありません","modal.notifications.previous": "過去の通知","modal.notifications.unread": "未読通知",+ "modal.rss.description": "この ATOM フィードを購読するには、この URL をコピーして RSS/ATOM リーダーに貼り付けます。",+ "modal.rss.title": "ATOMフィードを購読する","modal.showvotes.message.zeromatches": "<0>{0}</0>に一致するユーザーは見つかりませんでした。","modal.showvotes.query.placeholder": "名前でユーザーを検索...","modal.signin.header": "フィードバックを送信",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "新規投稿","mysettings.notification.event.newpost.staff": "このサイトへの新しい投稿","mysettings.notification.event.newpost.visitors": "このサイトへの新しい投稿",+ "mysettings.notification.event.newpostcreated": "あなたのアイデアが追加されました👍","mysettings.notification.event.statuschanged": "ステータスが変更されました","mysettings.notification.event.statuschanged.staff": "個別に購読を解除しない限り、すべての投稿のステータス変更","mysettings.notification.event.statuschanged.visitors": "購読済みの投稿のステータス変更",@@ -145,6 +152,12 @@"mysettings.notification.title": "通知を受け取るイベントを選択するには、次のパネルを使用してください","mysettings.page.subtitle": "プロフィール設定の管理","mysettings.page.title": "設定",+ "newpost.modal.addimage": "画像を追加する",+ "newpost.modal.description.placeholder": "教えてください。遠慮せずに、詳しく説明してください。情報が多ければ多いほど良いです。",+ "newpost.modal.submit": "アイデアを提出する",+ "newpost.modal.title": "あなたのアイデアを共有してください...",+ "newpost.modal.title.label": "アイデアにタイトルをつける",+ "newpost.modal.title.placeholder": "短くて簡潔なもの、一言でまとめましょう","page.backhome": "<0>{0}</0>のホームページに戻ります。","page.notinvited.text": "あなたのメールアドレスのアカウントが見つかりませんでした","page.notinvited.title": "未招待",@@ -182,5 +195,7 @@"signin.message.private.text": "アカウントや招待状をお持ちの場合は、以下のオプションを使用してサインインできます。","signin.message.private.title": "<0>{0}</0> はプライベートなスペースです。サインインして投票してください。","signin.message.socialbutton.intro": "ログイン",+ "validation.custom.maxattachments": "最大 {number} 個の添付ファイルが許可されます。",+ "validation.custom.maximagesize": "画像サイズは{kilobytes}KB未満である必要があります。","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/ko/client.json b/locale/ko/client.jsonindex 06b227f3f..fa137d947 100644--- a/locale/ko/client.json+++ b/locale/ko/client.json@@ -182,5 +182,20 @@"signin.message.private.title": "<0>{0}</0>은 비공개 공간이므로 참여하고 투표하려면 로그인해야 합니다.","signin.message.socialbutton.intro": "로그인하세요","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}",- "labels.notagsselected": "선택된 태그가 없습니다"+ "labels.notagsselected": "선택된 태그가 없습니다",+ "action.commentsfeed": "댓글 피드",+ "action.postsfeed": "게시물 피드",+ "label.addtags": "태그 추가...",+ "label.searchtags": "태그 검색...",+ "mysettings.notification.event.newpostcreated": "귀하의 아이디어가 추가되었습니다 👍",+ "newpost.modal.addimage": "이미지 추가",+ "newpost.modal.description.placeholder": "자세히 설명해 주세요. 숨기지 말고, 정보가 많을수록 좋습니다.",+ "newpost.modal.title": "여러분의 아이디어를 공유해 보세요...",+ "newpost.modal.title.label": "당신의 아이디어에 제목을 붙이세요",+ "newpost.modal.title.placeholder": "짧고 간결하게 요약하자면 몇 마디로 요약할 수 있습니다.",+ "newpost.modal.submit": "아이디어를 제출하세요",+ "validation.custom.maxattachments": "최대 {number}개의 첨부 파일이 허용됩니다.",+ "validation.custom.maximagesize": "이미지 크기는 {kilobytes}KB보다 작아야 합니다.",+ "modal.rss.description": "이 ATOM 피드를 구독하려면 이 URL을 복사하여 RSS/ATOM 리더에 붙여넣으세요.",+ "modal.rss.title": "ATOM 피드 구독하기"}\ No newline at end of filediff --git a/locale/nl/client.json b/locale/nl/client.jsonindex 1b1e31eac..b2bca7d40 100644--- a/locale/nl/client.json+++ b/locale/nl/client.json@@ -2,12 +2,14 @@"action.cancel": "Annuleren","action.change": "aanpassen","action.close": "Sluiten",+ "action.commentsfeed": "Reactiefeed","action.confirm": "Bevestigen","action.copylink": "Link kopiëren","action.delete": "Verwijderen","action.edit": "Bewerken","action.markallasread": "Markeer alles als gelezen","action.ok": "OK",+ "action.postsfeed": "Berichtenfeed","action.respond": "Reageren","action.save": "Opslaan","action.signin": "Inloggen",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "met","home.tagsfilter.selected.none": "Elk label","label.actions": "Acties",+ "label.addtags": "Tags toevoegen...","label.avatar": "Profielafbeelding","label.custom": "Aangepast","label.description": "Omschrijving",@@ -75,6 +78,7 @@"label.notagsselected": "Geen tags geselecteerd","label.notifications": "Meldingen","label.or": "OF",+ "label.searchtags": "Zoek tags...","label.selecttags": "Tags selecteren...","label.subscribe": "Abonneren","label.tags": "Labels",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Geen nieuwe meldingen","modal.notifications.previous": "Eerdere meldingen","modal.notifications.unread": "Ongelezen meldingen",+ "modal.rss.description": "Om u te abonneren op deze ATOM-feed, kopieert en plakt u deze URL in uw RSS/ATOM-lezer.",+ "modal.rss.title": "Abonneer je op de ATOM-feed","modal.showvotes.message.zeromatches": "Geen gebruikers gevonden voor <0>{0}</0>.","modal.showvotes.query.placeholder": "Zoek gebruikers op naam...","modal.signin.header": "Geef uw feedback",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nieuw Bericht","mysettings.notification.event.newpost.staff": "nieuwe berichten op deze site","mysettings.notification.event.newpost.visitors": "nieuwe berichten op deze site",+ "mysettings.notification.event.newpostcreated": "Jouw idee is toegevoegd 👍","mysettings.notification.event.statuschanged": "Status veranderd","mysettings.notification.event.statuschanged.staff": "statuswijzigingen van alle berichten, tenzij individueel afgemeld","mysettings.notification.event.statuschanged.visitors": "statuswijzigingen van alle berichten waarop je bent geabonneerd",@@ -145,6 +152,12 @@"mysettings.notification.title": "Gebruik het volgende paneel om te kiezen van welke gebeurtenissen je meldingen wil ontvangen","mysettings.page.subtitle": "Beheer jouw profielinstellingen","mysettings.page.title": "Instellingen",+ "newpost.modal.addimage": "Afbeeldingen toevoegen",+ "newpost.modal.description.placeholder": "Vertel het ons. Leg het volledig uit, houd je niet in, hoe meer informatie hoe beter.",+ "newpost.modal.submit": "Dien uw idee in",+ "newpost.modal.title": "Deel uw idee...",+ "newpost.modal.title.label": "Geef je idee een titel",+ "newpost.modal.title.placeholder": "Iets kort en krachtigs, vat het samen in een paar woorden","page.backhome": "Ga terug naar <0>{0}</0> startpagina.","page.notinvited.text": "We konden geen account vinden voor dit e-mailadres.","page.notinvited.title": "Niet uitgenodigd",@@ -182,5 +195,7 @@"signin.message.private.text": "Als je een account of een uitnodiging hebt, kun je de volgende methodes gebruiken om in te loggen.","signin.message.private.title": "<0>{0}</0> is een privéruimte. U moet ingelogd zijn om deel te nemen en te stemmen.","signin.message.socialbutton.intro": "Inloggen met",+ "validation.custom.maxattachments": "Er zijn maximaal {number} bijlagen toegestaan.",+ "validation.custom.maximagesize": "De afbeeldingsgrootte moet kleiner zijn dan {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/pl/client.json b/locale/pl/client.jsonindex 24b5e9aaa..9d4a8ac22 100644--- a/locale/pl/client.json+++ b/locale/pl/client.json@@ -2,12 +2,14 @@"action.cancel": "Anuluj","action.change": "zmień","action.close": "Zamknij",+ "action.commentsfeed": "Kanał komentarzy","action.confirm": "Potwierdź","action.copylink": "Kopiuj link","action.delete": "Usuń","action.edit": "Edytuj","action.markallasread": "Oznacz wszystkie jako przeczytane","action.ok": "OK",+ "action.postsfeed": "Kanał postów","action.respond": "Odpowiedz","action.save": "Zapisz","action.signin": "Zaloguj się",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "z","home.tagsfilter.selected.none": "Dowolny tag","label.actions": "Akcje",+ "label.addtags": "Dodaj tagi...","label.avatar": "Awatar","label.custom": "Niestandardowy","label.description": "Opis",@@ -75,6 +78,7 @@"label.notagsselected": "Nie wybrano tagów","label.notifications": "Powiadomienia","label.or": "LUB",+ "label.searchtags": "Szukaj tagów...","label.selecttags": "Wybierz tagi...","label.subscribe": "Subskrybuj","label.tags": "Tagi",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Brak nowych powiadomień","modal.notifications.previous": "Poprzednie powiadomienia","modal.notifications.unread": "Nieprzeczytane powiadomienia",+ "modal.rss.description": "Aby zasubskrybować ten kanał ATOM, skopiuj i wklej ten adres URL do swojego czytnika RSS/ATOM.",+ "modal.rss.title": "Subskrybuj kanał ATOM","modal.showvotes.message.zeromatches": "Nie znaleziono użytkowników pasujących do <0>{0}</0>.","modal.showvotes.query.placeholder": "Wyszukaj użytkowników według nazwy...","modal.signin.header": "Prześlij swoją opinię",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nowy post","mysettings.notification.event.newpost.staff": "nowe posty na tej stronie","mysettings.notification.event.newpost.visitors": "nowe posty na tej stronie",+ "mysettings.notification.event.newpostcreated": "Twój pomysł został dodany 👍","mysettings.notification.event.statuschanged": "Zmieniono status","mysettings.notification.event.statuschanged.staff": "zmiana statusu wszystkich postów, chyba że zostały indywidualnie odsubskrybowane","mysettings.notification.event.statuschanged.visitors": "zmiana statusu postów, które zasubskrybowałeś",@@ -145,6 +152,12 @@"mysettings.notification.title": "Użyj następującego panelu, aby wybrać zdarzenia z których chciałbyś otrzymywać powiadomienia","mysettings.page.subtitle": "Zarządzaj ustawieniami profilu","mysettings.page.title": "Ustawienia",+ "newpost.modal.addimage": "Dodaj obrazy",+ "newpost.modal.description.placeholder": "Opowiedz nam o tym. Wyjaśnij to dokładnie, nie powstrzymuj się, im więcej informacji, tym lepiej.",+ "newpost.modal.submit": "Prześlij swój pomysł",+ "newpost.modal.title": "Podziel się swoim pomysłem...",+ "newpost.modal.title.label": "Nadaj swojemu pomysłowi tytuł",+ "newpost.modal.title.placeholder": "Coś krótkiego i zwięzłego, podsumuj to w kilku słowach","page.backhome": "Zabierz mnie z powrotem na stronę główną <0>{0}</0>.","page.notinvited.text": "Nie znaleźliśmy konta powiązanego z Twoim adresem email.","page.notinvited.title": "Niezaproszony",@@ -182,5 +195,7 @@"signin.message.private.text": "Jeśli posiadasz konto lub zaproszenie możesz użyć poniższych opcji aby się zalogować.","signin.message.private.title": "<0>{0}</0> to przestrzeń prywatna, musisz się zalogować, aby uczestniczyć i głosować.","signin.message.socialbutton.intro": "Zaloguj się za pomocą",+ "validation.custom.maxattachments": "Maksymalna liczba załączników to {number}.",+ "validation.custom.maximagesize": "Rozmiar obrazu musi być mniejszy niż {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} few {# tagów} many {# tagów} other {# tagi}}"}\ No newline at end of filediff --git a/locale/pt-BR/client.json b/locale/pt-BR/client.jsonindex 85042a2cc..deedbc39c 100644--- a/locale/pt-BR/client.json+++ b/locale/pt-BR/client.json@@ -2,12 +2,14 @@"action.cancel": "Cancelar","action.change": "alterar","action.close": "Fechar",+ "action.commentsfeed": "Feed de comentários","action.confirm": "Confirmar","action.copylink": "Copiar link","action.delete": "Deletar","action.edit": "Editar","action.markallasread": "Marcar todas como lidas","action.ok": "OK",+ "action.postsfeed": "Feed de postagens","action.respond": "Responder","action.save": "Salvar","action.signin": "Iniciar sessão",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "com","home.tagsfilter.selected.none": "Qualquer tag","label.actions": "Ações",+ "label.addtags": "Adicionar tags...","label.avatar": "Avatar","label.custom": "Personalizado","label.description": "Descrição",@@ -75,6 +78,7 @@"label.notagsselected": "Nenhuma tag selecionada","label.notifications": "Notificações","label.or": "OU",+ "label.searchtags": "Pesquisar tags...","label.selecttags": "Escolha as tags...","label.subscribe": "Inscrever-se","label.tags": "Etiquetas",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Nenhuma nova notificação","modal.notifications.previous": "Notificações anteriores","modal.notifications.unread": "Notificações não lidas",+ "modal.rss.description": "Para assinar este feed ATOM, copie e cole esta URL no seu leitor RSS/ATOM.",+ "modal.rss.title": "Assinar o feed ATOM","modal.showvotes.message.zeromatches": "Nenhum usuário encontrado para <0>{0}</0>.","modal.showvotes.query.placeholder": "Procurar usuários por nome...","modal.signin.header": "Enviar seu feedback",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nova postagem","mysettings.notification.event.newpost.staff": "novas postagens nesse site","mysettings.notification.event.newpost.visitors": "novas postagens nesse site",+ "mysettings.notification.event.newpostcreated": "Sua ideia foi adicionada 👍","mysettings.notification.event.statuschanged": "Alteração de status","mysettings.notification.event.statuschanged.staff": "alteração de status em todas as postagens, a menos que individualmente desinscritas","mysettings.notification.event.statuschanged.visitors": "alteração de status em postagens que você se inscreveu",@@ -145,6 +152,12 @@"mysettings.notification.title": "Use o painel a seguir para escolher quais eventos você gostaria de ser notificado","mysettings.page.subtitle": "Gerenciar suas configurações de perfil","mysettings.page.title": "Configurações",+ "newpost.modal.addimage": "Adicionar imagens",+ "newpost.modal.description.placeholder": "Conte-nos sobre isso. Explique tudo detalhadamente, não se esconda, quanto mais informações, melhor.",+ "newpost.modal.submit": "Envie sua ideia",+ "newpost.modal.title": "Compartilhe sua ideia...",+ "newpost.modal.title.label": "Dê um título à sua ideia",+ "newpost.modal.title.placeholder": "Algo curto e rápido, resuma em poucas palavras","page.backhome": "Me leve de volta para a página inicial <0>{0}</0>.","page.notinvited.text": "Não encontramos nenhuma conta para o seu endereço de e-mail.","page.notinvited.title": "Sem convite",@@ -182,5 +195,7 @@"signin.message.private.text": "Se você tem uma conta ou um convite, você pode usar as seguintes opções para fazer o login.","signin.message.private.title": "<0>{0}</0> é um espaço privado, você deve se inscrever para participar e votar.","signin.message.socialbutton.intro": "Fazer login com",+ "validation.custom.maxattachments": "São permitidos no máximo {number} anexos.",+ "validation.custom.maximagesize": "O tamanho da imagem deve ser menor que {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/ru/client.json b/locale/ru/client.jsonindex 6412f8bac..95705f6f1 100644--- a/locale/ru/client.json+++ b/locale/ru/client.json@@ -2,12 +2,14 @@"action.cancel": "Отмена","action.change": "изменить","action.close": "Закрыть",+ "action.commentsfeed": "Лента комментариев","action.confirm": "Подтвердить","action.copylink": "Копировать ссылку","action.delete": "Удалить","action.edit": "Изменить","action.markallasread": "Отметить всё как прочитанное","action.ok": "ХОРОШО",+ "action.postsfeed": "Лента сообщений","action.respond": "Ответить","action.save": "Сохранить","action.signin": "Войти",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "с","home.tagsfilter.selected.none": "Любые теги","label.actions": "Действия",+ "label.addtags": "Добавить теги...","label.avatar": "Аватар","label.custom": "Пользовательский","label.description": "Описание",@@ -75,6 +78,7 @@"label.notagsselected": "Теги не выбраны","label.notifications": "Уведомления","label.or": "ИЛИ",+ "label.searchtags": "Поиск тегов...","label.selecttags": "Выберите теги...","label.subscribe": "Подписаться","label.tags": "Теги",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Нет новых уведомлений","modal.notifications.previous": "Предыдущие уведомления","modal.notifications.unread": "Непрочитанные уведомления",+ "modal.rss.description": "Чтобы подписаться на этот канал ATOM, скопируйте и вставьте этот URL-адрес в свой RSS/ATOM-ридер.",+ "modal.rss.title": "Подписаться на ленту ATOM","modal.showvotes.message.zeromatches": "Не удалось найти пользователей с <0>{0}</0>.","modal.showvotes.query.placeholder": "Найдите пользователей по их имени...","modal.signin.header": "Оставьте свой отзыв",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Новые посты","mysettings.notification.event.newpost.staff": "новых постах на этом сайте","mysettings.notification.event.newpost.visitors": "новых постах на этом сайте",+ "mysettings.notification.event.newpostcreated": "Ваша идея добавлена 👍","mysettings.notification.event.statuschanged": "Изменения статуса","mysettings.notification.event.statuschanged.staff": "изменениях статуса всех постов, если вы не отпишитесь от них","mysettings.notification.event.statuschanged.visitors": "изменениях статуса постов, на которые вы подписаны",@@ -145,6 +152,12 @@"mysettings.notification.title": "Выберите события, о которых вы хотите получать уведомления","mysettings.page.subtitle": "Управление настройками вашего профиля","mysettings.page.title": "Настройки",+ "newpost.modal.addimage": "Добавить изображения",+ "newpost.modal.description.placeholder": "Расскажите нам об этом. Объясните подробно, не сдерживайтесь, чем больше информации, тем лучше.",+ "newpost.modal.submit": "Предложите свою идею",+ "newpost.modal.title": "Поделитесь своей идеей...",+ "newpost.modal.title.label": "Дайте название своей идее",+ "newpost.modal.title.placeholder": "Что-то короткое и емкое, изложите это в нескольких словах.","page.backhome": "Верните меня на домашнюю страницу <0>{0}</0>.","page.notinvited.text": "Мы не смогли найти аккаунт, соответствующий этому адресу электронной почты.","page.notinvited.title": "Не приглашён",@@ -182,5 +195,7 @@"signin.message.private.text": "Если у вас есть аккаунт или приглашение, вы можете использовать их для входа.","signin.message.private.title": "<0>{0}</0> является приватным пространством, вы должны войти в систему, чтобы принять участие и проголосовать.","signin.message.socialbutton.intro": "Войти с помощью",+ "validation.custom.maxattachments": "Разрешено максимум {number} вложений.",+ "validation.custom.maximagesize": "Размер изображения должен быть меньше {kilobytes}КБ.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/si-LK/client.json b/locale/si-LK/client.jsonindex 6664ce5f3..d7809ef21 100644--- a/locale/si-LK/client.json+++ b/locale/si-LK/client.json@@ -182,5 +182,20 @@"signin.message.private.title": "<0>{0}</0> යනු පුද්ගලික අවකාශයකි, සහභාගී වී ඡන්දය දීමට ඔබ පුරනය විය යුතුය.","signin.message.socialbutton.intro": "සමඟ ලොග් වන්න","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}",- "labels.notagsselected": "ටැග් කිසිවක් තෝරාගෙන නැත."+ "labels.notagsselected": "ටැග් කිසිවක් තෝරාගෙන නැත.",+ "action.commentsfeed": "අදහස් සංග්රහය",+ "action.postsfeed": "පළ කිරීම් සංග්රහය",+ "label.addtags": "ටැග් එකතු කරන්න...",+ "label.searchtags": "ටැග සොයන්න...",+ "mysettings.notification.event.newpostcreated": "ඔබේ අදහස එකතු කර ඇත 👍",+ "newpost.modal.addimage": "රූප එකතු කරන්න",+ "newpost.modal.description.placeholder": "ඒ ගැන අපට කියන්න. එය සම්පූර්ණයෙන්ම පැහැදිලි කරන්න, පසුබට නොවන්න, වැඩි තොරතුරු ලැබෙන තරමට වඩා හොඳය.",+ "newpost.modal.title": "ඔබේ අදහස බෙදා ගන්න...",+ "newpost.modal.title.label": "ඔබේ අදහසට මාතෘකාවක් දෙන්න.",+ "newpost.modal.title.placeholder": "කෙටි හා වේගවත් දෙයක්, වචන කිහිපයකින් සාරාංශ කරන්න.",+ "newpost.modal.submit": "ඔබේ අදහස ඉදිරිපත් කරන්න.",+ "validation.custom.maxattachments": "උපරිම වශයෙන් ඇමුණුම් {number} ක් සඳහා අවසර ඇත.",+ "validation.custom.maximagesize": "රූපයේ ප්රමාණය {kilobytes}KB ට වඩා කුඩා විය යුතුය.",+ "modal.rss.description": "මෙම ATOM සංග්රහයට දායක වීමට, මෙම URL එක පිටපත් කර ඔබගේ RSS/ATOM කියවනයට අලවන්න.",+ "modal.rss.title": "ATOM සංග්රහයට දායක වන්න"}\ No newline at end of filediff --git a/locale/sk/client.json b/locale/sk/client.jsonindex 7c9f83bcd..7b51921ec 100644--- a/locale/sk/client.json+++ b/locale/sk/client.json@@ -2,12 +2,14 @@"action.cancel": "Zrušiť","action.change": "zmeniť","action.close": "Zavrieť",+ "action.commentsfeed": "Kanál komentárov","action.confirm": "Potvrdiť","action.copylink": "Kopírovať odkaz","action.delete": "Vymazať","action.edit": "Upraviť","action.markallasread": "Označiť všetko ako prečítané","action.ok": "V poriadku",+ "action.postsfeed": "Kanál príspevkov","action.respond": "Odpovedať","action.save": "Uložiť","action.signin": "Prihlásiť sa",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "s","home.tagsfilter.selected.none": "Ľubovoľná značka","label.actions": "Akcie",+ "label.addtags": "Pridať značky...","label.avatar": "Avatar","label.custom": "Vlastné","label.description": "Popis",@@ -75,6 +78,7 @@"label.notagsselected": "Žiadne vybrané značky","label.notifications": "Notifikácie","label.or": "ALEBO",+ "label.searchtags": "Hľadať značky...","label.selecttags": "Vybrať značky...","label.subscribe": "Prihlásiť sa k odberu","label.tags": "Značky",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Žiadne nové oznámenia","modal.notifications.previous": "Predošlé oznámenia","modal.notifications.unread": "Neprečítané oznámenia",+ "modal.rss.description": "Ak sa chcete prihlásiť na odber tohto kanála ATOM, skopírujte a vložte túto URL adresu do čítačky RSS/ATOM.",+ "modal.rss.title": "Prihlásiť sa na odber ATOM kanála","modal.showvotes.message.zeromatches": "Nenašli sa žiadni používatelia <0>{0}</0>.","modal.showvotes.query.placeholder": "Vyhľadajte používateľov podľa mena...","modal.signin.header": "Odoslať spätnú väzbu",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nový príspevok","mysettings.notification.event.newpost.staff": "nové príspevky na tomto webe","mysettings.notification.event.newpost.visitors": "nové príspevky na tomto webe",+ "mysettings.notification.event.newpostcreated": "Váš nápad bol pridaný 👍","mysettings.notification.event.statuschanged": "Stav zmenený","mysettings.notification.event.statuschanged.staff": "zmena stavu všetkých príspevkov, pokiaľ nie sú jednotlivo odhlásené","mysettings.notification.event.statuschanged.visitors": "zmena stavu v príspevkoch, na odber ktorých ste sa prihlásili",@@ -145,6 +152,12 @@"mysettings.notification.title": "Na nasledujúcom paneli vyberte, na ktoré udalosti chcete dostávať upozornenia","mysettings.page.subtitle": "Spravujte nastavenia svojho profilu","mysettings.page.title": "Nastavenie",+ "newpost.modal.addimage": "Pridať obrázky",+ "newpost.modal.description.placeholder": "Povedzte nám o tom. Vysvetlite to podrobne, nezdržujte sa, čím viac informácií, tým lepšie.",+ "newpost.modal.submit": "Odošlite svoj nápad",+ "newpost.modal.title": "Podeľte sa o svoj nápad...",+ "newpost.modal.title.label": "Dajte svojmu nápadu názov",+ "newpost.modal.title.placeholder": "Niečo krátke a výstižné, zhrňte to pár slovami","page.backhome": "Vezmi ma späť do <0>{0}</0> domovskú stránku.","page.notinvited.text": "Nepodarilo sa nám nájsť účet pre vašu emailovú adresu.","page.notinvited.title": "Nepozvaný",@@ -182,5 +195,7 @@"signin.message.private.text": "Ak máte účet alebo pozvánku, na prihlásenie môžete použiť nasledujúce možnosti.","signin.message.private.title": "<0>{0}</0> je súkromný priestor, ak sa chcete zúčastniť diskusie a hlasovať, musíte sa prihlásiť.","signin.message.socialbutton.intro": "Prihlásiť sa pomocou",+ "validation.custom.maxattachments": "Maximálny počet príloh je {number}.",+ "validation.custom.maximagesize": "Veľkosť obrázka musí byť menšia ako {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/locale/sv-SE/client.json b/locale/sv-SE/client.jsonindex a14711d2e..ebdd5a2a9 100644--- a/locale/sv-SE/client.json+++ b/locale/sv-SE/client.json@@ -2,12 +2,14 @@"action.cancel": "Avbryt","action.change": "ändra","action.close": "Stäng",+ "action.commentsfeed": "Kommentarflöde","action.confirm": "Bekräfta","action.copylink": "Kopiera länk","action.delete": "Radera","action.edit": "Ändra","action.markallasread": "Markera alla som lästa","action.ok": "OK",+ "action.postsfeed": "Inläggsflöde","action.respond": "Svara","action.save": "Spara","action.signin": "Logga in",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "med","home.tagsfilter.selected.none": "Alla etiketter","label.actions": "Åtgärder",+ "label.addtags": "Lägg till taggar...","label.avatar": "Profilbild","label.custom": "Anpassad","label.description": "Beskrivning",@@ -75,6 +78,7 @@"label.notagsselected": "Inga taggar valda","label.notifications": "Aviseringar","label.or": "ELLER",+ "label.searchtags": "Sök efter taggar...","label.selecttags": "Välj taggar...","label.subscribe": "Prenumerera","label.tags": "Etiketter",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Inga nya aviseringar","modal.notifications.previous": "Tidigare aviseringar","modal.notifications.unread": "Olästa aviseringar",+ "modal.rss.description": "För att prenumerera på detta ATOM-flöde, kopiera och klistra in den här URL:en i din RSS/ATOM-läsare.",+ "modal.rss.title": "Prenumerera på ATOM-flödet","modal.showvotes.message.zeromatches": "Inga användare hittades som matchar <0>{0}</0>.","modal.showvotes.query.placeholder": "Sök efter användare med namn...","modal.signin.header": "Skicka in din feedback",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Nytt inlägg","mysettings.notification.event.newpost.staff": "nya inlägg på den här webbplatsen","mysettings.notification.event.newpost.visitors": "nya inlägg på den här webbplatsen",+ "mysettings.notification.event.newpostcreated": "Din idé har lagts till 👍","mysettings.notification.event.statuschanged": "Status ändrad","mysettings.notification.event.statuschanged.staff": "statusändring på alla inlägg om inte individuellt avanmäld","mysettings.notification.event.statuschanged.visitors": "statusändring på inlägg som du har prenumererat på",@@ -145,6 +152,12 @@"mysettings.notification.title": "Använd följande panel för att välja vilka händelser du vill få aviseringar om","mysettings.page.subtitle": "Hantera dina profilinställningar","mysettings.page.title": "Inställningar",+ "newpost.modal.addimage": "Lägg till bilder",+ "newpost.modal.description.placeholder": "Berätta om det. Förklara det utförligt, tveka inte, ju mer information desto bättre.",+ "newpost.modal.submit": "Skicka in din idé",+ "newpost.modal.title": "Dela din idé...",+ "newpost.modal.title.label": "Ge din idé en titel",+ "newpost.modal.title.placeholder": "Något kort och rappt, sammanfatta det med några få ord","page.backhome": "Ta mig tillbaka till <0>{0}</0> hemsida.","page.notinvited.text": "Vi kunde inte hitta ett konto för din e-postadress.","page.notinvited.title": "Inte inbjuden",@@ -182,5 +195,7 @@"signin.message.private.text": "Om du har ett konto eller en inbjudan kan du använda följande alternativ för att logga in.","signin.message.private.title": "<0>{0}</0> är ett privat utrymme, du måste logga in för att delta och rösta.","signin.message.socialbutton.intro": "Logga in med",+ "validation.custom.maxattachments": "Maximalt {number} bilagor är tillåtna.",+ "validation.custom.maximagesize": "Bildstorleken måste vara mindre än {kilobytes}KB.","{count, plural, one {# tag} other {# tags}}": "{count, plural, =1 {# etikett} other {# etiketter}}"}\ No newline at end of filediff --git a/locale/tr/client.json b/locale/tr/client.jsonindex c7c9a9be2..a7f8d39e8 100644--- a/locale/tr/client.json+++ b/locale/tr/client.json@@ -2,12 +2,14 @@"action.cancel": "İptal","action.change": "değiştir","action.close": "Kapat",+ "action.commentsfeed": "Yorum Beslemesi","action.confirm": "Onayla","action.copylink": "Bağlantıyı kopyala","action.delete": "Sil","action.edit": "Düzenle","action.markallasread": "Tümünü Okundu olarak işaretle","action.ok": "Tamam",+ "action.postsfeed": "Gönderi Beslemesi","action.respond": "Yanıtla","action.save": "Kaydet","action.signin": "Giriş Yap",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "birlikte","home.tagsfilter.selected.none": "Herhangi bir etiket","label.actions": "İşlemler",+ "label.addtags": "Etiket ekle...","label.avatar": "Avatar","label.custom": "Özel","label.description": "Açıklama",@@ -75,6 +78,7 @@"label.notagsselected": "Hiçbir etiket seçilmedi","label.notifications": "Bildirimler","label.or": "VEYA",+ "label.searchtags": "Etiketleri ara...","label.selecttags": "Etiketleri seçin...","label.subscribe": "Abone ol","label.tags": "Etiketler",@@ -104,6 +108,8 @@"modal.notifications.nonew": "Yeni bildirim yok","modal.notifications.previous": "Önceki bildirimler","modal.notifications.unread": "Okunmamış bildirimler",+ "modal.rss.description": "Bu ATOM akışına abone olmak için bu URL'yi kopyalayıp RSS/ATOM okuyucunuza yapıştırın.",+ "modal.rss.title": "ATOM beslemesine abone olun","modal.showvotes.message.zeromatches": "Eşleşen kullanıcı bulunamadı <0>{0}</0>.","modal.showvotes.query.placeholder": "Kullanıcıları ismiyle arayın...","modal.signin.header": "Geri bildiriminizi gönderin",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "Yeni Öneri","mysettings.notification.event.newpost.staff": "bu sayfaya ait yeni öneriler","mysettings.notification.event.newpost.visitors": "bu sayfaya ait yeni öneriler",+ "mysettings.notification.event.newpostcreated": "Fikriniz eklendi 👍","mysettings.notification.event.statuschanged": "Durum Değişti","mysettings.notification.event.statuschanged.staff": "teker teker iptal edilmedikçe tüm önerilerdeki durum değişiklikleri","mysettings.notification.event.statuschanged.visitors": "abone olduğunuz önerilerdeki durum değişiklikleri",@@ -145,6 +152,12 @@"mysettings.notification.title": "Aşağıdaki panelden hangi olaylar hakkında bildirim almak istediğinizi seçin","mysettings.page.subtitle": "Profil ayarlarınızı yönetin","mysettings.page.title": "Ayarlar",+ "newpost.modal.addimage": "Resim Ekle",+ "newpost.modal.description.placeholder": "Bize anlatın. Tam olarak açıklayın, saklamayın, ne kadar çok bilgi o kadar iyi.",+ "newpost.modal.submit": "Fikrinizi gönderin",+ "newpost.modal.title": "Fikrinizi paylaşın...",+ "newpost.modal.title.label": "Fikrinize bir başlık verin",+ "newpost.modal.title.placeholder": "Kısa ve öz bir şey, birkaç kelimeyle özetleyin","page.backhome": "Beni <0>{0}</0> ana sayfaya götür.","page.notinvited.text": "E-posta adresinizle ilişkili bir hesap bulamadık.","page.notinvited.title": "Davet edilmemiş",@@ -182,5 +195,7 @@"signin.message.private.text": "Eğer bir hesabınız ya da davetiyeniz varsa aşağıdaki seçenekleri kullanarak giriş yapabilirsiniz.","signin.message.private.title": "<0>{0}</0> özel bir alandır ve katılabilmek için davetiye almanız gerekir.","signin.message.socialbutton.intro": "İle giriş yapın",+ "validation.custom.maxattachments": "En fazla {number} ek dosyaya izin verilir.",+ "validation.custom.maximagesize": "Resim boyutu {kilobytes}KB'den küçük olmalıdır.","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# etiket} other {# etiket}}"}\ No newline at end of filediff --git a/locale/zh-CN/client.json b/locale/zh-CN/client.jsonindex 5c6a5b9d8..3e14f306a 100644--- a/locale/zh-CN/client.json+++ b/locale/zh-CN/client.json@@ -2,12 +2,14 @@"action.cancel": "取消","action.change": "修改","action.close": "关闭",+ "action.commentsfeed": "评论提要","action.confirm": "确认","action.copylink": "复制链接","action.delete": "删除","action.edit": "编辑","action.markallasread": "将全部标记为已读","action.ok": "确定",+ "action.postsfeed": "帖子提要","action.respond": "回复/标记","action.save": "保存","action.signin": "登录",@@ -58,6 +60,7 @@"home.tagsfilter.label.with": "关于","home.tagsfilter.selected.none": "任何标签","label.actions": "行动",+ "label.addtags": "添加标签...","label.avatar": "阿凡达","label.custom": "自定义","label.description": "说明",@@ -75,6 +78,7 @@"label.notagsselected": "未选择标签","label.notifications": "通知","label.or": "或者",+ "label.searchtags": "搜索标签...","label.selecttags": "选择标签...","label.subscribe": "订阅","label.tags": "标签",@@ -104,6 +108,8 @@"modal.notifications.nonew": "无新通知","modal.notifications.previous": "以前的通知","modal.notifications.unread": "未读通知",+ "modal.rss.description": "要订阅此 ATOM 源,请将此 URL 复制并粘贴到您的 RSS/ATOM 阅读器中。",+ "modal.rss.title": "订阅 ATOM 源","modal.showvotes.message.zeromatches": "未找到匹配的用户 <0>{0}</0>.","modal.showvotes.query.placeholder": "按名称搜索用户...","modal.signin.header": "提交您的反馈",@@ -135,6 +141,7 @@"mysettings.notification.event.newpost": "新帖子","mysettings.notification.event.newpost.staff": "本网站上的新帖子","mysettings.notification.event.newpost.visitors": "本网站上的新帖子",+ "mysettings.notification.event.newpostcreated": "您的想法已添加👍","mysettings.notification.event.statuschanged": "状态已更改","mysettings.notification.event.statuschanged.staff": "除非单独取消订阅,否则所有帖子的状态都会发生变化","mysettings.notification.event.statuschanged.visitors": "您订阅的帖子的状态更改",@@ -145,6 +152,12 @@"mysettings.notification.title": "使用以下面板选择要接收通知的事件","mysettings.page.subtitle": "管理您的个人资料设置","mysettings.page.title": "设置",+ "newpost.modal.addimage": "添加图像",+ "newpost.modal.description.placeholder": "告诉我们吧。请完整解释,不要隐瞒,信息越多越好。",+ "newpost.modal.submit": "提交您的想法",+ "newpost.modal.title": "分享你的想法...",+ "newpost.modal.title.label": "给你的想法起个标题",+ "newpost.modal.title.placeholder": "简短而活泼,用几句话概括","page.backhome": "带我回到<0>{0}</0>主页.","page.notinvited.text": "我们找不到您电子邮件地址的帐户.","page.notinvited.title": "未被邀请",@@ -182,5 +195,7 @@"signin.message.private.text": "如果您有帐户或邀请,您可以使用以下选项登录.","signin.message.private.title": "<0>{0}</0> 这是一个私人空间,您必须登录才能参与和投票.","signin.message.socialbutton.intro": "使用以下方式登录",+ "validation.custom.maxattachments": "最多允许 {number} 个附件。",+ "validation.custom.maximagesize": "图像大小必须小于{kilobytes}KB。","{count, plural, one {# tag} other {# tags}}": "{count, plural, one {# tag} other {# tags}}"}\ No newline at end of filediff --git a/migrations/202507010800_inline_images.up.sql b/migrations/202507010800_inline_images.up.sqlnew file mode 100644index 000000000..80157d6da--- /dev/null+++ b/migrations/202507010800_inline_images.up.sql@@ -0,0 +1,31 @@+-- Update comments with all attachment images+UPDATE comments+SET content = CASE+ WHEN content IS NULL OR content = '' THEN image_markdown+ ELSE content || E'\n\n' || image_markdown+END+FROM (+ SELECT+ comment_id,+ string_agg('', E'\n') as image_markdown+ FROM attachments+ WHERE comment_id IS NOT NULL+ GROUP BY comment_id+) a+WHERE comments.id = a.comment_id;++-- Update posts with all attachment images+UPDATE posts+SET description = CASE+ WHEN description IS NULL OR description = '' THEN image_markdown+ ELSE description || E'\n\n' || image_markdown+END+FROM (+ SELECT+ post_id,+ string_agg('', E'\n') as image_markdown+ FROM attachments+ WHERE comment_id IS NULL+ GROUP BY post_id+) a+WHERE posts.id = a.post_id;\ No newline at end of filediff --git a/migrations/202507071815_add_post_id_to_mention_notifications.up.sql b/migrations/202507071815_add_post_id_to_mention_notifications.up.sqlnew file mode 100644index 000000000..d60cb96da--- /dev/null+++ b/migrations/202507071815_add_post_id_to_mention_notifications.up.sql@@ -0,0 +1,25 @@+-- Add post_id to mention_notifications table+ALTER TABLE mention_notifications+ADD COLUMN post_id INTEGER;++-- Add foreign key constraint on post_id that allows null values+ALTER TABLE mention_notifications ADD CONSTRAINT mention_notifications_post_id_fkey FOREIGN KEY (post_id) REFERENCES posts (id);++ALTER TABLE mention_notifications+DROP CONSTRAINT IF EXISTS mention_notifications_comment_id_fkey;++ALTER TABLE mention_notifications+DROP CONSTRAINT IF EXISTS unique_mention_notification;++-- Add a new foreign key constraint that allows null values+ALTER TABLE mention_notifications ADD CONSTRAINT mention_notifications_comment_id_fkey FOREIGN KEY (comment_id) REFERENCES comments (id);++-- Update the unique constraint to include post_id+ALTER TABLE mention_notifications+DROP CONSTRAINT IF EXISTS mention_notifications_tenant_id_user_id_comment_id_key;++-- Add a check constraint to ensure at least one of comment_id or post_id is not null+ALTER TABLE mention_notifications ADD CONSTRAINT mention_notifications_comment_or_post_check CHECK (+ (comment_id IS NOT NULL)+ OR (post_id IS NOT NULL)+);\ No newline at end of filediff --git a/migrations/202507091200_add_prevent_indexing.sql b/migrations/202507091200_add_prevent_indexing.sqlnew file mode 100644index 000000000..1975ee833--- /dev/null+++ b/migrations/202507091200_add_prevent_indexing.sql@@ -0,0 +1,14 @@+ALTER TABLE tenants ADD prevent_indexing BOOLEAN NULL;++UPDATE tenants+SET+ prevent_indexing = false;++ALTER TABLE tenants+ALTER COLUMN prevent_indexing+SET+ NOT NULL;++ALTER TABLE tenants+ALTER COLUMN prevent_indexing+SET DEFAULT true;\ No newline at end of filediff --git a/package-lock.json b/package-lock.jsonindex 939a2f323..963f568ab 100644--- a/package-lock.json+++ b/package-lock.json@@ -11,6 +11,7 @@"@lingui/format-json": "^5.1.2","@lingui/react": "^5.1.2","@tiptap/extension-hard-break": "^2.11.5",+ "@tiptap/extension-image": "^2.22.3","@tiptap/extension-mention": "^2.11.5","@tiptap/extension-placeholder": "^2.11.5","@tiptap/pm": "^2.11.5",@@ -4876,6 +4877,19 @@"@tiptap/pm": "^2.7.0"}},+ "node_modules/@tiptap/extension-image": {+ "version": "2.22.3",+ "resolved": "https://registry.npmjs.org/@tiptap/extension-image/-/extension-image-2.22.3.tgz",+ "integrity": "sha512-JO8n5YOqOs+bckPZZ3qJFFLpRbYlu4N52n/7Do0XmxEMWaa3fLcR0Rsa1v3X4dGH2T5cKQ475dWSpJQRc+x07w==",+ "license": "MIT",+ "funding": {+ "type": "github",+ "url": "https://github.com/sponsors/ueberdosis"+ },+ "peerDependencies": {+ "@tiptap/core": "^2.7.0"+ }+ },"node_modules/@tiptap/extension-italic": {"version": "2.11.5","resolved": "https://registry.npmjs.org/@tiptap/extension-italic/-/extension-italic-2.11.5.tgz",diff --git a/package.json b/package.jsonindex 0cf4056ff..a9d0c7d54 100644--- a/package.json+++ b/package.json@@ -7,6 +7,7 @@"@lingui/format-json": "^5.1.2","@lingui/react": "^5.1.2","@tiptap/extension-hard-break": "^2.11.5",+ "@tiptap/extension-image": "^2.22.3","@tiptap/extension-mention": "^2.11.5","@tiptap/extension-placeholder": "^2.11.5","@tiptap/pm": "^2.11.5",diff --git a/public/assets/images/heroicons-arrowleft.svg b/public/assets/images/heroicons-arrowleft.svgnew file mode 100644index 000000000..738666894--- /dev/null+++ b/public/assets/images/heroicons-arrowleft.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="M8.25 9V5.25A2.25 2.25 0 0 1 10.5 3h6a2.25 2.25 0 0 1 2.25 2.25v13.5A2.25 2.25 0 0 1 16.5 21h-6a2.25 2.25 0 0 1-2.25-2.25V15m-3 0-3-3m0 0 3-3m-3 3H15" />+</svg>diff --git a/public/assets/images/heroicons-clipboard.svg b/public/assets/images/heroicons-clipboard.svgnew file mode 100644index 000000000..224ad7344--- /dev/null+++ b/public/assets/images/heroicons-clipboard.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="M15.666 3.888A2.25 2.25 0 0 0 13.5 2.25h-3c-1.03 0-1.9.693-2.166 1.638m7.332 0c.055.194.084.4.084.612v0a.75.75 0 0 1-.75.75H9a.75.75 0 0 1-.75-.75v0c0-.212.03-.418.084-.612m7.332 0c.646.049 1.288.11 1.927.184 1.1.128 1.907 1.077 1.907 2.185V19.5a2.25 2.25 0 0 1-2.25 2.25H6.75A2.25 2.25 0 0 1 4.5 19.5V6.257c0-1.108.806-2.057 1.907-2.185a48.208 48.208 0 0 1 1.927-.184" />+</svg>diff --git a/public/assets/images/heroicons-clock.svg b/public/assets/images/heroicons-clock.svgnew file mode 100644index 000000000..d9fcd01a8--- /dev/null+++ b/public/assets/images/heroicons-clock.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z" />+</svg>diff --git a/public/assets/images/heroicons-eyeslash.svg b/public/assets/images/heroicons-eyeslash.svgnew file mode 100644index 000000000..dcfb31ee9--- /dev/null+++ b/public/assets/images/heroicons-eyeslash.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="M3.98 8.223A10.477 10.477 0 0 0 1.934 12C3.226 16.338 7.244 19.5 12 19.5c.993 0 1.953-.138 2.863-.395M6.228 6.228A10.451 10.451 0 0 1 12 4.5c4.756 0 8.773 3.162 10.065 7.498a10.522 10.522 0 0 1-4.293 5.774M6.228 6.228 3 3m3.228 3.228 3.65 3.65m7.894 7.894L21 21m-3.228-3.228-3.65-3.65m0 0a3 3 0 1 0-4.243-4.243m4.242 4.242L9.88 9.88" />+</svg>diff --git a/public/assets/images/heroicons-paperclip.svg b/public/assets/images/heroicons-paperclip.svgnew file mode 100644index 000000000..81fdd54d6--- /dev/null+++ b/public/assets/images/heroicons-paperclip.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="m18.375 12.739-7.693 7.693a4.5 4.5 0 0 1-6.364-6.364l10.94-10.94A3 3 0 1 1 19.5 7.372L8.552 18.32m.009-.01-.01.01m5.699-9.941-7.81 7.81a1.5 1.5 0 0 0 2.112 2.13" />+</svg>diff --git a/public/assets/images/heroicons-tagsolid.svg b/public/assets/images/heroicons-tagsolid.svgnew file mode 100644index 000000000..d23f2e8bf--- /dev/null+++ b/public/assets/images/heroicons-tagsolid.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="currentColor" class="size-6">+ <path fill-rule="evenodd" d="M5.25 2.25a3 3 0 0 0-3 3v4.318a3 3 0 0 0 .879 2.121l9.58 9.581c.92.92 2.39 1.186 3.548.428a18.849 18.849 0 0 0 5.441-5.44c.758-1.16.492-2.629-.428-3.548l-9.58-9.581a3 3 0 0 0-2.122-.879H5.25ZM6.375 7.5a1.125 1.125 0 1 0 0-2.25 1.125 1.125 0 0 0 0 2.25Z" clip-rule="evenodd" />+</svg>diff --git a/public/assets/images/heroicons-wrenchscrewdriver.svg b/public/assets/images/heroicons-wrenchscrewdriver.svgnew file mode 100644index 000000000..babaa2486--- /dev/null+++ b/public/assets/images/heroicons-wrenchscrewdriver.svg@@ -0,0 +1,3 @@+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor" class="size-6">+ <path stroke-linecap="round" stroke-linejoin="round" d="M11.42 15.17 17.25 21A2.652 2.652 0 0 0 21 17.25l-5.877-5.877M11.42 15.17l2.496-3.03c.317-.384.74-.626 1.208-.766M11.42 15.17l-4.655 5.653a2.548 2.548 0 1 1-3.586-3.586l6.837-5.63m5.108-.233c.55-.164 1.163-.188 1.743-.14a4.5 4.5 0 0 0 4.486-6.336l-3.276 3.277a3.004 3.004 0 0 1-2.25-2.25l3.276-3.276a4.5 4.5 0 0 0-6.336 4.486c.091 1.076-.071 2.264-.904 2.95l-.102.085m-1.745 1.437L5.909 7.5H4.5L2.25 3.75l1.5-1.5L7.5 4.5v1.409l4.26 4.26m-1.745 1.437 1.745-1.437m6.615 8.206L15.75 15.75M4.867 19.125h.008v.008h-.008v-.008Z" />+</svg>diff --git a/public/assets/images/undraw_mail-sent.svg b/public/assets/images/undraw_mail-sent.svgnew file mode 100644index 000000000..a9aed49ca--- /dev/null+++ b/public/assets/images/undraw_mail-sent.svg@@ -0,0 +1 @@+<svg xmlns="http://www.w3.org/2000/svg" width="570" height="511.67482" viewBox="0 0 570 511.67482" xmlns:xlink="http://www.w3.org/1999/xlink" role="img" artist="Katerina Limpitsouni" source="https://undraw.co/"><path d="M879.99927,389.83741a.99678.99678,0,0,1-.5708-.1792L602.86963,197.05469a5.01548,5.01548,0,0,0-5.72852.00977L322.57434,389.65626a1.00019,1.00019,0,0,1-1.14868-1.6377l274.567-192.5918a7.02216,7.02216,0,0,1,8.02-.01318l276.55883,192.603a1.00019,1.00019,0,0,1-.57226,1.8208Z" transform="translate(-315 -194.16259)" fill="#3f3d56"/><polygon points="23.264 202.502 285.276 8.319 549.276 216.319 298.776 364.819 162.776 333.819 23.264 202.502" fill="#e6e6e6"/><path d="M489.25553,650.70367H359.81522a6.04737,6.04737,0,1,1,0-12.09473H489.25553a6.04737,6.04737,0,1,1,0,12.09473Z" transform="translate(-315 -194.16259)" fill="#6c63ff"/><path d="M406.25553,624.70367H359.81522a6.04737,6.04737,0,1,1,0-12.09473h46.44031a6.04737,6.04737,0,1,1,0,12.09473Z" transform="translate(-315 -194.16259)" fill="#6c63ff"/><path d="M603.96016,504.82207a7.56366,7.56366,0,0,1-2.86914-.562L439.5002,437.21123v-209.874a7.00817,7.00817,0,0,1,7-7h310a7.00818,7.00818,0,0,1,7,7v210.0205l-.30371.12989L606.91622,504.22734A7.61624,7.61624,0,0,1,603.96016,504.82207Z" transform="translate(-315 -194.16259)" fill="#fff"/><path d="M603.96016,505.32158a8.07177,8.07177,0,0,1-3.05957-.59863L439.0002,437.54521v-210.208a7.50851,7.50851,0,0,1,7.5-7.5h310a7.50851,7.50851,0,0,1,7.5,7.5V437.68779l-156.8877,66.999A8.10957,8.10957,0,0,1,603.96016,505.32158Zm-162.96-69.1123,160.66309,66.66455a6.1182,6.1182,0,0,0,4.668-.02784l155.669-66.47851V227.33721a5.50653,5.50653,0,0,0-5.5-5.5h-310a5.50653,5.50653,0,0,0-5.5,5.5Z" transform="translate(-315 -194.16259)" fill="#3f3d56"/><path d="M878,387.83741h-.2002L763,436.85743l-157.06982,67.07a5.06614,5.06614,0,0,1-3.88038.02L440,436.71741l-117.62012-48.8-.17968-.08H322a7.00778,7.00778,0,0,0-7,7v304a7.00779,7.00779,0,0,0,7,7H878a7.00779,7.00779,0,0,0,7-7v-304A7.00778,7.00778,0,0,0,878,387.83741Zm5,311a5.002,5.002,0,0,1-5,5H322a5.002,5.002,0,0,1-5-5v-304a5.01106,5.01106,0,0,1,4.81006-5L440,438.87739l161.28027,66.92a7.12081,7.12081,0,0,0,5.43994-.03L763,439.02741l115.2002-49.19a5.01621,5.01621,0,0,1,4.7998,5Z" transform="translate(-315 -194.16259)" fill="#3f3d56"/><path d="M602.345,445.30958a27.49862,27.49862,0,0,1-16.5459-5.4961l-.2959-.22217-62.311-47.70752a27.68337,27.68337,0,1,1,33.67407-43.94921l40.36035,30.94775,95.37793-124.38672a27.68235,27.68235,0,0,1,38.81323-5.12353l-.593.80517.6084-.79346a27.71447,27.71447,0,0,1,5.12353,38.81348L624.36938,434.50586A27.69447,27.69447,0,0,1,602.345,445.30958Z" transform="translate(-315 -194.16259)" fill="#6c63ff"/></svg>\ No newline at end of filediff --git a/public/assets/styles/utility/display.scss b/public/assets/styles/utility/display.scssindex a26926548..1d439a456 100644--- a/public/assets/styles/utility/display.scss+++ b/public/assets/styles/utility/display.scss@@ -94,6 +94,10 @@flex-wrap: wrap;}+.align-self-end {+ align-self: end;+}+.align-self-start {align-self: start;}@@ -130,6 +134,10 @@justify-content: center;}+.justify-end {+ justify-content: end;+}+.justify-full > * {flex: 1 1 0;}diff --git a/public/components/Header.tsx b/public/components/Header.tsxindex 37d4c0020..4629bf58c 100644--- a/public/components/Header.tsx+++ b/public/components/Header.tsx@@ -1,24 +1,34 @@import React, { useState } from "react"-import { SignInModal, TenantLogo, NotificationIndicator, UserMenu, ThemeSwitcher, Icon } from "@fider/components"+import { SignInModal, RSSModal, TenantLogo, NotificationIndicator, UserMenu, ThemeSwitcher, Icon } from "@fider/components"import { useFider } from "@fider/hooks"import { HStack } from "./layout"import { Trans } from "@lingui/react/macro"+import { i18n } from "@lingui/core"import IconRss from "@fider/assets/images/heroicons-rss.svg"export const Header = () => {const fider = useFider()const [isSignInModalOpen, setIsSignInModalOpen] = useState(false)+ const [isRSSModalOpen, setIsRSSModalOpen] = useState(false)- const showModal = (e: React.MouseEvent) => {+ const showSignInModal = (e: React.MouseEvent) => {e.preventDefault()setIsSignInModalOpen(true)}- const hideModal = () => setIsSignInModalOpen(false)+ const showRSSModal = (e: React.MouseEvent) => {+ e.preventDefault()+ setIsRSSModalOpen(true)+ }++ const atomFeedTitle = i18n._({ id: "action.postsfeed", message: "Posts Feed" })+ const hideSignInModal = () => setIsSignInModalOpen(false)+ const hideRSSModal = () => setIsRSSModalOpen(false)return (<div id="c-header" className="bg-white">- <SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />+ <SignInModal isOpen={isSignInModalOpen} onClose={hideSignInModal} />+ <RSSModal isOpen={isRSSModalOpen} onClose={hideRSSModal} url={`${fider.settings.baseURL}/feed/global.atom`} /><HStack className="c-menu shadow p-4 w-full"><div className="container"><HStack justify="between">@@ -29,9 +39,9 @@ export const Header = () => {{fider.session.isAuthenticated && (<HStack spacing={2}>{fider.session.tenant.isFeedEnabled && (- <a title="ATOM Feed (All Posts)" type="application/atom+xml" className="c-themeswitcher" href="/feed/global.atom">- <Icon sprite={IconRss} className="h-6" />- </a>+ <button title={atomFeedTitle} className="c-themeswitcher" onClick={showRSSModal}>+ <Icon sprite={IconRss} className="h-6 text-gray-500" />+ </button>)}<ThemeSwitcher /><NotificationIndicator />@@ -41,12 +51,12 @@ export const Header = () => {{!fider.session.isAuthenticated && (<HStack spacing={2}>{fider.session.tenant.isFeedEnabled && (- <a title="ATOM Feed (All Posts)" type="application/atom+xml" className="c-themeswitcher" href="/feed/global.atom">- <Icon sprite={IconRss} className="h-6" />- </a>+ <button title={atomFeedTitle} className="c-themeswitcher" onClick={showRSSModal}>+ <Icon sprite={IconRss} className="h-6 text-gray-500" />+ </button>)}<ThemeSwitcher />- <a href="#" className="uppercase text-sm" onClick={showModal}>+ <a href="#" className="uppercase text-sm" onClick={showSignInModal}><Trans id="action.signin">Sign in</Trans></a></HStack>diff --git a/public/components/RSSModal.tsx b/public/components/RSSModal.tsxnew file mode 100644index 000000000..365a009a8--- /dev/null+++ b/public/components/RSSModal.tsx@@ -0,0 +1,60 @@+import React from "react"+import { Modal, Button, CloseIcon, Icon } from "@fider/components"+import { Trans } from "@lingui/react/macro"+import { HStack, VStack } from "./layout"+import IconRss from "@fider/assets/images/heroicons-rss.svg"+import IconClipboard from "@fider/assets/images/heroicons-clipboard.svg"++interface RSSModalProps {+ isOpen: boolean+ onClose: () => void+ url: string+}++export const RSSModal: React.FC<RSSModalProps> = (props) => {+ const copyToClipboard = async () => {+ try {+ await navigator.clipboard.writeText(props.url)+ } catch (err) {+ // Fallback for older browsers+ const textArea = document.createElement("textarea")+ textArea.value = props.url+ document.body.appendChild(textArea)+ textArea.focus()+ textArea.select()+ document.execCommand("copy")+ document.body.removeChild(textArea)+ }+ }++ return (+ <Modal.Window isOpen={props.isOpen} onClose={props.onClose} size="small">+ <Modal.Header>+ <HStack justify="between">+ <HStack spacing={2}>+ <Icon sprite={IconRss} className="h-6 text-orange-500" />+ <h3 className="text-lg font-medium">+ <Trans id="modal.rss.title">Subscribe to ATOM feed</Trans>+ </h3>+ </HStack>+ <CloseIcon closeModal={props.onClose} />+ </HStack>+ </Modal.Header>+ <Modal.Content>+ <VStack spacing={2}>+ <p className="text-sm">+ <Trans id="modal.rss.description">To subscribe to this ATOM feed, copy and paste this URL into your RSS/ATOM reader.</Trans>+ </p>+ <div className="bg-gray-200 px-1 py-2 rounded border">+ <div className="flex items-center justify-between text-left">+ <p className="px-2 text-xs text-gray-800 mr-2 nowrap mb-0">{props.url}</p>+ <Button style={{ padding: "0 4px" }} className="text-center hover" variant="tertiary" onClick={copyToClipboard}>+ <Icon height="18" width="18" sprite={IconClipboard} />+ </Button>+ </div>+ </div>+ </VStack>+ </Modal.Content>+ </Modal.Window>+ )+}diff --git a/public/components/ShowPostResponse.tsx b/public/components/ShowPostResponse.tsxindex b3804099e..b9706ca95 100644--- a/public/components/ShowPostResponse.tsx+++ b/public/components/ShowPostResponse.tsx@@ -10,10 +10,12 @@ import HeroIconThumbsDown from "@fider/assets/images/heroicons-thumbsdown.svg"import { HStack, VStack } from "./layout"import { timeSince } from "@fider/services"+type Size = "micro" | "small" | "normal"+interface PostResponseProps {status: stringresponse: PostResponse | null- small?: boolean+ size?: Size}export const ResponseDetails = (props: PostResponseProps): JSX.Element | null => {@@ -65,11 +67,15 @@ export const ResponseLozenge = (props: PostResponseProps): JSX.Element | null =>const status = PostStatus.Get(props.status)const { icon, bg, color, border } = getLozengeProps(status)+ if (props.size == "micro") {+ return <span className={`${color} text-sm`}>{status.title}</span>+ }+return (<div><HStack align="start" className={`${color} ${bg} border ${border} rounded-full p-1 px-3`}>- {!props.small && <Icon sprite={icon} className={`h-5 c-status-col--${status.value}`} />}- <span className={`c-status-col--${status.value} ${props.small ? "text-sm" : "text-semibold"}`}>{status.title}</span>+ {!props.size && <Icon sprite={icon} className={`h-5 c-status-col--${status.value}`} />}+ <span className={`c-status-col--${status.value} ${props.size === "small" ? "text-sm" : "text-semibold"}`}>{status.title}</span></HStack></div>)diff --git a/public/components/ShowTag.tsx b/public/components/ShowTag.tsxindex fa3b6f116..63174ffc4 100644--- a/public/components/ShowTag.tsx+++ b/public/components/ShowTag.tsx@@ -3,7 +3,8 @@ import "./ShowTag.scss"import React, { MouseEvent } from "react"import { Tag } from "@fider/models"import { classSet } from "@fider/services"-import ShieldCheck from "@fider/assets/images/heroicons-shieldcheck.svg"+import EyeSlash from "@fider/assets/images/heroicons-eyeslash.svg"+import TagSolid from "@fider/assets/images/heroicons-tagsolid.svg"import { Icon } from "./common"interface TagProps {@@ -38,12 +39,8 @@ export const ShowTag = (props: TagProps) => {className={className}onClick={clickHandler}>- <span- style={{- backgroundColor: `#${props.tag.color}`,- }}- ></span>- {!props.tag.isPublic && !props.circular && <Icon height="14" width="14" sprite={ShieldCheck} className="mr-1" />}+ <Icon style={{ color: `#${props.tag.color}` }} className="pr-1" height="18" width="18" sprite={TagSolid}></Icon>+ {!props.tag.isPublic && !props.circular && <Icon height="14" width="14" sprite={EyeSlash} className="mr-1" />}{props.circular ? "" : props.tag.name || "Tag"}</a>)diff --git a/public/components/SignInModal.tsx b/public/components/SignInModal.tsxindex b160517ce..137f6c39a 100644--- a/public/components/SignInModal.tsx+++ b/public/components/SignInModal.tsx@@ -53,7 +53,7 @@ export const SignInModal: React.FC<SignInModalProps> = (props) => {<CloseIcon closeModal={closeModal} /></HStack><p>- <Trans id="modal.signin.header">Submit your feedback</Trans>+ <Trans id="modal.signin.header">Join the conversation</Trans></p></VStack></Modal.Header>diff --git a/public/components/ThemeSwitcher.tsx b/public/components/ThemeSwitcher.tsxindex 3903deba3..662cf9131 100644--- a/public/components/ThemeSwitcher.tsx+++ b/public/components/ThemeSwitcher.tsx@@ -21,7 +21,7 @@ export const ThemeSwitcher = () => {document.body.setAttribute("data-theme", currentTheme)}, [currentTheme])- const icon = currentTheme === "light" ? <Icon sprite={IconMoon} className="h-6" /> : <Icon sprite={IconSun} className="h-6" />+ const icon = currentTheme === "light" ? <Icon sprite={IconMoon} className="h-6 text-gray-500" /> : <Icon sprite={IconSun} className="h-6 text-gray-500" />return (<button onClick={toggleTheme} aria-label="Toggle theme" className="c-themeswitcher">diff --git a/public/components/UserMenu.tsx b/public/components/UserMenu.tsxindex f791fdf7e..18979b662 100644--- a/public/components/UserMenu.tsx+++ b/public/components/UserMenu.tsx@@ -2,6 +2,9 @@ import React from "react"import { useFider } from "@fider/hooks"import { Avatar, Dropdown } from "./common"import { Trans } from "@lingui/react/macro"+import IconCog from "@fider/assets/images/heroicons-cog.svg"+import IconWrench from "@fider/assets/images/heroicons-wrenchscrewdriver.svg"+import IconLeft from "@fider/assets/images/heroicons-arrowleft.svg"export const UserMenu = () => {const fider = useFider()@@ -10,7 +13,7 @@ export const UserMenu = () => {<div className="c-menu-user"><Dropdown position="left" renderHandle={<Avatar user={fider.session.user} />}><div className="p-2 text-medium uppercase">{fider.session.user.name}</div>- <Dropdown.ListItem href="/settings">+ <Dropdown.ListItem href="/settings" icon={IconCog}><Trans id="menu.mysettings">My Settings</Trans></Dropdown.ListItem><Dropdown.Divider />@@ -20,13 +23,13 @@ export const UserMenu = () => {<div className="p-2 text-medium uppercase"><Trans id="menu.administration">Administration</Trans></div>- <Dropdown.ListItem href="/admin">+ <Dropdown.ListItem href="/admin" icon={IconWrench}><Trans id="menu.sitesettings">Site Settings</Trans></Dropdown.ListItem><Dropdown.Divider /></>)}- <Dropdown.ListItem href="/signout">+ <Dropdown.ListItem href="/signout" icon={IconLeft}><Trans id="menu.signout">Sign out</Trans></Dropdown.ListItem></Dropdown>diff --git a/public/components/VoteCounter2.tsx b/public/components/VoteCounter2.tsxdeleted file mode 100644index a12f428ea..000000000--- a/public/components/VoteCounter2.tsx+++ /dev/null@@ -1,63 +0,0 @@-import "./VoteCounter.scss"--import React, { useState } from "react"-import { PostStatus } from "@fider/models"-import { actions, classSet } from "@fider/services"-import { Icon, SignInModal } from "@fider/components"-import { useFider } from "@fider/hooks"-import FaCaretUp from "@fider/assets/images/fa-caretup.svg"-import { VoteCounterProps } from "@fider/components"--export const VoteCounter2 = (props: VoteCounterProps) => {- const fider = useFider()- const [hasVoted, setHasVoted] = useState(props.post.hasVoted)- const [votesCount, setVotesCount] = useState(props.post.votesCount)- const [isSignInModalOpen, setIsSignInModalOpen] = useState(false)-- const voteOrUndo = async () => {- if (!fider.session.isAuthenticated) {- setIsSignInModalOpen(true)- return- }-- const action = hasVoted ? actions.removeVote : actions.addVote-- const response = await action(props.post.number)- if (response.ok) {- setVotesCount(votesCount + (hasVoted ? -1 : 1))- setHasVoted(!hasVoted)- }- }-- const hideModal = () => setIsSignInModalOpen(false)-- const status = PostStatus.Get(props.post.status)- const isDisabled = status.closed || fider.isReadOnly-- const className = classSet({- "c-vote-counter__button": true,- "c-vote-counter__button--voted": !status.closed && hasVoted,- "c-vote-counter__button--disabled": isDisabled,- })-- const vote = (- <button className={className} onClick={voteOrUndo}>- <Icon sprite={FaCaretUp} height="16" width="16" />- {votesCount}- </button>- )-- const disabled = (- <button className={className}>- <Icon sprite={FaCaretUp} height="16" width="16" />- {votesCount}- </button>- )-- return (- <>- <SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />- <div className="c-vote-counter">{isDisabled ? disabled : vote}</div>- </>- )-}diff --git a/public/components/common/Dropdown.scss b/public/components/common/Dropdown.scssindex e7b09efb8..6c8c7550c 100644--- a/public/components/common/Dropdown.scss+++ b/public/components/common/Dropdown.scss@@ -46,7 +46,8 @@}&__listitem {- display: block;+ display: flex;+ align-items: center;padding: spacing(2);&:hover {cursor: pointer;diff --git a/public/components/common/Dropdown.tsx b/public/components/common/Dropdown.tsxindex 1f9e5b5ac..10cd86d37 100644--- a/public/components/common/Dropdown.tsx+++ b/public/components/common/Dropdown.tsx@@ -2,12 +2,15 @@ import "./Dropdown.scss"import React, { createContext, useContext, useEffect, useRef, useState } from "react"import { classSet } from "@fider/services"+import { Icon } from "@fider/components/common/Icon"interface DropdownListItemProps {href?: string+ type?: stringonClick?: () => voidclassName?: stringchildren: React.ReactNode+ icon?: SpriteSymbol}const ListItem = (props: DropdownListItemProps) => {@@ -22,7 +25,8 @@ const ListItem = (props: DropdownListItemProps) => {if (props.href) {return (- <a href={props.href} className={`c-dropdown__listitem ${props.className}`}>+ <a href={props.href} className={`c-dropdown__listitem ${props.className}`} type={props.type || "button"}>+ {props.icon && <Icon sprite={props.icon} className="mr-2" width="16" height="16" />}{props.children}</a>)@@ -30,6 +34,7 @@ const ListItem = (props: DropdownListItemProps) => {return (<div onClick={handleClick} className={`c-dropdown__listitem ${props.className}`}>+ {props.icon && <Icon sprite={props.icon} className="mr-2" width="16" height="16" />}{props.children}</div>)diff --git a/public/components/common/Icon.tsx b/public/components/common/Icon.tsxindex d949c7477..31fafe9f1 100644--- a/public/components/common/Icon.tsx+++ b/public/components/common/Icon.tsx@@ -6,8 +6,8 @@ interface IconProps {width?: stringclassName?: stringonClick?: () => void+ style?: React.CSSProperties}-export const Icon = (props: IconProps) => {if (typeof props.sprite === "string") {const styles = { height: props.height && `${props.height}px`, width: props.width && `${props.width}px` }@@ -15,7 +15,7 @@ export const Icon = (props: IconProps) => {}return (- <svg onClick={props.onClick} height={props.height} width={props.width} className={props.className} viewBox={props.sprite.viewBox}>+ <svg style={props.style} onClick={props.onClick} height={props.height} width={props.width} className={props.className} viewBox={props.sprite.viewBox}><use xlinkHref={"#" + props.sprite.id} /></svg>)diff --git a/public/components/common/Markdown.scss b/public/components/common/Markdown.scssindex 7f1d823ac..1f71c2d66 100644--- a/public/components/common/Markdown.scss+++ b/public/components/common/Markdown.scss@@ -18,10 +18,16 @@h2 {font-size: get("font.size.xl");+ margin: 0 0 14px;}h3 {font-size: get("font.size.lg");+ margin: 0 0 14px;+ }++ li {+ line-height: 1.4;}ul,@@ -40,6 +46,9 @@img {max-width: 100%;+ height: auto;+ object-fit: contain;+ display: block;}pre {diff --git a/public/components/common/Modal.scss b/public/components/common/Modal.scssindex 13143bd17..0d9ad1a9c 100644--- a/public/components/common/Modal.scss+++ b/public/components/common/Modal.scss@@ -73,6 +73,25 @@ $c-modal-dimmer-padding: 1em;}}+ &--fullscreen {+ position: absolute;+ top: 0;+ left: 0;+ right: 0;+ bottom: 0;+ border-radius: 0;+ animation: fullscreenFadeIn 0.3s ease-out;+ }++ @keyframes fullscreenFadeIn {+ from {+ opacity: 0;+ }+ to {+ opacity: 1;+ }+ }+&--center {text-align: center;}diff --git a/public/components/common/Modal.tsx b/public/components/common/Modal.tsxindex c149b4359..bb84e1148 100644--- a/public/components/common/Modal.tsx+++ b/public/components/common/Modal.tsx@@ -10,7 +10,7 @@ interface ModalWindowProps {children?: React.ReactNodeclassName?: stringisOpen: boolean- size?: "small" | "large" | "fluid"+ size?: "small" | "large" | "fluid" | "fullscreen"canClose?: booleancenter?: booleanonClose: () => voiddiff --git a/public/components/common/SignInControl.tsx b/public/components/common/SignInControl.tsxindex 058a62a0e..6044e8c4e 100644--- a/public/components/common/SignInControl.tsx+++ b/public/components/common/SignInControl.tsx@@ -11,7 +11,9 @@ import { i18n } from "@lingui/core"interface SignInControlProps {useEmail: booleanredirectTo?: string+ onSubmit?: () => voidonEmailSent?: (email: string) => void+ signInButtonText?: string}export const SignInControl: React.FunctionComponent<SignInControlProps> = (props) => {@@ -20,12 +22,25 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (propsconst [email, setEmail] = useState("")const [error, setError] = useState<Failure | undefined>(undefined)+ const signInText = props.signInButtonText || i18n._({ id: "action.signin", message: "Sign in" })+const forceShowEmailForm = (e: React.MouseEvent<HTMLAnchorElement>) => {e.preventDefault()setShowEmailForm(true)}+ const doPreSigninAction = () => {+ if (props.onSubmit) {+ props.onSubmit()+ }+ }++ const onSocialSignin = () => {+ doPreSigninAction()+ }+const signIn = async () => {+ await doPreSigninAction()const result = await actions.signIn(email)if (result.ok) {setEmail("")@@ -56,7 +71,7 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (props<div className="c-signin-control__oauth pb-3">{fider.settings.oauth.map((o) => (<React.Fragment key={o.provider}>- <SocialSignInButton option={o} redirectTo={props.redirectTo} />+ <SocialSignInButton onClick={onSocialSignin} option={o} redirectTo={props.redirectTo} /></React.Fragment>))}</div>@@ -74,10 +89,10 @@ export const SignInControl: React.FunctionComponent<SignInControlProps> = (propsvalue={email}autoFocus={!device.isTouch()}onChange={setEmail}- placeholder={i18n._("signin.email.placeholder", { message: "Email address" })}+ placeholder={i18n._({ id: "signin.email.placeholder", message: "Email address" })}/><Button className="w-full justify-center" type="submit" variant="primary" disabled={email === ""} onClick={signIn}>- <Trans id="action.signin">Sign in</Trans>+ {signInText}</Button></Form>{!fider.session.tenant.isEmailAuthAllowed && (diff --git a/public/components/common/SocialSignInButton.tsx b/public/components/common/SocialSignInButton.tsxindex 8468eb6a3..d38511036 100644--- a/public/components/common/SocialSignInButton.tsx+++ b/public/components/common/SocialSignInButton.tsx@@ -12,17 +12,27 @@ interface SocialSignInButtonProps {}className?: stringredirectTo?: string+ onClick?: () => void}export const SocialSignInButton = (props: SocialSignInButtonProps) => {const redirectTo = props.redirectTo || window.location.href- const href = props.option.url ? `${props.option.url}?redirect=${redirectTo}` : undefined+ const href = props.option.url ? `${props.option.url}?redirect=${redirectTo}` : ""++ const handleClick = async (e: React.MouseEvent<HTMLAnchorElement>) => {+ // If there is an onClick then let that run and check it finishes OK before doing the oauth.+ if (props.onClick) {+ e.preventDefault()+ props.onClick()+ window.location.href = href+ }+ }return (- <a rel="nofollow" className="c-signin-social-button" href={href}>+ <a rel="nofollow" className="c-signin-social-button" href={href} onClick={handleClick}>{props.option.logoURL ? <img alt={props.option.displayName} src={props.option.logoURL} /> : <OAuthProviderLogo option={props.option} />}<span>- <Trans id="signin.message.socialbutton.intro">Sign in with</Trans>+ <Trans id="signin.message.socialbutton.intro">Continue with</Trans> {props.option.displayName}</span>diff --git a/public/components/common/TagsSelect.scss b/public/components/common/TagsSelect.scssindex dda71d947..5e102d707 100644--- a/public/components/common/TagsSelect.scss+++ b/public/components/common/TagsSelect.scss@@ -1,30 +1,34 @@@use "~@fider/assets/styles/variables.scss" as *;-.dropdown-wrapper {+.c-tags-select__container {position: relative;width: 100%;}-.tags-list {+.c-tags-select__list {display: flex;flex-wrap: wrap;gap: 0.5rem;+ align-items: center;+ min-height: 40px;+ width: 100%;+ padding: 0 spacing(1);}-.selected-options-container {+.c-tags-select__selected-container {display: flex;flex-wrap: wrap;align-items: center;- min-height: 3rem;+ min-height: 40px;width: 100%;- padding: 0.5rem;- border: 1px solid var(--colors-gray-500);- border-radius: get("border.radius.small");+ padding: 0 spacing(1);+ border: 1px solid var(--colors-gray-300);+ border-radius: get("border.radius.medium");background-color: var(--colors-white);color: var(--colors-gray-900);}-.selected-option {+.c-tags-select__selected-item {display: flex;align-items: center;margin: 0.25rem;@@ -33,7 +37,7 @@color: var(--colors-gray-900);}-.remove-button {+.c-tags-select__remove-button {margin: 0 0.25rem;color: var(--colors-gray-600);background: none;@@ -44,11 +48,11 @@padding: 0 0.25rem;}-.remove-button:hover {+.c-tags-select__remove-button:hover {color: var(--colors-red-500);}-.options-container {+.c-tags-select__options {position: absolute;z-index: 10;width: 100%;@@ -60,21 +64,21 @@overflow-y: auto;}-.search-input {+.c-tags-select__search-input {margin: spacing(2);width: calc(100% - spacing(4));}-.option-item {+.c-tags-select__option {padding: spacing(2);cursor: pointer;}-.option-item:hover {+.c-tags-select__option:hover {background-color: var(--colors-gray-100);}-.no-options {+.c-tags-select__no-options {padding: 0.5rem;color: var(--colors-gray-900);}diff --git a/public/components/common/TagsSelect.tsx b/public/components/common/TagsSelect.tsxindex 8ccc0bbd6..ff577fb9b 100644--- a/public/components/common/TagsSelect.tsx+++ b/public/components/common/TagsSelect.tsx@@ -16,6 +16,8 @@ export interface TagsSelectProps {selectionChanged: (selected: Tag[]) => voidcanEdit: booleanasLinks?: boolean+ // If true, you always see the tags edit box, rather than having to put the tags list into "edit mode"+ alwaysEditing?: boolean}export const TagsSelect = (props: TagsSelectProps) => {@@ -101,31 +103,34 @@ export const TagsSelect = (props: TagsSelectProps) => {return null}- const tagsList = (- <div className="tags-list">- {props.selected.length > 0 && sortTags(props.selected).map((tag) => <ShowTag key={tag.id} tag={tag} link={props.asLinks} />)}- {props.canEdit && (- <Button variant={"link"} size={"no-padding"} onClick={onSubtitleClick}>- <Trans id="label.edittags">Edit tags</Trans>- </Button>- )}+ const viewModeTagsList = (+ <div className="c-tags-select__container">+ <div className="c-tags-select__list">+ {props.selected.length > 0 && sortTags(props.selected).map((tag) => <ShowTag key={tag.id} tag={tag} link={props.asLinks} />)}+ {props.canEdit && (+ <div>+ <Button variant={"link"} size={"no-padding"} onClick={onSubtitleClick}>+ {props.selected.length ? <Trans id="label.edittags">Edit tags</Trans> : <Trans id="label.addtags">Add tags...</Trans>}+ </Button>+ </div>+ )}+ </div></div>)// Dynamic multiselect dropdown for tags selectionconst editTagsList = props.tags.length > 0 && (- <div className="dropdown-wrapper" ref={dropdownRef}>- {/* Selected options and search input */}- <div className="selected-options-container">- {props.selected.length === 0 && (- <span className="text-muted">- <Trans id="labels.notagsselected">No tags selected</Trans>- </span>+ <div className="c-tags-select__container" ref={dropdownRef} onClick={props.canEdit && !isEditing ? onSubtitleClick : undefined}>+ <div className="c-tags-select__selected-container">+ {props.selected.length === 0 && props.canEdit && (+ <Button className="text-gray-600" variant={"link"} size={"no-padding"} onClick={onSubtitleClick}>+ <Trans id="label.addtags">Add tags...</Trans>+ </Button>)}{sortTags(props.selected).map((tag) => (- <div key={tag.id} className="selected-option">+ <div key={tag.id} className="c-tags-select__selected-item"><ShowTag tag={tag} />- <button onClick={() => handleOptionClick(tag)} className="remove-button">+ <button onClick={() => handleOptionClick(tag)} className="c-tags-select__remove-button">x</button></div>@@ -134,25 +139,25 @@ export const TagsSelect = (props: TagsSelectProps) => {{/* Dropdown options after items are filtered */}{isEditing && (- <div className="options-container">+ <div className="c-tags-select__options">{/* Search box to enter query string */}<inputtype="text"value={query}ref={inputRef}onChange={(e) => setQuery(e.target.value)}- className="c-input search-input"- placeholder={i18n._("label.selecttags", { message: "Select Tags..." })}+ className="c-input c-tags-select__search-input"+ placeholder={i18n._({ id: "label.searchtags", message: "Search tags..." })}onKeyDown={() => handleEsc}/>{filteredOptions.length > 0 ? (sortTags(filteredOptions).map((tag) => (- <div key={tag.id} className="option-item" onClick={() => handleOptionClick(tag)} onKeyDown={(event) => handleOptionKey(event, tag)}>+ <div key={tag.id} className="c-tags-select__option" onClick={() => handleOptionClick(tag)} onKeyDown={(event) => handleOptionKey(event, tag)}><ShowTag tag={tag} /></div>))) : (- <div className="no-options">+ <div className="c-tags-select__no-options"><Trans id="labels.notagsavailable">No tags available</Trans></div>)}@@ -167,16 +172,15 @@ export const TagsSelect = (props: TagsSelectProps) => {<HStack spacing={2} className="text-category"><Trans id="label.tags">Tags</Trans></HStack>- {tagsList}+ {viewModeTagsList}</VStack>)}return (- <VStack>+ <VStack className="c-tags-select"><HStack spacing={2} align="center" className="text-primary-base text-xs">- {!isEditing && tagsList}- {isEditing && editTagsList}+ {isEditing || props.alwaysEditing ? editTagsList : viewModeTagsList}</HStack></VStack>)diff --git a/public/components/common/form/Checkbox.tsx b/public/components/common/form/Checkbox.tsxindex 02db803b6..8f3db126f 100644--- a/public/components/common/form/Checkbox.tsx+++ b/public/components/common/form/Checkbox.tsx@@ -15,7 +15,8 @@ interface CheckboxProps {export const Checkbox: React.FC<CheckboxProps> = (props) => {const [checked, setChecked] = useState<boolean>(props.checked || false)- const onChange = (e: React.ChangeEvent<HTMLInputElement>) => {+ // Original onChange handler+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {const isChecked: boolean = e.currentTarget.checkedsetChecked(isChecked)@@ -35,7 +36,20 @@ export const Checkbox: React.FC<CheckboxProps> = (props) => {><div className="c-checkbox"><HStack>- <input id={`input-${props.field}`} type="checkbox" checked={checked} onChange={onChange} />+ <input+ id={`input-${props.field}`}+ type="checkbox"+ checked={checked}+ onChange={(e) => {+ // Clear error for this field when user interacts with it+ if (ctx.clearError && hasError(props.field, ctx.error)) {+ ctx.clearError(props.field)+ }++ // Call the original onChange handler+ handleChange(e)+ }}+ /><label htmlFor={`input-${props.field}`} className="text-sm">{props.children}</label>diff --git a/public/components/common/form/CommentEditor.scss b/public/components/common/form/CommentEditor.scssindex 089966270..5c1a9a0b0 100644--- a/public/components/common/form/CommentEditor.scss+++ b/public/components/common/form/CommentEditor.scss@@ -2,7 +2,6 @@/* Styling for content elements */.fider-tiptap-editor .ProseMirror {- p,pre {margin: 0 0 0.25em 0;}@@ -107,9 +106,28 @@}}+ // Inline images+ img {+ max-width: 100%;+ height: auto;+ border-radius: 4px;+ margin: 8px 0;+ display: block;+ cursor: pointer;+ }++ .fider-inline-image {+ max-width: 100%;+ height: auto;+ border-radius: 4px;+ margin: 8px 0;+ display: block;+ cursor: pointer;+ }+// Placeholderp.tiptap-is-empty:first-child::before {- color: var(--colors-gray-400);+ color: var(--colors-gray-600);content: attr(data-placeholder);float: left;height: 0;diff --git a/public/components/common/form/CommentEditor.tsx b/public/components/common/form/CommentEditor.tsxindex b186c9897..3a0baf01f 100644--- a/public/components/common/form/CommentEditor.tsx+++ b/public/components/common/form/CommentEditor.tsx@@ -1,6 +1,6 @@import { Editor } from "@tiptap/react"import StarterKit from "@tiptap/starter-kit"-import React, { useState } from "react"+import React, { useState, useRef, useEffect } from "react"import { EditorContent, useEditor } from "@tiptap/react"import { Markdown } from "tiptap-markdown"import Placeholder from "@tiptap/extension-placeholder"@@ -8,6 +8,7 @@ import Document from "@tiptap/extension-document"import Paragraph from "@tiptap/extension-paragraph"import Text from "@tiptap/extension-text"import HardBreak from "@tiptap/extension-hard-break"+import { i18n } from "@lingui/core"import "./CommentEditor.scss"@@ -21,7 +22,12 @@ import IconCode from "@fider/assets/images/heroicons-code.svg"import IconAt from "@fider/assets/images/heroicons-at.svg"import IconOrderedList from "@fider/assets/images/heroicons-orderedlist.svg"import IconBulletList from "@fider/assets/images/heroicons-bulletlist.svg"+import IconPhotograph from "@fider/assets/images/heroicons-photograph.svg"import { DisplayError, hasError, Icon, ValidationContext } from "@fider/components"+import { fileToBase64 } from "@fider/services"+import { generateBkey } from "@fider/services/bkey"+import { ImageUpload } from "@fider/models"+import { CustomImage } from "./CustomImage"import suggestion from "./suggestion"import { CustomMention } from "./CustomMention"@@ -33,16 +39,38 @@ const MenuBar = ({isMarkdownMode,toggleMarkdownMode,disabled,+ onImageUpload,}: {editor: Editor | nullisMarkdownMode: booleandisabled: booleantoggleMarkdownMode: () => void+ onImageUpload: (file: File) => Promise<void>}) => {if (!editor) {return null}+ const fileInputRef = useRef<HTMLInputElement>(null)++ const handleImageClick = () => {+ if (fileInputRef.current) {+ fileInputRef.current.click()+ }+ }++ const handleFileChange = async (e: React.ChangeEvent<HTMLInputElement>) => {+ if (e.target.files && e.target.files[0]) {+ const file = e.target.files[0]+ await onImageUpload(file)++ // Reset the input value so the same file can be selected again+ if (fileInputRef.current) {+ fileInputRef.current.value = ""+ }+ }+ }+return (<div className="c-editor-toolbar"><div className="c-editor-button-group">@@ -141,6 +169,16 @@ const MenuBar = ({><Icon sprite={IconAt} /></button>+ <button+ disabled={disabled}+ type="button"+ title="Insert Image"+ onClick={handleImageClick}+ className={`c-editor-button ${disabled ? "is-disabled" : ""}`}+ >+ <Icon sprite={IconPhotograph} />+ </button>+ <input ref={fileInputRef} type="file" accept="image/*" style={{ display: "none" }} onChange={handleFileChange} /></>)}<button@@ -165,10 +203,14 @@ const MenuBar = ({interface CommentEditorProps {initialValue: string | nullplaceholder?: string- onChange?: (value: string) => void+ onChange?: (value: string, plainText?: string) => voidonFocus?: () => voiddisabled: booleanfield: string+ onImageUploaded?: (upload: ImageUpload) => void+ onGetImageSrc?: (bkey: string) => string+ maxAttachments?: number+ maxImageSizeKB?: number}const markdownToHtml = (markdownString: string) => {@@ -182,6 +224,11 @@ const markdownToHtml = (markdownString: string) => {const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {const [isRawMarkdownMode, setIsRawMarkdownMode] = useState(false)+ const [imageUploads, setImageUploads] = useState<ImageUpload[]>([])++ // Use a ref instead of state for tracking document images+ // This avoids the async state update issue and prevents unnecessary re-renders+ const documentImagesRef = useRef<Map<string, boolean>>(new Map())const getIntialContent = () => {if (isRawMarkdownMode) {@@ -209,9 +256,160 @@ const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {}}+ // Handle image deletion+ const handleImageRemove = async (bkey: string) => {+ // Create an ImageUpload object with remove flag set to true+ const removeUpload: ImageUpload = {+ bkey,+ remove: true,+ }++ // Call the parent component's onImageUploaded prop with the removeUpload object+ if (props.onImageUploaded) {+ props.onImageUploaded(removeUpload)+ }+ }++ // Track all images in the document using the ref+ const trackDocumentImages = (editor: Editor) => {+ if (!editor) return++ // Create a new map for the current state+ const newImages = new Map<string, boolean>()++ // Find all image nodes in the document+ editor.state.doc.descendants((node) => {+ if (node.type.name === "customImage" || node.type.name === "image") {+ const bkey = node.attrs.bkey+ if (bkey) {+ newImages.set(bkey, true)+ }+ }+ return true+ })++ // Store the previous images for comparison+ const prevImages = new Map(documentImagesRef.current)++ // Update the ref with the new images+ documentImagesRef.current = newImages++ // Check for removed images+ checkForRemovedImages(prevImages, newImages)+ }++ // Check for removed images by comparing previous and current document images+ const checkForRemovedImages = (prevImages: Map<string, boolean>, currentImages: Map<string, boolean>) => {+ // Find images that were in the previous state but not in the current state+ prevImages.forEach((_, bkey) => {+ if (!currentImages.has(bkey)) {+ // This image was removed+ handleImageRemove(bkey)+ }+ })+ }+const updated = ({ editor }: { editor: Editor; transaction: any }): void => {+ // Get the current markdown contentconst markdown = isRawMarkdownMode ? editor.getText() : editor.storage.markdown.getMarkdown()- props.onChange && props.onChange(markdown)+ // Always get plain text regardless of mode+ const plainText = editor.getText()++ // Pass both markdown and plain text to parent+ props.onChange && props.onChange(markdown, plainText)++ // Track the current state of images in the document+ // This will also check for removed images+ trackDocumentImages(editor)++ // Also pass any image uploads to the parent component+ if (props.onImageUploaded && imageUploads.length > 0) {+ imageUploads.forEach((upload) => {+ props.onImageUploaded && props.onImageUploaded(upload)+ })+ setImageUploads([])+ }+ }++ const validateImageUpload = (file: File): string => {+ // Default max size is 5MB (5 * 1024 KB)+ const maxSizeKB = props.maxImageSizeKB || 5 * 1024++ // Check file size+ if (file.size > maxSizeKB * 1024) {+ return i18n._({+ id: "validation.custom.maximagesize",+ values: { kilobytes: maxSizeKB },+ message: "The image size must be smaller than {kilobytes}KB.",+ })+ }++ // Check max attachments if specified+ if (props.maxAttachments) {+ if (documentImagesRef.current.size >= props.maxAttachments) {+ return i18n._({+ id: "validation.custom.maxattachments",+ values: { number: props.maxAttachments },+ message: "A maximum of {number} attachments are allowed.",+ })+ }+ }++ return "" // No error+ }++ const handleImageUpload = async (file: File) => {+ // Validate the image upload+ const errorMessage = validateImageUpload(file)+ if (errorMessage) {+ alert(errorMessage)+ return+ }++ try {+ const base64 = await fileToBase64(file)++ // Generate a bkey for this image that matches the server-side format+ const bkey = generateBkey(file.name)++ // Create an ImageUpload object to be sent to the server+ const newUpload: ImageUpload = {+ bkey,+ upload: {+ fileName: file.name,+ content: base64,+ contentType: file.type,+ },+ remove: false,+ }++ // Insert the image into the editor with the server-provided bkey+ if (editor) {+ editor+ .chain()+ .focus()+ .setImage({+ src: `data:${file.type};base64,${base64}`,+ alt: file.name,+ ...({ bkey } as any),+ })+ .run()++ // Add the bkey to the upload object for the parent component+ newUpload.bkey = bkey++ // Manually pass the upload to the parent component+ // since the updated() handler might not fire immediately+ if (props.onImageUploaded) {+ props.onImageUploaded(newUpload)+ }++ // Update the document images ref+ documentImagesRef.current.set(bkey, true)+ }+ } catch (error) {+ console.error("Error uploading image:", error)+ }}const extensions = isRawMarkdownMode@@ -238,6 +436,29 @@ const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {},suggestion,}),+ CustomImage.configure({+ HTMLAttributes: {},+ allowBase64: true,+ onImageUpload: (upload) => {+ if (props.onImageUploaded) {+ // Initialize other required properties+ props.onImageUploaded(upload)+ }+ },+ onImageRemove: (id) => {+ // This is called when an image is removed from the editor+ handleImageRemove(id)+ },+ onGetImageSrc: (bkey) => {+ if (props.onGetImageSrc) {+ const imageSrc = props.onGetImageSrc(bkey)+ if (imageSrc) {+ return "data:image/jpeg;base64," + imageSrc+ }+ }+ return ""+ },+ }),Placeholder.configure({placeholder: props.placeholder ?? "Write your comment here...",emptyEditorClass: "tiptap-is-empty",@@ -258,11 +479,72 @@ const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {attributes: {class: isRawMarkdownMode ? "markdown-mode no-focus" : "no-focus",},+ handlePaste: (view, event) => {+ // Check if the clipboard has files+ if (event.clipboardData && event.clipboardData.files && event.clipboardData.files.length > 0) {+ // Get the first file (assuming it's an image)+ const file = event.clipboardData.files[0]++ // Check if it's an image+ if (file.type.startsWith("image/")) {+ // Prevent the default paste behavior+ event.preventDefault()++ // Validate and upload the image+ const errorMessage = validateImageUpload(file)+ if (errorMessage) {+ alert(errorMessage)+ return true+ }++ // Upload the image+ handleImageUpload(file)+ return true+ }+ }++ // Check for pasted image data URLs+ if (event.clipboardData) {+ const items = event.clipboardData.items++ for (let i = 0; i < items.length; i++) {+ if (items[i].type.indexOf("image") !== -1) {+ // Get the image as a blob+ const blob = items[i].getAsFile()++ if (blob) {+ // Prevent the default paste behavior+ event.preventDefault()++ // Validate and upload the image+ const errorMessage = validateImageUpload(blob)+ if (errorMessage) {+ alert(errorMessage)+ return true+ }++ // Upload the image+ handleImageUpload(blob)+ return true+ }+ }+ }+ }++ return false+ },},},[isRawMarkdownMode, editorContent]) // Re-initialize when mode changes+ // Initialize document images when editor is ready+ useEffect(() => {+ if (editor) {+ trackDocumentImages(editor)+ }+ }, [editor])+return (<ValidationContext.Consumer>{(ctx) => (@@ -273,8 +555,14 @@ const Tiptap: React.FunctionComponent<CommentEditorProps> = (props) => {"m-error": hasError(props.field, ctx.error),})}>- <MenuBar disabled={props.disabled} editor={editor} isMarkdownMode={isRawMarkdownMode} toggleMarkdownMode={toggleMarkdownMode} />- <EditorContent editor={editor} />+ <MenuBar+ disabled={props.disabled}+ editor={editor}+ isMarkdownMode={isRawMarkdownMode}+ toggleMarkdownMode={toggleMarkdownMode}+ onImageUpload={handleImageUpload}+ />+ <EditorContent editor={editor} data-testid="tiptap-editor" /></div><DisplayError fields={[props.field]} error={ctx.error} /></div>diff --git a/public/components/common/form/CustomImage.ts b/public/components/common/form/CustomImage.tsnew file mode 100644index 000000000..d15532411--- /dev/null+++ b/public/components/common/form/CustomImage.ts@@ -0,0 +1,135 @@+import { ImageUpload } from "@fider/models"+import Image from "@tiptap/extension-image"+import * as MarkdownIt from "markdown-it"++export interface CustomImageOptions {+ HTMLAttributes?: Record<string, any>+ allowBase64?: boolean+ onImageUpload?: (upload: ImageUpload) => void+ onImageRemove?: (bkey: string) => void+ onGetImageSrc?: (bkey: string) => string+}++export const CustomImage = Image.extend<CustomImageOptions>({+ name: "customImage",++ addOptions() {+ return {+ ...this.parent?.(),+ HTMLAttributes: {},+ allowBase64: true,+ onImageUpload: undefined,+ onImageRemove: undefined,+ onGetImageSrc: undefined,+ }+ },++ addAttributes() {+ return {+ ...this.parent?.(),+ id: {+ default: null,+ parseHTML: (element) => element.getAttribute("data-id"),+ renderHTML: (attributes) => {+ if (!attributes.id) {+ return {}+ }+ return {+ "data-id": attributes.id,+ }+ },+ },+ bkey: {+ default: null,+ parseHTML: (element) => element.getAttribute("data-bkey"),+ renderHTML: (attributes) => {+ if (!attributes.bkey) {+ return {}+ }+ return {+ "data-bkey": attributes.bkey,+ }+ },+ },+ }+ },++ addStorage() {+ return {+ images: {},+ markdown: {+ serialize: (state: any, node: any) => {+ // When serializing to markdown, we use a special syntax: + // Use bkey if available, otherwise fall back to id+ const imageId = node.attrs.bkey || node.attrs.id || ""+ state.write(``)+ },+ parse: {+ setup: (markdownit: MarkdownIt) => {+ // Custom rule to parse our special image syntax+ markdownit.inline.ruler.before("image", "fider-image", (state: MarkdownIt.StateInline, silent: boolean) => {+ const match = state.src.slice(state.pos).match(/^!\[\]\(fider-image:([a-zA-Z0-9_/.-]+)\)/)+ if (!match) return false++ if (!silent) {+ const imageId = match[1]+ const token = state.push("image", "img", 0)++ // Initialize attrs as an empty array first+ token.attrs = []++ let imageSrc = this.options.onGetImageSrc ? this.options.onGetImageSrc(imageId) : ""+ if (imageSrc.length === 0) {+ imageSrc = `/static/images/${imageId}`+ }++ token.attrSet("src", imageSrc)+ token.attrSet("alt", "")+ token.attrSet("data-id", imageId)+ token.attrSet("data-bkey", imageId)++ token.children = []+ token.content = ""+ }++ state.pos += match[0].length+ return true+ })+ },+ },+ },+ }+ },++ // Override the addImage command to include our custom attributes and handle uploads+ addCommands() {+ return {+ setImage:+ (options: any) =>+ ({ tr, dispatch }: { tr: any; dispatch: any }) => {+ const { src, alt, title, id, bkey } = options++ // Create a node with our custom attributes+ const node = this.type.create({+ src,+ alt,+ title,+ id,+ bkey,+ })++ if (dispatch) {+ tr.replaceSelectionWith(node)+ }++ return true+ },+ }+ },++ // Add event handlers to the editor+ onSelectionUpdate() {+ // When an image is selected, we can add a delete button or handle keyboard events+ // This is a placeholder for future implementation+ },+})diff --git a/public/components/common/form/Form.scss b/public/components/common/form/Form.scssindex 7db8265a3..4e18ad8a0 100644--- a/public/components/common/form/Form.scss+++ b/public/components/common/form/Form.scss@@ -7,7 +7,7 @@display: block;font-size: get("font.size.base");margin-bottom: spacing(1);- font-weight: 500;+ font-weight: 600;}&:last-child {diff --git a/public/components/common/form/Form.tsx b/public/components/common/form/Form.tsxindex 775ac3d8a..1096b5cdc 100644--- a/public/components/common/form/Form.tsx+++ b/public/components/common/form/Form.tsx@@ -6,6 +6,7 @@ import { DisplayError } from "@fider/components"interface ValidationContext {error?: Failure+ clearError?: (field: string) => void}interface FormProps {@@ -14,7 +15,12 @@ interface FormProps {error?: Failure}-export const ValidationContext = React.createContext<ValidationContext>({})+export const ValidationContext = React.createContext<ValidationContext>({+ clearError: (field: string) => {+ /* Default implementation does nothing with field: ${field} */+ void field // Prevent unused parameter warning+ },+})export const Form: React.FunctionComponent<FormProps> = (props) => {const className = classSet({@@ -22,10 +28,27 @@ export const Form: React.FunctionComponent<FormProps> = (props) => {[props.className || ""]: props.className,})+ const [formError, setFormError] = React.useState<Failure | undefined>(props.error)++ // Update formError when props.error changes+ React.useEffect(() => {+ setFormError(props.error)+ }, [props.error])++ // Function to clear error for a specific field+ const clearError = (field: string) => {+ if (formError && formError.errors) {+ const newErrors = formError.errors.filter((err) => err.field !== field)+ if (newErrors.length !== formError.errors.length) {+ setFormError({ errors: newErrors.length > 0 ? newErrors : undefined })+ }+ }+ }+return (<form autoComplete="off" className={className}>- <DisplayError error={props.error} />- <ValidationContext.Provider value={{ error: props.error }}>{props.children}</ValidationContext.Provider>+ <DisplayError error={formError} />+ <ValidationContext.Provider value={{ error: formError, clearError }}>{props.children}</ValidationContext.Provider></form>)}diff --git a/public/components/common/form/ImageUploader.tsx b/public/components/common/form/ImageUploader.tsxindex bc58c62e9..2aa07f411 100644--- a/public/components/common/form/ImageUploader.tsx+++ b/public/components/common/form/ImageUploader.tsx@@ -17,6 +17,7 @@ interface ImageUploaderProps {label?: stringbkey?: stringdisabled?: boolean+ addImageButton?: React.ReactNodeonChange(state: ImageUpload, instanceID?: string, previewURL?: string): void}@@ -38,7 +39,12 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplo}}- public fileChanged = async (e: React.ChangeEvent<HTMLInputElement>) => {+ public fileChanged = async (e: React.ChangeEvent<HTMLInputElement>, ctx?: React.ContextType<typeof ValidationContext>) => {+ // Clear error for this field when user interacts with it+ if (ctx?.clearError && hasError(this.props.field, ctx.error)) {+ ctx.clearError(this.props.field)+ }+if (e.target.files && e.target.files[0]) {const file = e.target.files[0]if (file.size > hardFileSizeLimit) {@@ -65,7 +71,12 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplo}}- public removeFile = async () => {+ public removeFile = async (ctx?: React.ContextType<typeof ValidationContext>) => {+ // Clear error for this field when user interacts with it+ if (ctx?.clearError && hasError(this.props.field, ctx.error)) {+ ctx.clearError(this.props.field)+ }+if (this.fileSelector) {this.fileSelector.value = ""}@@ -140,19 +151,22 @@ export class ImageUploader extends React.Component<ImageUploaderProps, ImageUplo<div className="preview h-20"><img alt="" onClick={this.openModal} src={this.state.previewURL} />{!this.props.disabled && (- <Button onClick={this.removeFile} variant="danger">+ <Button onClick={() => this.removeFile(ctx)} variant="danger">X</Button>)}</div>)}- <input ref={(e) => (this.fileSelector = e)} type="file" onChange={this.fileChanged} accept="image/*" />- {!hasFile && (- <Button onClick={this.selectFile} disabled={this.props.disabled}>- <Icon sprite={IconPhotograph} />- </Button>- )}+ <input ref={(e) => (this.fileSelector = e)} type="file" onChange={(e) => this.fileChanged(e, ctx)} accept="image/*" />+ {!hasFile &&+ (this.props.addImageButton ? (+ <div onClick={this.selectFile}>{this.props.addImageButton}</div>+ ) : (+ <Button onClick={this.selectFile} disabled={this.props.disabled}>+ <Icon sprite={IconPhotograph} />+ </Button>+ ))}<DisplayError fields={[this.props.field]} error={ctx.error} />{this.props.children}</div>diff --git a/public/components/common/form/ImageViewer.scss b/public/components/common/form/ImageViewer.scssdeleted file mode 100644index 791ed1b74..000000000--- a/public/components/common/form/ImageViewer.scss+++ /dev/null@@ -1,20 +0,0 @@-@use "~@fider/assets/styles/variables.scss" as *;--.c-image-viewer {- display: inline-block;- cursor: pointer;- margin-top: 10px;- img {- vertical-align: top;- }- + .c-image-viewer {- margin-inline-start: 10px;- }-}--.c-image-viewer-modal {- img {- max-width: 90vw;- max-height: 80vh;- }-}diff --git a/public/components/common/form/ImageViewer.tsx b/public/components/common/form/ImageViewer.tsxdeleted file mode 100644index e91adc79c..000000000--- a/public/components/common/form/ImageViewer.tsx+++ /dev/null@@ -1,71 +0,0 @@-import React, { useState } from "react"-import { uploadedImageURL } from "@fider/services"-import { Modal, Button, Loader } from "@fider/components"--import "./ImageViewer.scss"-import { Trans } from "@lingui/react/macro"--interface ImageViewerModalProps {- isOpen: boolean- imgSrc: string | undefined- loadedPreview: boolean- onPreviewLoad: () => void- onClose: () => void-}--const ImageViewerModal = (props: ImageViewerModalProps) => (- <Modal.Window className="c-image-viewer-modal" isOpen={props.isOpen} onClose={props.onClose} center={false} size="fluid">- <Modal.Content>- {!props.loadedPreview && <Loader />}- <img alt="" onLoad={props.onPreviewLoad} src={props.imgSrc} />- </Modal.Content>-- <Modal.Footer>- <Button variant="tertiary" onClick={props.onClose}>- <Trans id="action.close">Close</Trans>- </Button>- </Modal.Footer>- </Modal.Window>-)--interface ImageViewerProps {- bkey: string-}--export const ImageViewer = (props: ImageViewerProps) => {- const [showModal, setShowModal] = useState(false)- const [loadedThumbnail, setLoadedThumbnail] = useState(false)- const [loadedPreview, setLoadedPreview] = useState(false)-- const openModal = () => {- if (loadedThumbnail) {- setShowModal(true)- }- }-- const closeModal = () => {- setShowModal(false)- }-- const onThumbnailLoad = () => {- setLoadedThumbnail(true)- }-- const onPreviewLoad = () => {- setLoadedPreview(true)- }-- return (- <div className="c-image-viewer">- <ImageViewerModal- onPreviewLoad={onPreviewLoad}- isOpen={showModal}- onClose={closeModal}- imgSrc={uploadedImageURL(props.bkey, 1500)}- loadedPreview={loadedPreview}- />- {!loadedThumbnail && <Loader />}- <img alt="" onClick={openModal} onLoad={onThumbnailLoad} src={uploadedImageURL(props.bkey, 200)} />- </div>- )-}diff --git a/public/components/common/form/Input.scss b/public/components/common/form/Input.scssindex 2ac3063ed..79f1723bb 100644--- a/public/components/common/form/Input.scss+++ b/public/components/common/form/Input.scss@@ -15,6 +15,10 @@@include disabled();}+ &::placeholder {+ color: var(--colors-gray-600);+ }+& + svg,& + img {position: absolute;diff --git a/public/components/common/form/Input.tsx b/public/components/common/form/Input.tsxindex 722e5ee6e..931859e2e 100644--- a/public/components/common/form/Input.tsx+++ b/public/components/common/form/Input.tsx@@ -29,12 +29,20 @@ interface InputProps {}export const Input: React.FunctionComponent<InputProps> = (props) => {+ // Original onChange handlerconst onChange = (e: React.FormEvent<HTMLInputElement>) => {if (props.onChange) {props.onChange(e.currentTarget.value)}}+ // Original onFocus handler+ const onFocus = () => {+ if (props.onFocus) {+ props.onFocus()+ }+ }+const suffix = typeof props.suffix === "string" ? <span className="c-input__suffix">{props.suffix}</span> : props.suffixconst icon = props.icon ? <Icon sprite={props.icon} onClick={props.onIconClick} className={classSet({ clickable: !!props.onIconClick })} /> : undefined@@ -68,12 +76,20 @@ export const Input: React.FunctionComponent<InputProps> = (props) => {tabIndex={props.noTabFocus ? -1 : undefined}ref={props.inputRef}autoFocus={props.autoFocus}- onFocus={props.onFocus}+ onFocus={onFocus}maxLength={props.maxLength}disabled={props.disabled}value={props.value}placeholder={props.placeholder}- onChange={onChange}+ onChange={(e) => {+ // Clear error for this field when user interacts with it+ if (ctx.clearError && hasError(props.field, ctx.error)) {+ ctx.clearError(props.field)+ }++ // Call the original onChange handler+ onChange(e)+ }}/>{icon}{suffix}diff --git a/public/components/common/form/MentionList.scss b/public/components/common/form/MentionList.scssindex 74990ec11..59a2d0c06 100644--- a/public/components/common/form/MentionList.scss+++ b/public/components/common/form/MentionList.scss@@ -10,6 +10,7 @@flex-direction: column;gap: 0.1rem;overflow: auto;+ max-height: 300px;padding: spacing(1);position: relative;diff --git a/public/components/common/form/MultiImageUploader.tsx b/public/components/common/form/MultiImageUploader.tsxindex 62fd1e223..e57b78745 100644--- a/public/components/common/form/MultiImageUploader.tsx+++ b/public/components/common/form/MultiImageUploader.tsx@@ -10,6 +10,7 @@ interface MultiImageUploaderProps {field: stringmaxUploads: numberbkeys?: string[]+ addImageButton?: React.ReactNodeonChange?: (uploads: ImageUpload[]) => voidnoPadding?: boolean}@@ -44,7 +45,12 @@ export class MultiImageUploader extends React.Component<MultiImageUploaderProps,this.state = { instances, removed: [] }}- private imageUploaded = (upload: ImageUpload, instanceID: string) => {+ private imageUploaded = (upload: ImageUpload, instanceID: string, ctx?: React.ContextType<typeof ValidationContext>) => {+ // Clear error for this field when user interacts with it+ if (ctx?.clearError && hasError(this.props.field, ctx.error)) {+ ctx.clearError(this.props.field)+ }+const instances = { ...this.state.instances }const removed = [...this.state.removed]if (upload.remove) {@@ -74,7 +80,20 @@ export class MultiImageUploader extends React.Component<MultiImageUploaderProps,private addNewElement(instances: MultiImageUploaderInstances, bkey?: string) {const id = btoa(Math.random().toString())instances[id] = {- element: <ImageUploader key={id} bkey={bkey} instanceID={id} field="attachment" onChange={this.imageUploaded} />,+ element: (+ <ValidationContext.Consumer>+ {(ctx) => (+ <ImageUploader+ key={id}+ bkey={bkey}+ instanceID={id}+ field="attachment"+ onChange={(upload, instanceID) => this.imageUploaded(upload, instanceID || "", ctx)}+ addImageButton={this.props.addImageButton}+ />+ )}+ </ValidationContext.Consumer>+ ),}}diff --git a/public/components/common/form/Select.tsx b/public/components/common/form/Select.tsxindex 6a6f6c43c..cfd8be8ca 100644--- a/public/components/common/form/Select.tsx+++ b/public/components/common/form/Select.tsx@@ -30,7 +30,8 @@ export const Select: React.FunctionComponent<SelectProps> = (props) => {}}const [selected, setSelected] = React.useState<SelectOption | undefined>(getOption(props.defaultValue))- const onChange = (e: React.FormEvent<HTMLSelectElement>) => {+ // Original onChange handler+ const handleChange = (e: React.FormEvent<HTMLSelectElement>) => {let selected: SelectOption | undefinedif (e.currentTarget.value) {const options = props.options.filter((o) => o.value === e.currentTarget.value)@@ -59,7 +60,15 @@ export const Select: React.FunctionComponent<SelectProps> = (props) => {value={selected?.value}id={`input-${props.field}`}defaultValue={props.defaultValue}- onChange={onChange}+ onChange={(e) => {+ // Clear error for this field when user interacts with it+ if (ctx.clearError && hasError(props.field, ctx.error)) {+ ctx.clearError(props.field)+ }++ // Call the original onChange handler+ handleChange(e)+ }}>{props.options.map((option) => (<option key={option.value} value={option.value}>diff --git a/public/components/common/form/TextArea.tsx b/public/components/common/form/TextArea.tsxindex 0a61360da..c3bb503c4 100644--- a/public/components/common/form/TextArea.tsx+++ b/public/components/common/form/TextArea.tsx@@ -23,18 +23,27 @@ interface TextAreaProps {}export const TextArea: React.FunctionComponent<TextAreaProps> = (props) => {+ // Original onChange handlerconst onChange = (e: React.FormEvent<HTMLTextAreaElement>) => {if (props.onChange) {props.onChange(e.currentTarget.value, e.currentTarget.selectionStart)}}+ // Original onKeyDown handlerconst onKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {if (props.onKeyDown) {props.onKeyDown(e)}}+ // Original onFocus handler+ const onFocus = (e: React.FocusEvent<HTMLTextAreaElement>) => {+ if (props.onFocus) {+ props.onFocus(e)+ }+ }+return (<ValidationContext.Consumer>{(ctx) => (@@ -54,13 +63,21 @@ export const TextArea: React.FunctionComponent<TextAreaProps> = (props) => {})}id={`input-${props.field}`}disabled={props.disabled}- onChange={onChange}+ onChange={(e) => {+ // Clear error for this field when user interacts with it+ if (ctx.clearError && hasError(props.field, ctx.error)) {+ ctx.clearError(props.field)+ }++ // Call the original onChange handler+ onChange(e)+ }}onKeyDown={onKeyDown}value={props.value}minRows={props.minRows || 3}placeholder={props.placeholder}ref={props.inputRef}- onFocus={props.onFocus}+ onFocus={onFocus}/><DisplayError fields={[props.field]} error={ctx.error} />{props.children}diff --git a/public/components/common/form/suggestion.ts b/public/components/common/form/suggestion.tsindex e3a0191c1..5ee07fc2e 100644--- a/public/components/common/form/suggestion.ts+++ b/public/components/common/form/suggestion.ts@@ -17,12 +17,12 @@ export default {if (cachedUsers.length === 0) {const result = await actions.getTaggableUsers("")if (result.ok) {- cachedUsers = result.data.map((user) => ({ id: user.id.toString(), label: user.name }))+ cachedUsers = result.data.map((user, idx) => ({ id: idx.toString(), label: user.name }))}}// Filter the cached users based on the query- return cachedUsers.filter((item) => item.label?.toLowerCase().startsWith(query.toLowerCase())).slice(0, 5)+ return cachedUsers.filter((item) => item.label?.toLowerCase().startsWith(query.toLowerCase())).slice(0, 100)},render: () => {let reactRenderer: ReactRenderer<MentionListHandle, MentionListProps>@@ -118,7 +118,6 @@ export default {},onKeyDown(props: { event: KeyboardEvent }) {- console.log(props.event.key)if (props.event.key === "Escape" && containerElement) {// Clean upif (scrollListener) {diff --git a/public/components/common/index.tsx b/public/components/common/index.tsxindex 8c1551867..8426005a3 100644--- a/public/components/common/index.tsx+++ b/public/components/common/index.tsx@@ -10,7 +10,6 @@ export * from "./form/Select"export * from "./form/Field"export * from "./form/Checkbox"export * from "./form/CommentEditor"-export * from "./form/ImageViewer"export * from "./Markdown"export * from "./DevBanner"export * from "./Icon"diff --git a/public/components/index.tsx b/public/components/index.tsxindex 7833f5b30..55a123ae7 100644--- a/public/components/index.tsx+++ b/public/components/index.tsx@@ -5,6 +5,7 @@ export * from "./ShowPostStatus"export * from "./ShowTag"export * from "./Header"export * from "./SignInModal"+export * from "./RSSModal"export * from "./VoteCounter"export * from "./NotificationIndicator"export * from "./UserMenu"diff --git a/public/hooks/useAttachments.ts b/public/hooks/useAttachments.tsnew file mode 100644index 000000000..9ae7e7930--- /dev/null+++ b/public/hooks/useAttachments.ts@@ -0,0 +1,100 @@+import { useState, useEffect, useCallback } from "react"+import { ImageUpload } from "@fider/models"+import { cache } from "@fider/services"++interface UseAttachmentsOptions {+ cacheKey?: string+ maxAttachments?: number+ useLocalStorage?: boolean+}++interface UseAttachmentsReturn {+ attachments: ImageUpload[]+ setAttachments: React.Dispatch<React.SetStateAction<ImageUpload[]>>+ handleImageUploaded: (upload: ImageUpload) => void+ getImageSrc: (bkey: string) => string+ clearAttachments: () => void+}++export const useAttachments = (options: UseAttachmentsOptions = {}): UseAttachmentsReturn => {+ const { cacheKey, maxAttachments } = options++ const getStorage = options.useLocalStorage ? cache.local : cache.session++ const getAttachmentsFromCache = useCallback(() => {+ if (!cacheKey) return []+ const cachedAttachments = getStorage.get(cacheKey)+ return cachedAttachments ? JSON.parse(cachedAttachments) : []+ }, [cacheKey, getStorage])++ const [attachments, setAttachments] = useState<ImageUpload[]>(getAttachmentsFromCache())++ // Cache attachments whenever they change+ useEffect(() => {+ if (cacheKey) {+ getStorage.set(cacheKey, JSON.stringify(attachments))+ }+ }, [attachments, cacheKey, getStorage])++ const handleImageUploaded = useCallback(+ (upload: ImageUpload) => {+ setAttachments((prev) => {+ // If this is a removal request, find and remove the attachment+ // if (upload.remove && upload.bkey) {+ // return prev.filter((att) => att.bkey !== upload.bkey)+ // }+ if (upload.remove) {+ // Rules are:+ // 1.If the bkey exists in attachments:+ // 1.1 If there is something in upload.content, then it's a new upload that's not yet saved, so just remove the entry from attachments.+ // 1.2 If there is nothing in upload.content, it's been previously uploaded, so set the remove flag to true.+ // 2. If the bkey doesn't exist, then you're editing, and attachments hasn't been "primed" so add it as a new one but with with remove flag set to true++ const existing = prev.find((att) => att.bkey === upload.bkey)++ if (existing) {+ if (existing.upload?.content && existing.upload.content.length > 0) {+ return prev.filter((att) => att.bkey !== upload.bkey)+ } else {+ return prev.map((att) => (att.bkey === upload.bkey ? { ...att, remove: true } : att))+ }+ } else {+ return [...prev, { ...upload, remove: true }]+ }+ }++ // Check max attachments limit+ if (maxAttachments && prev.length >= maxAttachments) {+ console.warn(`Maximum ${maxAttachments} attachments allowed`)+ return prev+ }++ // Otherwise add the new upload+ return [...prev, upload]+ })+ },+ [maxAttachments]+ )++ const getImageSrc = useCallback(+ (bkey: string): string => {+ return attachments.find((att) => att.bkey === bkey)?.upload?.content?.toString() ?? ""+ },+ [attachments]+ )++ const clearAttachments = useCallback(() => {+ setAttachments([])+ if (cacheKey) {+ getStorage.remove(cacheKey)+ }+ }, [cacheKey, getStorage])++ return {+ attachments,+ setAttachments,+ handleImageUploaded,+ getImageSrc,+ clearAttachments,+ }+}diff --git a/public/models/post.ts b/public/models/post.tsindex 0c461f6e1..e9f5a6ff2 100644--- a/public/models/post.ts+++ b/public/models/post.ts@@ -85,3 +85,8 @@ export interface Vote {avatarURL: string}}++export interface InlineImage {+ bkey: string+ remove: boolean+}diff --git a/public/pages/Home/Home.page.tsx b/public/pages/Home/Home.page.tsxindex 07fbd43b7..6e30d330f 100644--- a/public/pages/Home/Home.page.tsx+++ b/public/pages/Home/Home.page.tsx@@ -3,19 +3,19 @@ import NoDataIllustration from "@fider/assets/images/undraw-no-data.svg"import React, { useState } from "react"import { Post, Tag, PostStatus } from "@fider/models"-import { Markdown, Hint, PoweredByFider, Icon, Header } from "@fider/components"-import { SimilarPosts } from "./components/SimilarPosts"-import { PostInput } from "./components/PostInput"+import { Markdown, Hint, PoweredByFider, Icon, Header, Button } from "@fider/components"import { PostsContainer } from "./components/PostsContainer"import { useFider } from "@fider/hooks"import { VStack } from "@fider/components/layout"-+import { ShareFeedback } from "./components/ShareFeedback"import { i18n } from "@lingui/core"import { Trans } from "@lingui/react/macro"+import { isPostPending } from "./components/PostCache"export interface HomePageProps {posts: Post[]tags: Tag[]+ searchNoiseWords: string[]countPerStatus: { [key: string]: number }}@@ -46,17 +46,17 @@ const Lonely = () => {const HomePage = (props: HomePageProps) => {const fider = useFider()- const [title, setTitle] = useState("")+ // const [title, setTitle] = useState("")+ const [isShareFeedbackOpen, setIsShareFeedbackOpen] = useState(isPostPending())- const defaultWelcomeMessage = i18n._("home.form.defaultwelcomemessage", {+ const defaultWelcomeMessage = i18n._({+ id: "home.form.defaultwelcomemessage",message: `We'd love to hear what you're thinking about.What can we do better? This is the place for you to vote, discuss and share ideas.`,})- const defaultInvitation = i18n._("home.form.defaultinvitation", {- message: "Enter your suggestion here...",- })+ const defaultInvitation = i18n._({ id: "home.form.defaultinvitation", message: "Enter your suggestion here..." })const isLonely = () => {const len = Object.keys(props.countPerStatus).length@@ -71,25 +71,34 @@ What can we do better? This is the place for you to vote, discuss and share ideareturn false}+ const handleNewPost = () => {+ setIsShareFeedbackOpen(true)+ }+return (<>+ <ShareFeedback+ tags={props.tags}+ placeholder={fider.session.tenant.invitation || defaultInvitation}+ isOpen={isShareFeedbackOpen}+ onClose={() => setIsShareFeedbackOpen(false)}+ /><Header /><div id="p-home" className="page container"><div className="p-home__welcome-col"><VStack spacing={2} className="p-4"><Markdown text={fider.session.tenant.welcomeMessage || defaultWelcomeMessage} style="full" />- <PostInput tags={props.tags} placeholder={fider.session.tenant.invitation || defaultInvitation} onTitleChanged={setTitle} />+ <Button className="c-input" type="submit" variant="secondary" onClick={handleNewPost}>+ {fider.session.tenant.invitation || defaultInvitation}+ </Button></VStack>- <PoweredByFider slot="home-input" className="sm:hidden md:hidden lg:block mt-3" />+ <div onClick={() => setIsShareFeedbackOpen(true)}>+ <PoweredByFider slot="home-input" className="sm:hidden md:hidden lg:block mt-3" />+ </div></div><div className="p-home__posts-col p-4">- {isLonely() ? (- <Lonely />- ) : title ? (- <SimilarPosts title={title} tags={props.tags} />- ) : (- <PostsContainer posts={props.posts} tags={props.tags} countPerStatus={props.countPerStatus} />- )}+ {isLonely() && <Lonely />}+ <PostsContainer posts={props.posts} tags={props.tags} countPerStatus={props.countPerStatus} /><PoweredByFider slot="home-footer" className="lg:hidden xl:hidden mt-8" /></div></div>diff --git a/public/pages/Home/components/ListPosts.tsx b/public/pages/Home/components/ListPosts.tsxindex 3105bd09c..341d5ba87 100644--- a/public/pages/Home/components/ListPosts.tsx+++ b/public/pages/Home/components/ListPosts.tsx@@ -8,6 +8,7 @@ interface ListPostsProps {posts?: Post[]tags: Tag[]emptyText: string+ minimalView?: boolean}const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) => {@@ -19,7 +20,7 @@ const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) =><VStack className="w-full" spacing={2}>{props.post.status !== "open" && (<div className="mb-2 align-self-start">- <ResponseLozenge status={props.post.status} response={props.post.response} small={true} />+ <ResponseLozenge status={props.post.status} response={props.post.response} size={"small"} /></div>)}<HStack justify="between">@@ -45,7 +46,28 @@ const ListPostItem = (props: { post: Post; user?: CurrentUser; tags: Tag[] }) =>)}+const MinimalListPostItem = (props: { post: Post; tags: Tag[] }) => {+ return (+ <HStack spacing={4} align="start" className="c-posts-container__post">+ <HStack className="w-full" justify="between" align="start">+ <a className="text-link" href={`/posts/${props.post.number}/${props.post.slug}`}>+ {props.post.title}+ </a>+ {props.post.status !== "open" ? (+ <div>+ <ResponseLozenge status={props.post.status} response={props.post.response} size={"micro"} />+ </div>+ ) : (+ <span className="text-gray-700 text-sm">+{props.post.votesCount}</span>+ )}+ </HStack>+ </HStack>+ )+}+export const ListPosts = (props: ListPostsProps) => {+ const { minimalView = false } = props+if (!props.posts) {return null}@@ -55,10 +77,20 @@ export const ListPosts = (props: ListPostsProps) => {}return (- <VStack spacing={4} divide>- {props.posts.map((post) => (- <ListPostItem key={post.id} post={post} tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)} />- ))}- </VStack>+ <>+ {minimalView ? (+ <VStack spacing={2}>+ {props.posts.map((post) => (+ <MinimalListPostItem key={post.id} post={post} tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)} />+ ))}+ </VStack>+ ) : (+ <VStack spacing={4} divide>+ {props.posts.map((post) => (+ <ListPostItem key={post.id} post={post} tags={props.tags.filter((tag) => post.tags.indexOf(tag.slug) >= 0)} />+ ))}+ </VStack>+ )}+ </>)}diff --git a/public/pages/Home/components/PostCache.ts b/public/pages/Home/components/PostCache.tsnew file mode 100644index 000000000..8fc047ad2--- /dev/null+++ b/public/pages/Home/components/PostCache.ts@@ -0,0 +1,54 @@+import { cache } from "@fider/services"++export const CACHE_KEYS = {+ TITLE: "PostInput-Title",+ DESCRIPTION: "PostInput-Description",+ ATTACHMENT: "PostInput-Attachment",+ TAGS: "PostInput-Tags",+ POST_PENDING: "PostInput-PostPending",+} as const++export const getCachedTitle = (): string => {+ return getCachedValue(CACHE_KEYS.TITLE)+}++export const setCachedTitle = (title: string): void => {+ cache.local.set(CACHE_KEYS.TITLE, title)+}++export const getCachedDescription = (): string => {+ return getCachedValue(CACHE_KEYS.DESCRIPTION)+}++export const setCachedDescription = (description: string): void => {+ cache.local.set(CACHE_KEYS.DESCRIPTION, description)+}++const getCachedValue = (key: string): string => {+ return cache.local.get(key) || ""+}++export const getCachedTags = (): string[] => {+ const cacheValue = getCachedValue(CACHE_KEYS.TAGS)+ return cacheValue.split(",")+}++export const setCachedTags = (tags: string[]): void => {+ cache.local.set(CACHE_KEYS.TAGS, tags.join(","))+}++export const setPostPending = (value: boolean): void => {+ cache.local.set(CACHE_KEYS.POST_PENDING, value.toString())+}++export const isPostPending = (): boolean => {+ return getCachedValue(CACHE_KEYS.POST_PENDING) === "true"+}++export const clearCache = () => {+ cache.local.remove(...Object.values(CACHE_KEYS))+}++export const setPostCreated = () => {+ cache.session.set("POST_CREATED_SUCCESS", "true")+}diff --git a/public/pages/Home/components/PostFilter.tsx b/public/pages/Home/components/PostFilter.tsxindex 165fe184c..5a42fe6f6 100644--- a/public/pages/Home/components/PostFilter.tsx+++ b/public/pages/Home/components/PostFilter.tsx@@ -76,7 +76,7 @@ export const PostFilter = (props: PostFilterProps) => {const options: OptionItem[] = []if (fider.session.isAuthenticated) {- options.push({ value: true, label: i18n._("home.postfilter.option.myvotes", { message: "My Votes" }), type: "myVotes" })+ options.push({ value: true, label: i18n._({ id: "home.postfilter.option.myvotes", message: "My Votes" }), type: "myVotes" })}PostStatus.All.filter((s) => s.filterable && props.countPerStatus[s.value]).forEach((s) => {@@ -107,7 +107,7 @@ export const PostFilter = (props: PostFilterProps) => {renderHandle={<HStack className="h-10 text-medium text-xs rounded-md uppercase border border-gray-400 text-gray-800 p-2 px-3"><Icon sprite={HeroIconFilter} className="h-5 pr-1" />- {i18n._("home.filter.label", { message: "Filter" })}+ {i18n._({ id: "home.filter.label", message: "Filter" })}{filterCount > 0 && <div className="bg-gray-200 inline-block rounded-full px-2 py-1 w-min-4 text-2xs text-center">{filterCount}</div>}</HStack>}@@ -117,7 +117,7 @@ export const PostFilter = (props: PostFilterProps) => {value={query}onChange={(e) => setQuery(e.target.value)}className="c-input filter-input"- placeholder={i18n._("home.filter.search.label", { message: "Search in filters..." })}+ placeholder={i18n._({ id: "home.filter.search.label", message: "Search in filters..." })}/>{filteredOptions.map((o) => {const isChecked = filterItems.find((f) => f.type === o.type && f.value === o.value) !== undefineddiff --git a/public/pages/Home/components/PostInput.tsx b/public/pages/Home/components/PostInput.tsxdeleted file mode 100644index bbaef340f..000000000--- a/public/pages/Home/components/PostInput.tsx+++ /dev/null@@ -1,141 +0,0 @@-import React, { useState, useEffect, useRef } from "react"-import { Button, ButtonClickEvent, Input, Form, TextArea, MultiImageUploader } from "@fider/components"-import { SignInModal } from "@fider/components"-import { cache, actions, classSet, Failure, querystring } from "@fider/services"-import { ImageUpload, Tag } from "@fider/models"-import { useFider } from "@fider/hooks"-import { i18n } from "@lingui/core"-import { Trans } from "@lingui/react/macro"-import { TagsSelect } from "@fider/components/common/TagsSelect"--interface PostInputProps {- placeholder: string- onTitleChanged: (title: string) => void- tags: Tag[]-}--const CACHE_TITLE_KEY = "PostInput-Title"-const CACHE_DESCRIPTION_KEY = "PostInput-Description"-const CACHE_TAGS_KEY = "PostInput-Tags"--export const PostInput = (props: PostInputProps) => {- const getCachedValue = (key: string): string => {- if (fider.session.isAuthenticated) {- return cache.session.get(key) || ""- }- return ""- }-- const getTagsCachedValue = (): Tag[] => {- if (!canEditTags) {- return []- }-- const cacheValue = getCachedValue(CACHE_TAGS_KEY)- const urlValue = querystring.get("tags")- const combined = [...cacheValue.split(","), ...urlValue.split(",")]- const tagsAsStrings = Array.from(new Set(combined.map((s) => s.trim()).filter((s) => s.length > 0)))-- return props.tags.filter((tag) => tagsAsStrings.includes(tag.slug))- }-- const fider = useFider()- const canEditTags = fider.session.isAuthenticated && fider.settings.postWithTags && props.tags.length > 0- const titleRef = useRef<HTMLInputElement>()- const [title, setTitle] = useState(getCachedValue(CACHE_TITLE_KEY))- const [description, setDescription] = useState(getCachedValue(CACHE_DESCRIPTION_KEY))- const [tags, setTags] = useState(getTagsCachedValue())- const [isSignInModalOpen, setIsSignInModalOpen] = useState(false)- const [attachments, setAttachments] = useState<ImageUpload[]>([])- const [error, setError] = useState<Failure | undefined>(undefined)-- useEffect(() => {- props.onTitleChanged(title)- }, [title])-- const handleTitleFocus = () => {- if (!fider.session.isAuthenticated && titleRef.current) {- titleRef.current.blur()- setIsSignInModalOpen(true)- }- }-- const handleTitleChange = (value: string) => {- cache.session.set(CACHE_TITLE_KEY, value)- setTitle(value)- props.onTitleChanged(value)- }-- const hideModal = () => setIsSignInModalOpen(false)- const clearError = () => setError(undefined)-- const handleDescriptionChange = (value: string) => {- cache.session.set(CACHE_DESCRIPTION_KEY, value)- setDescription(value)- }-- const submit = async (event: ButtonClickEvent) => {- if (title) {- const result = await actions.createPost(- title,- description,- attachments,- tags.map((tag) => tag.slug)- )- if (result.ok) {- clearError()- cache.session.remove(CACHE_TITLE_KEY, CACHE_DESCRIPTION_KEY, CACHE_TAGS_KEY)- location.href = `/posts/${result.data.number}/${result.data.slug}`- event.preventEnable()- } else if (result.error) {- setError(result.error)- }- }- }-- const handleTagsChanged = (newTags: Tag[]) => {- cache.session.set(CACHE_TAGS_KEY, newTags.map((tag) => tag.slug).join(","))- setTags(newTags)- }-- const details = () => (- <>- <TextArea- field="description"- onChange={handleDescriptionChange}- value={description}- minRows={5}- placeholder={i18n._("home.postinput.description.placeholder", { message: "Describe your suggestion (optional)" })}- />- {canEditTags && (- <div className={classSet({ "c-form-field": true })}>- <TagsSelect tags={props.tags} selectionChanged={handleTagsChanged} selected={tags} canEdit={true} />- </div>- )}- <MultiImageUploader field="attachments" maxUploads={3} onChange={setAttachments} noPadding />- <Button type="submit" variant="primary" onClick={submit}>- <Trans id="action.submit">Submit</Trans>- </Button>- </>- )-- return (- <>- <SignInModal isOpen={isSignInModalOpen} onClose={hideModal} />- <Form error={error}>- <Input- field="title"- disabled={fider.isReadOnly}- noTabFocus={!fider.session.isAuthenticated}- inputRef={titleRef}- onFocus={handleTitleFocus}- maxLength={100}- value={title}- onChange={handleTitleChange}- placeholder={props.placeholder}- />- {title && details()}- </Form>- </>- )-}diff --git a/public/pages/Home/components/PostsContainer.tsx b/public/pages/Home/components/PostsContainer.tsxindex 0bb49f13f..ccf822963 100644--- a/public/pages/Home/components/PostsContainer.tsx+++ b/public/pages/Home/components/PostsContainer.tsx@@ -139,7 +139,7 @@ export class PostsContainer extends React.Component<PostsContainerProps, PostsCofield="query"icon={this.state.query ? IconX : IconSearch}onIconClick={this.state.query ? this.clearSearch : undefined}- placeholder={i18n._("home.postscontainer.query.placeholder", { message: "Search" })}+ placeholder={i18n._({ id: "home.postscontainer.query.placeholder", message: "Search" })}value={this.state.query}onChange={this.handleSearchFilterChanged}/>@@ -148,7 +148,7 @@ export class PostsContainer extends React.Component<PostsContainerProps, PostsCo<ListPostsposts={this.state.posts}tags={this.props.tags}- emptyText={i18n._("home.postscontainer.label.noresults", { message: "No results matched your search, try something different." })}+ emptyText={i18n._({ id: "home.postscontainer.label.noresults", message: "No results matched your search, try something different." })}/>{this.state.loading && <Loader />}{showMoreLink && (diff --git a/public/pages/Home/components/PostsSort.tsx b/public/pages/Home/components/PostsSort.tsxindex b13e32bcc..fc1fcae33 100644--- a/public/pages/Home/components/PostsSort.tsx+++ b/public/pages/Home/components/PostsSort.tsx@@ -2,6 +2,10 @@ import React from "react"import { Dropdown } from "@fider/components"import { HStack } from "@fider/components/layout"import { i18n } from "@lingui/core"+import IconSparkles from "@fider/assets/images/heroicons-sparkles-outline.svg"+import IconThumbsUp from "@fider/assets/images/heroicons-thumbsup.svg"+import IconChat from "@fider/assets/images/heroicons-chat-alt-2.svg"+import IconClock from "@fider/assets/images/heroicons-clock.svg"interface PostsSortProps {value: string@@ -10,10 +14,10 @@ interface PostsSortProps {export const PostsSort: React.FC<PostsSortProps> = ({ value = "trending", onChange }) => {const options = [- { value: "trending", label: i18n._("home.postfilter.option.trending", { message: "Trending" }) },- { value: "most-wanted", label: i18n._("home.postfilter.option.mostwanted", { message: "Most Wanted" }) },- { value: "most-discussed", label: i18n._("home.postfilter.option.mostdiscussed", { message: "Most Discussed" }) },- { value: "recent", label: i18n._("home.postfilter.option.recent", { message: "Recent" }) },+ { value: "trending", label: i18n._({ id: "home.postfilter.option.trending", message: "Trending" }), icon: IconSparkles },+ { value: "most-wanted", label: i18n._({ id: "home.postfilter.option.mostwanted", message: "Most Wanted" }), icon: IconThumbsUp },+ { value: "most-discussed", label: i18n._({ id: "home.postfilter.option.mostdiscussed", message: "Most Discussed" }), icon: IconChat },+ { value: "recent", label: i18n._({ id: "home.postfilter.option.recent", message: "Recent" }), icon: IconClock },]const selectedItem = options.find((x) => x.value === value) || options[0]@@ -23,12 +27,12 @@ export const PostsSort: React.FC<PostsSortProps> = ({ value = "trending", onChan<DropdownrenderHandle={<div className="h-10 flex flex-items-center text-medium text-xs rounded-md uppercase border border-gray-400 text-gray-800 p-2 px-3">- {i18n._("home.postsort.label", { message: "Sort by:" })} {selectedItem.label}+ {i18n._({ id: "home.postsort.label", message: "Sort by:" })} {selectedItem.label}</div>}>{options.map((o) => (- <Dropdown.ListItem key={o.value} onClick={() => onChange(o.value)}>+ <Dropdown.ListItem key={o.value} onClick={() => onChange(o.value)} icon={o.icon}><span className={value === o.value ? "text-semibold" : ""}>{o.label}</span></Dropdown.ListItem>))}diff --git a/public/pages/Home/components/ShareFeedback.scss b/public/pages/Home/components/ShareFeedback.scssnew file mode 100644index 000000000..cbdc84d76--- /dev/null+++ b/public/pages/Home/components/ShareFeedback.scss@@ -0,0 +1,47 @@+@import "~@fider/assets/styles/variables.scss";++.c-share-feedback {+ background-color: var(--colors-gray-200);+ display: flex;+ flex-direction: column;+ height: 100%;++ &__content {+ background-color: var(--colors-white);+ padding: spacing(6);+ border-radius: get("border.radius.large");+ max-width: 600px;+ margin: 0 auto spacing(4);+ flex-shrink: 0;+ }++ .c-modal-content {+ flex: 1;+ overflow-y: auto;+ }+}++.c-share-feedback-form {+ .c-form-field {+ margin-bottom: spacing(6);++ label {+ padding-bottom: spacing(2);+ }+ }+}++.animate-fade-in {+ animation: fadeIn 0.5s ease-in-out;++ @keyframes fadeIn {+ from {+ opacity: 0;+ transform: translateY(10px);+ }+ to {+ opacity: 1;+ transform: translateY(0);+ }+ }+}diff --git a/public/pages/Home/components/ShareFeedback.tsx b/public/pages/Home/components/ShareFeedback.tsxnew file mode 100644index 000000000..f37de6aa6--- /dev/null+++ b/public/pages/Home/components/ShareFeedback.tsx@@ -0,0 +1,291 @@+import "./ShareFeedback.scss"++import React, { useEffect, useRef, useState } from "react"+import { SignInControl } from "@fider/components/common/SignInControl"+import { Modal, CloseIcon, Form, Button, Input, LegalFooter } from "@fider/components/common"+import { useFider } from "@fider/hooks"+import { Trans } from "@lingui/react/macro"+import { actions, Failure, querystring, classSet } from "@fider/services"+import { i18n } from "@lingui/core"+import { Tag } from "@fider/models"+import { SimilarPosts } from "../components/SimilarPosts"+import { TagsSelect } from "@fider/components/common/TagsSelect"+import CommentEditor from "@fider/components/common/form/CommentEditor"+import {+ CACHE_KEYS,+ clearCache,+ getCachedDescription,+ getCachedTags,+ getCachedTitle,+ setCachedDescription,+ setCachedTags,+ setCachedTitle,+ setPostCreated,+ setPostPending,+} from "./PostCache"+import { useAttachments } from "@fider/hooks/useAttachments"++interface ShareFeedbackProps {+ isOpen: boolean+ placeholder: string+ onClose: () => void+ tags: Tag[]+}++export const ShareFeedback: React.FC<ShareFeedbackProps> = (props) => {+ const fider = useFider()+ const { isOpen, onClose } = props++ const getTagsCachedValue = (): Tag[] => {+ if (!canEditTags) {+ return []+ }++ const cacheValue = getCachedTags()+ const urlValue = querystring.get("tags")+ const combined = [...cacheValue, ...urlValue.split(",")]+ const tagsAsStrings = Array.from(new Set(combined.map((s) => s.trim()).filter((s) => s.length > 0)))++ return props.tags.filter((tag) => tagsAsStrings.includes(tag.slug))+ }++ const getTitleManuallyEditedValue = (): boolean => {+ // If the cached title deviates from the description, it means the user manually edited it+ return getCachedTitle() !== getCachedDescription()+ }++ const canEditTags = fider.settings.postWithTags && props.tags.length > 0+ const [title, setTitle] = useState(getCachedTitle())+ const [description, setDescription] = useState(getCachedDescription())+ // Add state for plain text version of description+ const [descriptionPlainText, setDescriptionPlainText] = useState("")+ const { attachments, handleImageUploaded, getImageSrc, clearAttachments } = useAttachments({+ cacheKey: CACHE_KEYS.ATTACHMENT,+ useLocalStorage: true,+ maxAttachments: 3,+ })+ const [tags, setTags] = useState(getTagsCachedValue())+ const [error, setError] = useState<Failure | undefined>(undefined)+ const titleRef = useRef<HTMLInputElement>()+ const editorRef = useRef<HTMLDivElement>(null)+ const [titleManuallyEdited, setTitleManuallyEdited] = useState(getTitleManuallyEditedValue())+ const [isInitialMount, setIsInitialMount] = useState(true)++ useEffect(() => {+ setIsInitialMount(false)+ }, [])++ // Handle browser back button+ useEffect(() => {+ if (isOpen) {+ // Push a new state when modal opens+ window.history.pushState({ modalOpen: true }, "", window.location.href)++ const handlePopState = () => {+ // If we're going back and the modal is open, close it+ if (isOpen) {+ onClose()+ }+ }++ window.addEventListener("popstate", handlePopState)++ return () => {+ window.removeEventListener("popstate", handlePopState)+ }+ }+ }, [isOpen, onClose])++ // Handle modal close - go back in history if we pushed a state+ const handleClose = () => {+ // Check if we can go back (and if the previous state was pushed by us)+ if (window.history.state?.modalOpen) {+ window.history.back()+ } else {+ onClose()+ }+ }++ useEffect(() => {+ if (!titleManuallyEdited && !isInitialMount) {+ // Use plain text for title generation if available, otherwise fall back to description+ const textToUse = descriptionPlainText || description++ let newlineIndex = Math.min(textToUse.indexOf("\n"), 80)+ if (newlineIndex == -1) {+ newlineIndex = 80+ }+ const autoTitle = textToUse.substring(0, newlineIndex)+ handleTitleChange(autoTitle, false)+ }+ }, [description, descriptionPlainText, titleManuallyEdited])++ useEffect(() => {+ if (isOpen && editorRef.current) {+ // Small delay to ensure modal is fully rendered+ setTimeout(() => {+ // Focus the editor+ const editorContent = editorRef.current?.querySelector(".ProseMirror")+ if (editorContent) {+ ;(editorContent as HTMLElement).focus()+ }+ }, 100)+ }+ }, [isOpen])++ // Handlers for post input changes+ const handleTitleChange = (value: string, isManualEdit = true) => {+ setTitle(value)+ setCachedTitle(value)+ // If this is a manual edit (not auto-generated from description),+ // mark the title as manually edited so we stop auto-populating+ if (isManualEdit) {+ setTitleManuallyEdited(true)+ }+ }++ const handleTagsChanged = (newTags: Tag[]) => {+ setCachedTags(newTags.map((tag) => tag.slug))+ setTags(newTags)+ }++ const handleDescriptionChange = (value: string, plainText?: string) => {+ setCachedDescription(value)+ setDescription(value)++ // Store plain text version if provided+ if (plainText !== undefined) {+ setDescriptionPlainText(plainText)+ }+ }++ const onSubmitFeedback = () => {+ setPostPending(true)+ }++ const clearError = () => setError(undefined)++ const finaliseFeedback = async () => {+ if (title) {+ const minDelay = new Promise((resolve) => setTimeout(resolve, 1000))++ const [result] = await Promise.all([+ actions.createPost(+ title,+ description,+ attachments,+ tags.map((tag) => tag.slug)+ ),+ minDelay,+ ])++ if (result.ok) {+ clearError()+ clearCache()+ clearAttachments()+ setPostCreated()+ location.href = `/posts/${result.data.number}/${result.data.slug}`+ } else if (result.error) {+ setError(result.error)+ }+ }+ }++ const onEmailSent = (email: string) => {+ window.location.href = "/loginemailsent?email=" + encodeURIComponent(email)+ }++ const handleEditorFocus = () => {+ // This function is called when the editor is focused+ // We don't need to do anything special here+ }++ return (+ <Modal.Window className="c-share-feedback" isOpen={isOpen} onClose={handleClose} size="fullscreen" center={false}>+ <Modal.Header>+ <div className="flex flex-items-center justify-end">+ <CloseIcon closeModal={handleClose} />+ </div>+ </Modal.Header>+ <Modal.Content>+ <div className="c-share-feedback__content mb-4">+ <h1 className="text-large pb-6">+ <Trans id="newpost.modal.title">Share your idea...</Trans>+ </h1>+ <div className="c-share-feedback-form">+ <Form error={error}>+ <div ref={editorRef} className="mb-4">+ <CommentEditor+ field="description"+ onChange={handleDescriptionChange}+ onFocus={handleEditorFocus}+ initialValue={description}+ disabled={false}+ maxAttachments={3}+ maxImageSizeKB={5 * 1024}+ placeholder={i18n._({+ id: "newpost.modal.description.placeholder",+ message: "Tell us about it. Explain it fully, don't hold back, the more information the better.",+ })}+ onImageUploaded={handleImageUploaded}+ onGetImageSrc={getImageSrc}+ />+ </div>+ <SimilarPosts title={title} tags={props.tags} />+ <Input+ field="title"+ inputRef={titleRef}+ maxLength={255}+ label={i18n._({ id: "newpost.modal.title.label", message: "Give your idea a title" })}+ value={title}+ onChange={handleTitleChange}+ placeholder={i18n._({ id: "newpost.modal.title.placeholder", message: "Something short and snappy, sum it up in a few words" })}+ />+ {canEditTags && (+ <div className="c-form-field">+ <label>+ <Trans id="label.tags">Tags</Trans>+ </label>+ <div className={classSet({ "c-form-field": true })}>+ <TagsSelect tags={props.tags} selectionChanged={handleTagsChanged} selected={tags} alwaysEditing={true} canEdit={true} />+ </div>+ </div>+ )}+ </Form>+ </div>+ </div>+ {/* For unauthenticated users, always show the sign-in control */}+ {!fider.session.isAuthenticated ? (+ <div className="c-share-feedback__content">+ <div className="c-share-feedback-signin">+ <h2 className="text-title text-center mb-4">+ <Trans id="newpost.modal.submit">Submit your idea</Trans>+ </h2>+ <SignInControl+ onSubmit={onSubmitFeedback}+ onEmailSent={onEmailSent}+ signInButtonText={i18n._({ id: "signin.message.email", message: "Continue with Email" })}+ useEmail={true}+ redirectTo={fider.settings.baseURL}+ />+ </div>+ </div>+ ) : (+ /* For authenticated users, only show the submit button container when title is long enough */+ title.length > 9 && (+ <div className="c-share-feedback__content animate-fade-in">+ <div className="c-share-feedback-signin">+ <div className="flex justify-center">+ <Button variant="primary" onClick={finaliseFeedback}>+ <Trans id="newpost.modal.submit">Submit your idea</Trans>+ </Button>+ </div>+ </div>+ </div>+ )+ )}+ {!fider.session.isAuthenticated ? <LegalFooter /> : null}+ </Modal.Content>+ </Modal.Window>+ )+}diff --git a/public/pages/Home/components/SimilarPosts.scss b/public/pages/Home/components/SimilarPosts.scssnew file mode 100644index 000000000..0d6d9578e--- /dev/null+++ b/public/pages/Home/components/SimilarPosts.scss@@ -0,0 +1,13 @@+.similar-posts-container {+ transition: max-height 0.5s ease-in-out;+}++.similar-posts-hidden {+ max-height: 0;+ // opacity: 0;+}++.similar-posts-visible {+ max-height: 100vh;+ // opacity: 1;+}diff --git a/public/pages/Home/components/SimilarPosts.tsx b/public/pages/Home/components/SimilarPosts.tsxindex 62e42572a..7b3650fee 100644--- a/public/pages/Home/components/SimilarPosts.tsx+++ b/public/pages/Home/components/SimilarPosts.tsx@@ -1,75 +1,92 @@-import React from "react"+import React, { useState, useEffect, useRef } from "react"import { Post, Tag, CurrentUser } from "@fider/models"-import { PageTitle, Loader } from "@fider/components"import { ListPosts } from "./ListPosts"import { actions } from "@fider/services"import { i18n } from "@lingui/core"+import "./SimilarPosts.scss"+interface SimilarPostsProps {title: stringtags: Tag[]user?: CurrentUser}-interface SimilarPostsState {- title: string- posts: Post[]- loading: boolean-}+export const SimilarPosts: React.FC<SimilarPostsProps> = (props) => {+ const [title, setTitle] = useState(props.title)+ const [posts, setPosts] = useState<Post[]>([])+ const [loading, setLoading] = useState(true)+ const [isVisible, setIsVisible] = useState(false)+ const timerRef = useRef<number>()++ useEffect(() => {+ loadSimilarPosts()-export class SimilarPosts extends React.Component<SimilarPostsProps, SimilarPostsState> {- constructor(props: SimilarPostsProps) {- super(props)- this.state = {- title: props.title,- loading: !!props.title,- posts: [],+ return () => {+ window.clearTimeout(timerRef.current)}- }+ }, [])- public static getDerivedStateFromProps(nextProps: SimilarPostsProps, prevState: SimilarPostsState) {- if (nextProps.title !== prevState.title) {- return {- loading: true,- title: nextProps.title,- }+ useEffect(() => {+ if (props.title !== title) {+ setTitle(props.title)+ setLoading(true)}- return null- }- public componentDidMount() {- this.loadSimilarPosts()- }+ }, [props.title])++ useEffect(() => {+ window.clearTimeout(timerRef.current)+ timerRef.current = window.setTimeout(loadSimilarPosts, 500)++ return () => {+ window.clearTimeout(timerRef.current)+ }+ }, [title])- private timer?: number- public componentDidUpdate() {- window.clearTimeout(this.timer)- this.timer = window.setTimeout(this.loadSimilarPosts, 500)+ const preprocessSearchQuery = (query: string) => {+ const noiseWords = ["add", "support", "for", "implement", "create", "make", "allow", "enable", "provide"]+ return query+ .split(" ")+ .filter((x) => !noiseWords.includes(x))+ .join(" ")}- private loadSimilarPosts = () => {- if (this.state.loading) {- actions.searchPosts({ query: this.state.title }).then((x) => {- if (x.ok) {- this.setState({ loading: false, posts: x.data })+ const loadSimilarPosts = () => {+ if (loading) {+ if (title.length < 2) {+ setLoading(false)+ setIsVisible(false)+ } else {+ const query = preprocessSearchQuery(title)+ if (query.length < 2) {+ setLoading(false)+ setIsVisible(false)+ return}- })+ actions.findSimilarPosts(query).then((x) => {+ if (x.ok) {+ setLoading(false)+ setIsVisible(x.data.length > 0)+ setPosts(x.data)+ }+ })+ }}}- public render() {- const title = i18n._("home.similar.title", { message: "Similar posts" })- const subtitle = i18n._("home.similar.subtitle", { message: "Consider voting on existing posts instead." })+ const title_text = i18n._({ id: "home.similar.title", message: "We have similar posts, is your idea already on the list?" })- return (- <>- <PageTitle title={title} subtitle={subtitle} />- {this.state.loading ? (- <Loader />- ) : (- <ListPosts posts={this.state.posts} tags={this.props.tags} emptyText={`No similar posts matched '${this.props.title}'.`} />- )}- </>- )- }+ const animationClass = isVisible ? "similar-posts-visible" : "similar-posts-hidden"++ return (+ <>+ <div className={`similar-posts-container overflow-auto ${animationClass}`}>+ <div className="mb-4 text-gray-700">{title_text}</div>+ <div className="mb-6">+ <ListPosts posts={posts} tags={props.tags} emptyText="" minimalView={true} />+ </div>+ </div>+ </>+ )}diff --git a/public/pages/MyNotifications/MyNotifications.page.tsx b/public/pages/MyNotifications/MyNotifications.page.tsxindex 88096026c..0bba70dbd 100644--- a/public/pages/MyNotifications/MyNotifications.page.tsx+++ b/public/pages/MyNotifications/MyNotifications.page.tsx@@ -64,8 +64,8 @@ export default class MyNotificationsPage extends React.Component<MyNotifications<Header /><div id="p-my-notifications" className="page container"><PageTitle- title={i18n._("mynotifications.page.title", { message: "Notifications" })}- subtitle={i18n._("mynotifications.page.subtitle", { message: "Stay up to date with what's happening" })}+ title={i18n._({ id: "mynotifications.page.title", message: "Notifications" })}+ subtitle={i18n._({ id: "mynotifications.page.subtitle", message: "Stay up to date with what's happening" })}/><HStack spacing={4} className="mt-8 mb-2">diff --git a/public/pages/MySettings/MySettings.page.tsx b/public/pages/MySettings/MySettings.page.tsxindex b272de4c2..aa273e47a 100644--- a/public/pages/MySettings/MySettings.page.tsx+++ b/public/pages/MySettings/MySettings.page.tsx@@ -135,14 +135,14 @@ export default class MySettingsPage extends React.Component<MySettingsPageProps,</Modal.Window><PageTitle- title={i18n._("mysettings.page.title", { message: "Settings" })}- subtitle={i18n._("mysettings.page.subtitle", { message: "Manage your profile settings" })}+ title={i18n._({ id: "mysettings.page.title", message: "Settings" })}+ subtitle={i18n._({ id: "mysettings.page.subtitle", message: "Manage your profile settings" })}/><div className="w-max-7xl"><Form error={this.state.error}><Input- label={i18n._("label.email", { message: "Email" })}+ label={i18n._({ id: "label.email", message: "Email" })}field="email"value={this.state.changingEmail ? this.state.newEmail : Fider.session.user.email}maxLength={200}@@ -169,16 +169,16 @@ export default class MySettingsPage extends React.Component<MySettingsPageProps,)}</Input>- <Input label={i18n._("label.name", { message: "Name" })} field="name" value={this.state.name} maxLength={100} onChange={this.setName} />+ <Input label={i18n._({ id: "label.name", message: "Name" })} field="name" value={this.state.name} maxLength={100} onChange={this.setName} /><Select- label={i18n._("label.avatar", { message: "Avatar" })}+ label={i18n._({ id: "label.avatar", message: "Avatar" })}field="avatarType"defaultValue={this.state.avatarType}options={[- { label: i18n._("label.letter", { message: "Letter" }), value: UserAvatarType.Letter },- { label: i18n._("label.gravatar", { message: "Gravatar" }), value: UserAvatarType.Gravatar },- { label: i18n._("label.custom", { message: "Custom" }), value: UserAvatarType.Custom },+ { label: i18n._({ id: "label.letter", message: "Letter" }), value: UserAvatarType.Letter },+ { label: i18n._({ id: "label.gravatar", message: "Gravatar" }), value: UserAvatarType.Gravatar },+ { label: i18n._({ id: "label.custom", message: "Custom" }), value: UserAvatarType.Custom },]}onChange={this.avatarTypeChanged}>diff --git a/public/pages/MySettings/components/NotificationSettings.tsx b/public/pages/MySettings/components/NotificationSettings.tsxindex c31c9c2c6..a70722c8d 100644--- a/public/pages/MySettings/components/NotificationSettings.tsx+++ b/public/pages/MySettings/components/NotificationSettings.tsx@@ -34,8 +34,8 @@ export const NotificationSettings = (props: NotificationSettingsProps) => {props.settingsChanged(nextSettings)}- const labelWeb = i18n._("mysettings.notification.channelweb", { message: "Web" })- const labelEmail = i18n._("mysettings.notification.channelemail", { message: "Email" })+ const labelWeb = i18n._({ id: "mysettings.notification.channelweb", message: "Web" })+ const labelEmail = i18n._({ id: "mysettings.notification.channelemail", message: "Email" })const icon = (settingsKey: string, channel: Channel) => {const active = isEnabled(settingsKey, channel)@@ -46,9 +46,9 @@ export const NotificationSettings = (props: NotificationSettingsProps) => {return (<>- <Field label={i18n._("label.notifications", { message: "Notifications" })}>+ <Field label={i18n._({ id: "label.notifications", message: "Notifications" })}><p className="text-muted mb-6">- <Trans id="mysettings.notification.title">Choose the events to recieve a notification for.</Trans>+ <Trans id="mysettings.notification.title">Choose the events to receive a notification for.</Trans></p><div className="notifications-settings mt-4">diff --git a/public/pages/ShowPost/ShowPost.page.tsx b/public/pages/ShowPost/ShowPost.page.tsxindex fe9faaf2f..90cec7f30 100644--- a/public/pages/ShowPost/ShowPost.page.tsx+++ b/public/pages/ShowPost/ShowPost.page.tsx@@ -2,29 +2,18 @@ import "./ShowPost.page.scss"import React, { useState, useEffect, useCallback } from "react"-import { Comment, Post, Tag, Vote, ImageUpload, CurrentUser, PostStatus } from "@fider/models"-import { actions, clearUrlHash, Failure, Fider, notify, timeAgo } from "@fider/services"+import { Comment, Post, Tag, Vote, CurrentUser, PostStatus } from "@fider/models"+import { actions, cache, clearUrlHash, Failure, Fider, notify, timeAgo } from "@fider/services"import IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.svg"-import IconRss from "@fider/assets/images/heroicons-rss.svg"+import IconDuplicate from "@fider/assets/images/heroicons-duplicate.svg"+import { i18n } from "@lingui/core"+import IconRSS from "@fider/assets/images/heroicons-rss.svg"+import IconPencil from "@fider/assets/images/heroicons-pencil-alt.svg"+import IconChat from "@fider/assets/images/heroicons-chat-alt-2.svg"-import {- ResponseDetails,- Button,- UserName,- Moment,- Markdown,- Input,- Form,- TextArea,- MultiImageUploader,- ImageViewer,- Icon,- Header,- PoweredByFider,- Avatar,- Dropdown,-} from "@fider/components"+import { ResponseDetails, Button, UserName, Moment, Markdown, Input, Form, Icon, Header, PoweredByFider, Avatar, Dropdown, RSSModal } from "@fider/components"import { DiscussionPanel } from "./components/DiscussionPanel"+import CommentEditor from "@fider/components/common/form/CommentEditor"import IconX from "@fider/assets/images/heroicons-x.svg"import IconThumbsUp from "@fider/assets/images/heroicons-thumbsup.svg"@@ -36,6 +25,9 @@ import { DeletePostModal } from "./components/DeletePostModal"import { ResponseModal } from "./components/ResponseModal"import { VotesPanel } from "./components/VotesPanel"import { TagsPanel } from "@fider/pages/ShowPost/components/TagsPanel"+import { t } from "@lingui/macro"+import { useFider } from "@fider/hooks"+import { useAttachments } from "@fider/hooks/useAttachments"interface ShowPostPageProps {post: Post@@ -58,12 +50,16 @@ const canEditPost = (user: CurrentUser, post: Post) => {export default function ShowPostPage(props: ShowPostPageProps) {const [editMode, setEditMode] = useState(false)const [showDeleteModal, setShowDeleteModal] = useState(false)+ const [isRSSModalOpen, setIsRSSModalOpen] = useState(false)const [showResponseModal, setShowResponseModal] = useState(false)const [newTitle, setNewTitle] = useState(props.post.title)const [newDescription, setNewDescription] = useState(props.post.description)- const [attachments, setAttachments] = useState<ImageUpload[]>([])+ const { attachments, handleImageUploaded, getImageSrc } = useAttachments({+ maxAttachments: 3,+ })const [highlightedComment, setHighlightedComment] = useState<number | undefined>(undefined)const [error, setError] = useState<Failure | undefined>(undefined)+ const fider = useFider()const handleHashChange = useCallback((e?: Event) => {@@ -103,6 +99,15 @@ export default function ShowPostPage(props: ShowPostPageProps) {}}, [handleHashChange])+ useEffect(() => {+ const showSuccess = cache.session.get("POST_CREATED_SUCCESS")+ if (showSuccess) {+ cache.session.remove("POST_CREATED_SUCCESS")+ // Show success message/toast+ notify.success(t({ id: "mysettings.notification.event.newpostcreated", message: "Your idea has been added 👍" }))+ }+ }, [])+const saveChanges = async () => {const result = await actions.updatePost(props.post.number, newTitle, newDescription, attachments)if (result.ok) {@@ -129,7 +134,11 @@ export default function ShowPostPage(props: ShowPostPageProps) {setEditMode(true)}- const onActionSelected = (action: "copy" | "delete" | "status" | "edit") => () => {+ const handleDescriptionChange = (value: string) => {+ setNewDescription(value)+ }++ const onActionSelected = (action: "copy" | "delete" | "status" | "feed" | "edit") => () => {if (action === "copy") {navigator.clipboard.writeText(window.location.href)notify.success(<Trans id="showpost.copylink.success">Link copied to clipboard</Trans>)@@ -139,9 +148,13 @@ export default function ShowPostPage(props: ShowPostPageProps) {setShowResponseModal(true)} else if (action === "edit") {startEdit()+ } else if (action == "feed") {+ setIsRSSModalOpen(true)}}+ const hideRSSModal = () => setIsRSSModalOpen(false)+return (<><Header />@@ -162,32 +175,33 @@ export default function ShowPostPage(props: ShowPostPageProps) {</HStack>)}</VStack>+ <RSSModal isOpen={isRSSModalOpen} onClose={hideRSSModal} url={`${fider.settings.baseURL}/feed/posts/${props.post.number}.atom`} />{!editMode && (<HStack>- {Fider.session.tenant.isFeedEnabled && (- <a title="ATOM Feed (Comments)" type="application/atom+xml" href={`/feed/posts/${props.post.id}.atom`}>- <Icon sprite={IconRss} width="24" height="24" />- </a>- )}<Dropdown position="left" renderHandle={<Icon sprite={IconDotsHorizontal} width="24" height="24" />}>- <Dropdown.ListItem onClick={onActionSelected("copy")}>+ <Dropdown.ListItem onClick={onActionSelected("copy")} icon={IconDuplicate}><Trans id="action.copylink">Copy link</Trans></Dropdown.ListItem>+ {Fider.session.tenant.isFeedEnabled && (+ <Dropdown.ListItem onClick={onActionSelected("feed")} icon={IconRSS}>+ <Trans id="action.commentsfeed">Comment Feed</Trans>+ </Dropdown.ListItem>+ )}{Fider.session.isAuthenticated && canEditPost(Fider.session.user, props.post) && (<>- <Dropdown.ListItem onClick={onActionSelected("edit")}>+ <Dropdown.ListItem onClick={onActionSelected("edit")} icon={IconPencil}><Trans id="action.edit">Edit</Trans></Dropdown.ListItem>{Fider.session.user.isCollaborator && (- <Dropdown.ListItem onClick={onActionSelected("status")}>+ <Dropdown.ListItem onClick={onActionSelected("status")} icon={IconChat}><Trans id="action.respond">Respond</Trans></Dropdown.ListItem>)}</>)}{canDeletePost() && (- <Dropdown.ListItem onClick={onActionSelected("delete")} className="text-red-700">+ <Dropdown.ListItem onClick={onActionSelected("delete")} className="text-red-700" icon={IconX}><Trans id="action.delete">Delete</Trans></Dropdown.ListItem>)}@@ -215,8 +229,20 @@ export default function ShowPostPage(props: ShowPostPageProps) {<VStack>{editMode ? (<Form error={error}>- <TextArea field="description" value={newDescription} onChange={setNewDescription} />- <MultiImageUploader field="attachments" bkeys={props.attachments} maxUploads={3} onChange={setAttachments} />+ <CommentEditor+ field="description"+ onChange={handleDescriptionChange}+ initialValue={newDescription}+ disabled={false}+ maxAttachments={3}+ maxImageSizeKB={5 * 1024}+ placeholder={i18n._({+ id: "newpost.modal.description.placeholder",+ message: "Tell us about it. Explain it fully, don't hold back, the more information the better.",+ })}+ onImageUploaded={handleImageUploaded}+ onGetImageSrc={getImageSrc}+ /></Form>) : (<>@@ -226,9 +252,6 @@ export default function ShowPostPage(props: ShowPostPageProps) {<Trans id="showpost.message.nodescription">No description provided.</Trans></em>)}- {props.attachments.map((x) => (- <ImageViewer key={x} bkey={x} />- ))}</>)}</VStack>diff --git a/public/pages/ShowPost/components/CommentInput.tsx b/public/pages/ShowPost/components/CommentInput.tsxindex 76a0a3d25..3549bc945 100644--- a/public/pages/ShowPost/components/CommentInput.tsx+++ b/public/pages/ShowPost/components/CommentInput.tsx@@ -1,7 +1,7 @@import React, { useCallback, useState, useEffect } from "react"-import { Post, ImageUpload } from "@fider/models"-import { Avatar, UserName, Button, Form, MultiImageUploader } from "@fider/components"+import { Post } from "@fider/models"+import { Avatar, UserName, Button, Form } from "@fider/components"import { SignInModal } from "@fider/components"import { cache, actions, Failure, Fider } from "@fider/services"@@ -9,32 +9,35 @@ import { HStack } from "@fider/components/layout"import { i18n } from "@lingui/core"import { Trans } from "@lingui/react/macro"-// import { CommentEditor } from "@fider/components"import { useFider } from "@fider/hooks"-// import Tiptap from "@fider/components/common/form/CommentEditor2"+import { useAttachments } from "@fider/hooks/useAttachments"import CommentEditor from "@fider/components/common/form/CommentEditor"interface CommentInputProps {post: Post}-const CACHE_TITLE_KEY = "CommentInput-Comment-"+const CACHE_TITLE_KEY = "CommentInput-Comment-Title-"+const CACHE_ATTACHMENTS_KEY = "CommentInput-Comment-Attachments-"export const CommentInput = (props: CommentInputProps) => {- const getCacheKey = () => `${CACHE_TITLE_KEY}${props.post.id}`+ const getCacheKey = (cachePrefix: string) => `${cachePrefix}${props.post.id}`const getContentFromCache = () => {- return cache.session.get(getCacheKey())+ return cache.session.get(getCacheKey(CACHE_TITLE_KEY))}const fider = useFider()- // const inputRef = useRef<HTMLTextAreaElement>()- // const [content, setContent] = useState<string>((fider.session.isAuthenticated && getContentFromCache()) || "")const [isSignInModalOpen, setIsSignInModalOpen] = useState(false)- const [attachments, setAttachments] = useState<ImageUpload[]>([])const [error, setError] = useState<Failure | undefined>(undefined)const [isClient, setIsClient] = useState(false)+ // Use the attachments hook+ const { attachments, handleImageUploaded, getImageSrc, clearAttachments } = useAttachments({+ cacheKey: getCacheKey(CACHE_ATTACHMENTS_KEY),+ maxAttachments: 2,+ })+// Check if we're running on the client after component mountsuseEffect(() => {setIsClient(true)@@ -46,12 +49,12 @@ export const CommentInput = (props: CommentInputProps) => {const submit = async () => {clearError()- // Since the comment is being cached, we can save the content that's in the cacheconst content = getContentFromCache()const result = await actions.createComment(props.post.number, content || "", attachments)if (result.ok) {- cache.session.remove(getCacheKey())+ clearAttachments()+ cache.session.remove(getCacheKey(CACHE_TITLE_KEY))location.reload()} else {setError(result.error)@@ -67,7 +70,7 @@ export const CommentInput = (props: CommentInputProps) => {const hasContent = trueconst commentChanged = useCallback((value: string): void => {- cache.session.set(getCacheKey(), value)+ cache.session.set(getCacheKey(CACHE_TITLE_KEY), value)}, [])return (@@ -83,7 +86,6 @@ export const CommentInput = (props: CommentInputProps) => {</div>)}- {/* Only render interactive components on the client side */}{isClient ? (<><CommentEditor@@ -92,21 +94,23 @@ export const CommentInput = (props: CommentInputProps) => {onChange={commentChanged}onFocus={editorFocused}initialValue={getContentFromCache()}- placeholder={i18n._("showpost.commentinput.placeholder", { message: "Leave a comment" })}+ placeholder={i18n._({ id: "showpost.commentinput.placeholder", message: "Leave a comment" })}+ maxAttachments={2}+ maxImageSizeKB={5 * 1024}+ onGetImageSrc={getImageSrc}+ onImageUploaded={handleImageUploaded}/>{hasContent && (<>- <MultiImageUploader field="attachments" maxUploads={2} onChange={setAttachments} />- <Button variant="primary" onClick={submit}>+ <Button variant="primary" onClick={submit} className="mt-2"><Trans id="action.submit">Submit</Trans></Button></>)}</>) : (- // Simple placeholder for SSR- <div className="comment-input-placeholder p-2">{i18n._("showpost.commentinput.placeholder", { message: "Leave a comment" })}</div>+ <div className="comment-input-placeholder p-2">{i18n._({ id: "showpost.commentinput.placeholder", message: "Leave a comment" })}</div>)}</Form></div>diff --git a/public/pages/ShowPost/components/DeletePostModal.tsx b/public/pages/ShowPost/components/DeletePostModal.tsxindex f7817d08a..dffab49d0 100644--- a/public/pages/ShowPost/components/DeletePostModal.tsx+++ b/public/pages/ShowPost/components/DeletePostModal.tsx@@ -40,7 +40,7 @@ export const DeletePostModal = (props: DeletePostModalProps) => {field="text"onChange={setText}value={text}- placeholder={i18n._("showpost.moderationpanel.text.placeholder", { message: "Why are you deleting this post? (optional)" })}+ placeholder={i18n._({ id: "showpost.moderationpanel.text.placeholder", message: "Why are you deleting this post? (optional)" })}><span className="text-muted"><Trans id="showpost.moderationpanel.text.help">diff --git a/public/pages/ShowPost/components/PostSearch.tsx b/public/pages/ShowPost/components/PostSearch.tsxindex 00509ef9a..fb711410b 100644--- a/public/pages/ShowPost/components/PostSearch.tsx+++ b/public/pages/ShowPost/components/PostSearch.tsx@@ -47,7 +47,7 @@ export const PostSearch = (props: PostSearchProps) => {<Inputfield="query"icon={IconSearch}- placeholder={i18n._("showpost.postsearch.query.placeholder", { message: "Search original post..." })}+ placeholder={i18n._({ id: "showpost.postsearch.query.placeholder", message: "Search original post..." })}value={query}onChange={setQuery}/>diff --git a/public/pages/ShowPost/components/ResponseModal.tsx b/public/pages/ShowPost/components/ResponseModal.tsxindex 79287f1dc..7e949ebfa 100644--- a/public/pages/ShowPost/components/ResponseModal.tsx+++ b/public/pages/ShowPost/components/ResponseModal.tsx@@ -87,7 +87,8 @@ export class ResponseModal extends React.Component<ResponseModalProps, ResponseMonChange={this.setText}value={this.state.text}minRows={5}- placeholder={i18n._("showpost.responseform.text.placeholder", {+ placeholder={i18n._({+ id: "showpost.responseform.text.placeholder",message: "What's going on with this post? Let your users know what are your plans...",})}/>diff --git a/public/pages/ShowPost/components/ShowComment.tsx b/public/pages/ShowPost/components/ShowComment.tsxindex 5d0135d3f..fb090f084 100644--- a/public/pages/ShowPost/components/ShowComment.tsx+++ b/public/pages/ShowPost/components/ShowComment.tsx@@ -1,6 +1,6 @@import React, { useEffect, useRef, useState } from "react"-import { Comment, Post, ImageUpload } from "@fider/models"-import { Reactions, Avatar, UserName, Moment, Form, Button, Markdown, Modal, ImageViewer, MultiImageUploader, Dropdown, Icon } from "@fider/components"+import { Comment, Post } from "@fider/models"+import { Reactions, Avatar, UserName, Moment, Form, Button, Markdown, Modal, Dropdown, Icon } from "@fider/components"import { HStack } from "@fider/components/layout"import { formatDate, Failure, actions, notify, copyToClipboard, classSet, clearUrlHash } from "@fider/services"import { useFider } from "@fider/hooks"@@ -8,6 +8,7 @@ import IconDotsHorizontal from "@fider/assets/images/heroicons-dots-horizontal.simport { t } from "@lingui/core/macro"import { Trans } from "@lingui/react/macro"import CommentEditor from "@fider/components/common/form/CommentEditor"+import { useAttachments } from "@fider/hooks/useAttachments"import "./ShowComment.scss"@@ -24,7 +25,9 @@ export const ShowComment = (props: ShowCommentProps) => {const [isEditing, setIsEditing] = useState(false)const [newContent, setNewContent] = useState<string>(props.comment.content)const [isDeleteConfirmationModalOpen, setIsDeleteConfirmationModalOpen] = useState(false)- const [attachments, setAttachments] = useState<ImageUpload[]>([])+ const { attachments, handleImageUploaded, getImageSrc } = useAttachments({+ maxAttachments: 2,+ })const [localReactionCounts, setLocalReactionCounts] = useState(props.comment.reactionCounts)const emojiSelectorRef = useRef<HTMLDivElement>(null)@@ -205,19 +208,23 @@ export const ShowComment = (props: ShowCommentProps) => {initialValue={newContent}onChange={setNewContent}placeholder={comment.content}+ maxAttachments={2}+ maxImageSizeKB={5 * 1024}+ onGetImageSrc={getImageSrc}+ onImageUploaded={handleImageUploaded}/>- <MultiImageUploader field="attachments" bkeys={comment.attachments} maxUploads={2} onChange={setAttachments} />- <Button size="small" onClick={saveEdit} variant="primary">- <Trans id="action.save">Save</Trans>- </Button>- <Button variant="tertiary" size="small" onClick={cancelEdit}>- <Trans id="action.cancel">Cancel</Trans>- </Button>+ <div className="mt-2">+ <Button size="small" onClick={saveEdit} variant="primary">+ <Trans id="action.save">Save</Trans>+ </Button>+ <Button variant="tertiary" size="small" onClick={cancelEdit}>+ <Trans id="action.cancel">Cancel</Trans>+ </Button>+ </div></Form>) : (<><Markdown text={comment.content} style="full" />- {comment.attachments && comment.attachments.map((x) => <ImageViewer key={x} bkey={x} />)}<Reactions reactions={localReactionCounts} emojiSelectorRef={emojiSelectorRef} toggleReaction={toggleReaction} /></>)}diff --git a/public/pages/ShowPost/components/VotesModal.tsx b/public/pages/ShowPost/components/VotesModal.tsxindex 0944ea1d7..2ce92b7c7 100644--- a/public/pages/ShowPost/components/VotesModal.tsx+++ b/public/pages/ShowPost/components/VotesModal.tsx@@ -61,7 +61,7 @@ export const VotesModal: React.FC<VotesModalProps> = (props) => {field="query"icon={query ? IconX : IconSearch}onIconClick={query ? clearSearch : undefined}- placeholder={i18n._("modal.showvotes.query.placeholder", { message: "Search for users by name..." })}+ placeholder={i18n._({ id: "modal.showvotes.query.placeholder", message: "Search for users by name..." })}value={query}onChange={handleSearchFilterChanged}/>diff --git a/public/pages/SignIn/CompleteSignInProfile.page.tsx b/public/pages/SignIn/CompleteSignInProfile.page.tsxindex db91e830a..5db053e79 100644--- a/public/pages/SignIn/CompleteSignInProfile.page.tsx+++ b/public/pages/SignIn/CompleteSignInProfile.page.tsx@@ -1,6 +1,6 @@import React, { useState } from "react"-import { Button, Form, Input, LegalFooter, TenantLogo } from "@fider/components"+import { Button, Form, Input, TenantLogo } from "@fider/components"import { actions, Failure } from "@fider/services"import { i18n } from "@lingui/core"import { Trans } from "@lingui/react/macro"@@ -12,6 +12,7 @@ import "./CompleteSignInProfile.page.scss"interface CompleteSignInProfilePageProps {kind: EmailVerificationKindk: string+ c?: string}const CompleteSignInProfilePage = (props: CompleteSignInProfilePageProps) => {@@ -21,7 +22,11 @@ const CompleteSignInProfilePage = (props: CompleteSignInProfilePageProps) => {const submit = async () => {const result = await actions.completeProfile(props.kind, props.k, name)if (result.ok) {- location.href = "/"+ if (props.c !== undefined) {+ location.href = "/?c=" + props.c+ } else {+ location.href = "/"+ }} else if (result.error) {setError(result.error)}@@ -29,34 +34,36 @@ const CompleteSignInProfilePage = (props: CompleteSignInProfilePageProps) => {return (<>- <div id="p-complete-profile" className="page container w-max-6xl">- <div>- <div className="h-20 text-center mb-4">- <TenantLogo size={100} />+ <div id="p-complete-profile" className="page container w-max-6xl bg-gray-100">+ <div className="flex flex-y justify-center full-height py-4">+ <div className="text-center mb-8">+ <a href="/">+ <TenantLogo size={50} />+ </a></div>- <p className="text-title">- <Trans id="modal.completeprofile.header">Complete your profile</Trans>- </p>+ <div className="box shadow-sm text-center w-full">+ <p className="text-title text-center">+ <Trans id="modal.completeprofile.header">Complete your profile</Trans>+ </p>- <p>- <Trans id="modal.completeprofile.text">Because this is your first sign in, please enter your name.</Trans>- </p>- <Form error={error}>- <Input- field="name"- onChange={setName}- maxLength={100}- placeholder={i18n._("modal.completeprofile.name.placeholder", { message: "Name" })}- suffix={- <Button type="submit" onClick={submit} variant="primary" disabled={name === ""}>- <Trans id="action.submit">Submit</Trans>- </Button>- }- />- </Form>-- <LegalFooter />+ <p>+ <Trans id="modal.completeprofile.text">Because this is your first sign in, please enter your name.</Trans>+ </p>+ <Form error={error} className="mb-4">+ <Input+ field="name"+ onChange={setName}+ maxLength={100}+ placeholder={i18n._({ id: "modal.completeprofile.name.placeholder", message: "Name" })}+ suffix={+ <Button type="submit" onClick={submit} variant="primary" disabled={name === ""}>+ <Trans id="action.submit">Submit</Trans>+ </Button>+ }+ />+ </Form>+ </div></div></div></>diff --git a/public/pages/SignIn/LoginEmailSent.page.scss b/public/pages/SignIn/LoginEmailSent.page.scssnew file mode 100644index 000000000..17a361eed--- /dev/null+++ b/public/pages/SignIn/LoginEmailSent.page.scss@@ -0,0 +1,5 @@+#p-email-sent {+ .full-height {+ min-height: 100vh;+ }+}diff --git a/public/pages/SignIn/LoginEmailSent.page.tsx b/public/pages/SignIn/LoginEmailSent.page.tsxnew file mode 100644index 000000000..42d6e0298--- /dev/null+++ b/public/pages/SignIn/LoginEmailSent.page.tsx@@ -0,0 +1,36 @@+import React from "react"+import MailSentIllustration from "@fider/assets/images/undraw_mail-sent.svg"++import { LegalFooter, TenantLogo, Icon } from "@fider/components"+import { Trans } from "@lingui/react/macro"++import "./LoginEmailSent.page.scss"++const LoginEmailSentPage = ({ email }: { email: string }) => {+ return (+ <>+ <div id="p-email-sent" className="page container w-max-6xl bg-gray-100">+ <div className="flex flex-y justify-center flex-items-center full-height py-4">+ <div className="text-center mb-8">+ <a href="/">+ <TenantLogo size={50} />+ </a>+ </div>++ <div className="box shadow-sm text-center w-full">+ <Icon sprite={MailSentIllustration} height="120" className="mb-4" />++ <p className="text-xl text-center mb-4 text-gray-800">+ <Trans id="signin.message.emailsent">+ We have just sent a confirmation link to <b>{email}</b>. Click the link and you’ll be signed in.+ </Trans>+ </p>++ <LegalFooter />+ </div>+ </div>+ </div>+ </>+ )+}+export default LoginEmailSentPagediff --git a/public/pages/SignIn/index.ts b/public/pages/SignIn/index.tsindex de8327669..85c52212b 100644--- a/public/pages/SignIn/index.ts+++ b/public/pages/SignIn/index.ts@@ -1,2 +1,3 @@export * from "./SignIn.page"export * from "./CompleteSignInProfile.page"+export * from "./LoginEmailSent.page"diff --git a/public/services/actions/image.ts b/public/services/actions/image.tsnew file mode 100644index 000000000..6fa3dcb76--- /dev/null+++ b/public/services/actions/image.ts@@ -0,0 +1,18 @@+import { http, Result } from "@fider/services"+import { ImageUpload } from "@fider/models"++export interface UploadImageResponse {+ bkey: string+}++/**+ * Uploads an image to the server and returns the bkey+ * This doesn't associate the image with any post or comment yet+ */+export const uploadImage = async (image: ImageUpload): Promise<Result<UploadImageResponse>> => {+ return http.post<UploadImageResponse>("/api/v1/images", { image })+}++export const deleteImage = async (bkey: string): Promise<Result> => {+ return http.delete(`/api/v1/images/${bkey}`)+}diff --git a/public/services/actions/post.ts b/public/services/actions/post.tsindex f9ead5736..18a5e43d1 100644--- a/public/services/actions/post.ts+++ b/public/services/actions/post.ts@@ -28,6 +28,11 @@ export const searchPosts = async (params: SearchPostsParams): Promise<Result<Posreturn await http.get<Post[]>(`/api/v1/posts${qsParams}`)}+export const findSimilarPosts = async (query: string): Promise<Result<Post[]>> => {+ const params = querystring.stringify({ query: query })+ return await http.get<Post[]>(`/api/v1/similarposts${params}`)+}+export const deletePost = async (postNumber: number, text: string): Promise<Result> => {return http.delete(`/api/v1/posts/${postNumber}`, {diff --git a/public/services/actions/tenant.ts b/public/services/actions/tenant.tsindex e0eb24f07..19a827466 100644--- a/public/services/actions/tenant.ts+++ b/public/services/actions/tenant.ts@@ -54,9 +54,10 @@ export const checkAvailability = async (subdomain: string): Promise<Result<Checkreturn await http.get<CheckAvailabilityResponse>(`/_api/tenants/${subdomain}/availability`)}-export const signIn = async (email: string): Promise<Result> => {+export const signIn = async (email: string, code?: string): Promise<Result> => {return await http.post("/_api/signin", {email,+ code,})}diff --git a/public/services/bkey.ts b/public/services/bkey.tsnew file mode 100644index 000000000..8a63dac10--- /dev/null+++ b/public/services/bkey.ts@@ -0,0 +1,74 @@+/**+ * Converts a string to a URL-friendly slug+ * @param text The text to convert to a slug+ * @returns A URL-friendly slug+ */+export const slugify = (text: string): string => {+ return text+ .toString()+ .toLowerCase()+ .trim()+ .replace(/\s+/g, "-") // Replace spaces with -+ .replace(/[^\w-]+/g, "") // Remove all non-word chars+ .replace(/--+/g, "-") // Replace multiple - with single -+ .replace(/^-+/, "") // Trim - from start of text+ .replace(/-+$/, "") // Trim - from end of text+}++/**+ * Generates a random string of the specified length+ * @param length The length of the random string to generate+ * @returns A random string+ */+export const generateRandomString = (length: number): string => {+ const chars = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"+ let result = ""+ const randomValues = new Uint8Array(length)++ // Use crypto.getRandomValues for secure random generation if available+ if (window.crypto && window.crypto.getRandomValues) {+ window.crypto.getRandomValues(randomValues)++ for (let i = 0; i < length; i++) {+ result += chars[randomValues[i] % chars.length]+ }+ } else {+ // Fallback to Math.random (less secure)+ for (let i = 0; i < length; i++) {+ result += chars[Math.floor(Math.random() * chars.length)]+ }+ }++ return result+}++/**+ * Sanitizes a filename to be used in a URL+ * @param fileName The filename to sanitize+ * @returns A sanitized filename+ */+export const sanitizeFileName = (fileName: string): string => {+ fileName = fileName.trim()+ const lastDotIndex = fileName.lastIndexOf(".")++ if (lastDotIndex !== -1) {+ const name = fileName.substring(0, lastDotIndex)+ const ext = fileName.substring(lastDotIndex)+ return slugify(name) + ext+ }++ return slugify(fileName)+}++/**+ * Generates a bkey for an image upload+ * @param fileName The name of the file being uploaded+ * @returns A bkey in the format used by the server+ */+export const generateBkey = (fileName: string): string => {+ const folder = "attachments"+ const randomString = generateRandomString(64)+ const sanitizedFileName = sanitizeFileName(fileName)++ return `${folder}/${randomString}-${sanitizedFileName}`+}diff --git a/public/services/markdown.ts b/public/services/markdown.tsindex 47a2bb34c..b2e023bb1 100644--- a/public/services/markdown.ts+++ b/public/services/markdown.ts@@ -24,7 +24,14 @@ const link = (href: string, title: string, text: string) => {}const fullRenderer = new marked.Renderer()-fullRenderer.image = () => ""+fullRenderer.image = (href, title, alt) => {+ // Check if this is our special fider-image syntax+ if (href && href.startsWith("fider-image:")) {+ const bkey = href.substring("fider-image:".length)+ return `<img src="/static/images/${bkey}" alt="${alt || ""}" class="fider-inline-image" data-bkey="${bkey}" />`+ }+ return "" // Ignore other images+}fullRenderer.link = linkfullRenderer.text = (text: string) => {// Handling mention links (they're in the format @[name])