From 330d2bde4fef0303038c249afe7178f65ae67944 Mon Sep 17 00:00:00 2001 From: Stefan Hausotte Date: Thu, 4 Jun 2026 14:08:20 +0200 Subject: [PATCH] fix: remove redundant notification Dismiss swipe action (#46) The trailing Dismiss swipe called the same setNotificationRead path as the leading Mark Read action, since ForgejoKit's NotificationService only exposes markAsRead (PATCH to-status=read). Dismiss therefore did nothing distinct and left the row visible under the All/Read filters, just relabeled. Drop the redundant action in both NotificationsOverviewView and MergedNotificationsOverviewView. The leading Mark Read swipe (shown for unread threads, full-swipe by default) remains the single, honest action. Reviewed-on: https://codeberg.org/secana/Forji/pulls/64 --- .../Views/MergedNotificationsOverviewView.swift | 12 ------------ Forji/Forji/Views/NotificationsOverviewView.swift | 12 ------------ Forji/ForjiUITests/MergedInstanceUITests.swift | 12 ++---------- Forji/ForjiUITests/NotificationsUITests.swift | 12 +----------- 4 files changed, 3 insertions(+), 45 deletions(-) diff --git a/Forji/Forji/Views/MergedNotificationsOverviewView.swift b/Forji/Forji/Views/MergedNotificationsOverviewView.swift index 6d4a684..76fbc88 100644 --- a/Forji/Forji/Views/MergedNotificationsOverviewView.swift +++ b/Forji/Forji/Views/MergedNotificationsOverviewView.swift @@ -67,14 +67,6 @@ struct MergedNotificationsOverviewView: View { .tint(.blue) } } - .swipeActions(edge: .trailing, allowsFullSwipe: true) { - Button { - Task { await dismissNotification(tagged) } - } label: { - Label("Dismiss", systemImage: "xmark") - } - .tint(.gray) - } } if pagination.hasMore { @@ -193,10 +185,6 @@ struct MergedNotificationsOverviewView: View { await setNotificationRead(tagged) } - private func dismissNotification(_ tagged: TaggedItem) async { - await setNotificationRead(tagged) - } - /// Marks a notification read when the user opens it, mirroring Mail and News. /// The row is updated in place rather than removed so navigation into the /// detail view is not interrupted while the list is mutating. diff --git a/Forji/Forji/Views/NotificationsOverviewView.swift b/Forji/Forji/Views/NotificationsOverviewView.swift index ae4c3f6..7a4e9ec 100644 --- a/Forji/Forji/Views/NotificationsOverviewView.swift +++ b/Forji/Forji/Views/NotificationsOverviewView.swift @@ -68,14 +68,6 @@ struct NotificationsOverviewView: View { .tint(.blue) } } - .swipeActions(edge: .trailing, allowsFullSwipe: true) { - Button { - Task { await dismissNotification(notification) } - } label: { - Label("Dismiss", systemImage: "xmark") - } - .tint(.gray) - } } if pagination.hasMore { @@ -181,10 +173,6 @@ struct NotificationsOverviewView: View { await setNotificationRead(notification) } - private func dismissNotification(_ notification: NotificationThread) async { - await setNotificationRead(notification) - } - /// Marks a notification read when the user opens it, mirroring Mail and News. /// The row is updated in place rather than removed so navigation into the /// detail view is not interrupted while the list is mutating. diff --git a/Forji/ForjiUITests/MergedInstanceUITests.swift b/Forji/ForjiUITests/MergedInstanceUITests.swift index e255883..daba8ab 100644 --- a/Forji/ForjiUITests/MergedInstanceUITests.swift +++ b/Forji/ForjiUITests/MergedInstanceUITests.swift @@ -125,7 +125,7 @@ final class MergedInstanceUITests: ForgejoUITestBase { } @MainActor - func testMergedNotificationSwipeDismiss() throws { + func testMergedNotificationSwipeMarkRead() throws { try setupTwoInstances() enterMergedMode() @@ -137,19 +137,11 @@ final class MergedInstanceUITests: ForgejoUITestBase { let firstCell = notificationsList.cells.firstMatch XCTAssertTrue(firstCell.waitForExistence(timeout: 10), "Should have at least one notification") - // Swipe right to mark as read + // Swipe right to mark as read (the only notification swipe action) firstCell.swipeRight() let markReadButton = app.buttons["Mark Read"] XCTAssertTrue(markReadButton.waitForExistence(timeout: 3), "Mark Read swipe action should appear") markReadButton.tap() - - // Swipe left to dismiss - let nextCell = notificationsList.cells.firstMatch - XCTAssertTrue(nextCell.waitForExistence(timeout: 5), "Should have another notification to dismiss") - nextCell.swipeLeft() - let dismissButton = app.buttons["Dismiss"] - XCTAssertTrue(dismissButton.waitForExistence(timeout: 3), "Dismiss swipe action should appear") - dismissButton.tap() } // MARK: - Server URL Helpers diff --git a/Forji/ForjiUITests/NotificationsUITests.swift b/Forji/ForjiUITests/NotificationsUITests.swift index 185f4c0..ff738c4 100644 --- a/Forji/ForjiUITests/NotificationsUITests.swift +++ b/Forji/ForjiUITests/NotificationsUITests.swift @@ -2,7 +2,7 @@ import XCTest final class NotificationsUITests: ForgejoUITestBase { - // MARK: - Notifications (unread, filter, swipe mark-read, swipe dismiss) + // MARK: - Notifications (unread, filter, swipe mark-read) @MainActor func testNotifications() throws { @@ -38,16 +38,6 @@ final class NotificationsUITests: ForgejoUITestBase { if markReadButton.waitForExistence(timeout: 3) { markReadButton.tap() } - - // Swipe left to dismiss - let nextCell = notificationsList.cells.firstMatch - if nextCell.waitForExistence(timeout: 5) { - nextCell.swipeLeft() - let dismissButton = app.buttons["Dismiss"] - if dismissButton.waitForExistence(timeout: 3) { - dismissButton.tap() - } - } } // MARK: - Open-to-clear (#32)