fix: remove dead shareStockStatus gating from shared medication overview (#436)

The shareStockStatus UI toggle was replaced by shareMedicationOverview in
commit e0fb77d, but the backend gating logic was left intact. Users who
had previously set shareStockStatus=false were stuck with empty stock
values ('-') on the shared medication overview with no UI to change it.

- Remove showStockStatus parameter from buildSharedMedicationOverview()
- Remove visibility gating that nullified stock fields
- Remove shareStockStatus from settings API responses and PUT schema
- Remove shareStockStatus from frontend types, hooks, and context
- Clean up all related test fixtures and dead test cases
- DB column share_stock_status retained (never remove columns)
This commit is contained in:
Daniel Volz
2026-03-15 19:27:39 +01:00
committed by GitHub
parent ef78e51b4e
commit 908e4e724f
15 changed files with 11 additions and 157 deletions
-1
View File
@@ -792,7 +792,6 @@ export function AppProvider({ children }: { children: React.ReactNode }) {
settings.reminderRepeatIntervalMinutes !== savedSettings.reminderRepeatIntervalMinutes ||
settings.maxNaggingReminders !== savedSettings.maxNaggingReminders ||
settings.stockCalculationMode !== savedSettings.stockCalculationMode ||
settings.shareStockStatus !== savedSettings.shareStockStatus ||
settings.shareMedicationOverview !== savedSettings.shareMedicationOverview ||
settings.upcomingTodayOnly !== savedSettings.upcomingTodayOnly ||
settings.shareScheduleTodayOnly !== savedSettings.shareScheduleTodayOnly ||
-3
View File
@@ -46,7 +46,6 @@ export interface Settings {
shoutrrrIntakeReminders: boolean;
shoutrrrPrescriptionReminders: boolean;
stockCalculationMode: "automatic" | "manual";
shareStockStatus: boolean;
shareMedicationOverview: boolean;
upcomingTodayOnly: boolean;
shareScheduleTodayOnly: boolean;
@@ -98,7 +97,6 @@ const defaultSettings: Settings = {
shoutrrrIntakeReminders: true,
shoutrrrPrescriptionReminders: true,
stockCalculationMode: "automatic",
shareStockStatus: true,
shareMedicationOverview: false,
upcomingTodayOnly: false,
shareScheduleTodayOnly: false,
@@ -258,7 +256,6 @@ export function useSettings(): UseSettingsReturn {
shoutrrrIntakeReminders: settingsToSave.shoutrrrIntakeReminders,
shoutrrrPrescriptionReminders: settingsToSave.shoutrrrPrescriptionReminders,
stockCalculationMode: settingsToSave.stockCalculationMode,
shareStockStatus: settingsToSave.shareStockStatus,
shareMedicationOverview: settingsToSave.shareMedicationOverview,
upcomingTodayOnly: settingsToSave.upcomingTodayOnly,
shareScheduleTodayOnly: settingsToSave.shareScheduleTodayOnly,
@@ -18,7 +18,6 @@ function createSharedData() {
sharedBy: "Owner",
takenBy: "Max",
scheduleDays: 30,
shareStockStatus: true,
medications: [],
};
}
@@ -64,7 +63,6 @@ function createSharedDataWithTodayDose() {
takenBy: "Max",
scheduleDays: 30,
automaticDoseId: `1-0-${dateOnlyMs}`,
shareStockStatus: true,
medications: [
{
id: 1,
@@ -22,7 +22,6 @@ function createSharedData(overrides: Record<string, unknown> = {}) {
sharedBy: "Owner",
takenBy: "Max",
scheduleDays: 30,
shareStockStatus: true,
upcomingTodayOnly: false,
shareScheduleTodayOnly: true,
stockCalculationMode: "automatic",
@@ -131,7 +131,6 @@ describe("useAppContext", () => {
shoutrrrStockReminders: true,
shoutrrrIntakeReminders: true,
stockCalculationMode: "automatic",
shareStockStatus: true,
shareMedicationOverview: false,
expiryWarningDays: 30,
},
@@ -171,7 +170,6 @@ describe("useAppContext", () => {
shoutrrrStockReminders: true,
shoutrrrIntakeReminders: true,
stockCalculationMode: "automatic",
shareStockStatus: true,
shareMedicationOverview: false,
expiryWarningDays: 30,
},
@@ -43,7 +43,6 @@ const createMockContext = (overrides = {}) => ({
maxNaggingReminders: 5,
language: "en",
stockCalculationMode: "automatic",
shareStockStatus: true,
smtpHost: "",
smtpPort: 587,
smtpUser: "",
-1
View File
@@ -253,7 +253,6 @@ export type SharedScheduleData = {
expiryWarningDays?: number;
};
stockCalculationMode?: "automatic" | "manual";
shareStockStatus?: boolean;
shareMedicationOverview?: boolean;
medicationOverview?: SharedMedicationOverviewItem[] | null;
upcomingTodayOnly?: boolean;