mirror of
https://codeberg.org/secana/Forji.git
synced 2026-06-16 05:13:55 -07:00
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.
This commit is contained in:
parent
66fe573cb6
commit
8336feb42d
4 changed files with 3 additions and 45 deletions
|
|
@ -66,14 +66,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 {
|
||||
|
|
@ -192,10 +184,6 @@ struct MergedNotificationsOverviewView: View {
|
|||
await setNotificationRead(tagged)
|
||||
}
|
||||
|
||||
private func dismissNotification(_ tagged: TaggedItem<NotificationThread>) 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.
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Reference in a new issue