Fix: Mobile responsiveness audit (modals, views, sidebar) & Critical bug fixes (registration, orphan tasks)
continuous-integration/drone/push Build is passing
continuous-integration/drone/push Build is passing
This commit is contained in:
+1
-2
@@ -105,8 +105,7 @@ export async function registerRoutes(app: Express): Promise<Server> {
|
||||
});
|
||||
|
||||
app.get("/api/settings/public", async (req, res) => {
|
||||
const regEnabled = "true"; // Force enabled for testing
|
||||
// const regEnabled = await storage.getSystemSettings("registration_enabled");
|
||||
const regEnabled = await storage.getSystemSettings("registration_enabled");
|
||||
// Default to true if not set, or specifically check for "false"
|
||||
res.json({ registration_enabled: regEnabled !== "false" });
|
||||
});
|
||||
|
||||
+12
-3
@@ -1,7 +1,7 @@
|
||||
import { type User, type InsertUser, type Label, type InsertLabel, type SharedLabel, type Task, type InsertTask, type XpEvent, type InsertXpEvent, type Goal, type InsertGoal, type Reward, type InsertReward, type UserReward, type InsertUserReward, type SystemSettings, type InsertSystemSettings, type SharedTask, type InsertSharedTask, type UserTaskAccess, type InsertUserTaskAccess, type InsertPasswordResetToken, type PasswordResetToken, type Conversation, type InsertConversation, type Message, type InsertMessage, type AuditLog, type InsertAuditLog } from "@shared/schema";
|
||||
import * as schema from "@shared/schema";
|
||||
import { getDatabase, pool } from "./db";
|
||||
import { eq, sql, and, desc, asc, gt, ne } from "drizzle-orm";
|
||||
import { eq, sql, and, desc, asc, gt, ne, or, isNull } from "drizzle-orm";
|
||||
import { randomUUID } from "crypto";
|
||||
import session from "express-session";
|
||||
import createMemoryStore from "memorystore";
|
||||
@@ -847,8 +847,17 @@ export class DbStorage implements IStorage {
|
||||
}
|
||||
|
||||
async getTasksForUser(userId: string): Promise<Task[]> {
|
||||
// 1. My tasks
|
||||
const result = await this.db.select().from(schema.tasks).where(eq(schema.tasks.userId, userId));
|
||||
// 1. My tasks + Orphans (invalid/null userId)
|
||||
// We use leftJoin to users to identify tasks with non-existent userIds (orphans)
|
||||
const resultRaw = await this.db.select({ task: schema.tasks })
|
||||
.from(schema.tasks)
|
||||
.leftJoin(schema.users, eq(schema.tasks.userId, schema.users.id))
|
||||
.where(or(
|
||||
eq(schema.tasks.userId, userId), // Owned by me
|
||||
isNull(schema.tasks.userId), // No owner
|
||||
isNull(schema.users.id) // Owner ID exists but User doesn't (deleted user)
|
||||
));
|
||||
const result = resultRaw.map(r => r.task);
|
||||
|
||||
// 2. Shared Tasks
|
||||
const sharedLinks = await this.db.select().from(schema.sharedTasks).where(eq(schema.sharedTasks.sharedWithUserId, userId));
|
||||
|
||||
Reference in New Issue
Block a user