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. Reviewed-on: https://codeberg.org/secana/Forji/pulls/64
This commit is contained in:
parent
745b7af45b
commit
330d2bde4f
4 changed files with 3 additions and 45 deletions
|
|
@ -67,14 +67,6 @@ struct MergedNotificationsOverviewView: View {
|
||||||
.tint(.blue)
|
.tint(.blue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
|
||||||
Button {
|
|
||||||
Task { await dismissNotification(tagged) }
|
|
||||||
} label: {
|
|
||||||
Label("Dismiss", systemImage: "xmark")
|
|
||||||
}
|
|
||||||
.tint(.gray)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if pagination.hasMore {
|
if pagination.hasMore {
|
||||||
|
|
@ -193,10 +185,6 @@ struct MergedNotificationsOverviewView: View {
|
||||||
await setNotificationRead(tagged)
|
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.
|
/// 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
|
/// The row is updated in place rather than removed so navigation into the
|
||||||
/// detail view is not interrupted while the list is mutating.
|
/// detail view is not interrupted while the list is mutating.
|
||||||
|
|
|
||||||
|
|
@ -68,14 +68,6 @@ struct NotificationsOverviewView: View {
|
||||||
.tint(.blue)
|
.tint(.blue)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
.swipeActions(edge: .trailing, allowsFullSwipe: true) {
|
|
||||||
Button {
|
|
||||||
Task { await dismissNotification(notification) }
|
|
||||||
} label: {
|
|
||||||
Label("Dismiss", systemImage: "xmark")
|
|
||||||
}
|
|
||||||
.tint(.gray)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if pagination.hasMore {
|
if pagination.hasMore {
|
||||||
|
|
@ -181,10 +173,6 @@ struct NotificationsOverviewView: View {
|
||||||
await setNotificationRead(notification)
|
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.
|
/// 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
|
/// The row is updated in place rather than removed so navigation into the
|
||||||
/// detail view is not interrupted while the list is mutating.
|
/// detail view is not interrupted while the list is mutating.
|
||||||
|
|
|
||||||
|
|
@ -125,7 +125,7 @@ final class MergedInstanceUITests: ForgejoUITestBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func testMergedNotificationSwipeDismiss() throws {
|
func testMergedNotificationSwipeMarkRead() throws {
|
||||||
try setupTwoInstances()
|
try setupTwoInstances()
|
||||||
enterMergedMode()
|
enterMergedMode()
|
||||||
|
|
||||||
|
|
@ -137,19 +137,11 @@ final class MergedInstanceUITests: ForgejoUITestBase {
|
||||||
let firstCell = notificationsList.cells.firstMatch
|
let firstCell = notificationsList.cells.firstMatch
|
||||||
XCTAssertTrue(firstCell.waitForExistence(timeout: 10), "Should have at least one notification")
|
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()
|
firstCell.swipeRight()
|
||||||
let markReadButton = app.buttons["Mark Read"]
|
let markReadButton = app.buttons["Mark Read"]
|
||||||
XCTAssertTrue(markReadButton.waitForExistence(timeout: 3), "Mark Read swipe action should appear")
|
XCTAssertTrue(markReadButton.waitForExistence(timeout: 3), "Mark Read swipe action should appear")
|
||||||
markReadButton.tap()
|
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
|
// MARK: - Server URL Helpers
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,7 @@ import XCTest
|
||||||
|
|
||||||
final class NotificationsUITests: ForgejoUITestBase {
|
final class NotificationsUITests: ForgejoUITestBase {
|
||||||
|
|
||||||
// MARK: - Notifications (unread, filter, swipe mark-read, swipe dismiss)
|
// MARK: - Notifications (unread, filter, swipe mark-read)
|
||||||
|
|
||||||
@MainActor
|
@MainActor
|
||||||
func testNotifications() throws {
|
func testNotifications() throws {
|
||||||
|
|
@ -38,16 +38,6 @@ final class NotificationsUITests: ForgejoUITestBase {
|
||||||
if markReadButton.waitForExistence(timeout: 3) {
|
if markReadButton.waitForExistence(timeout: 3) {
|
||||||
markReadButton.tap()
|
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)
|
// MARK: - Open-to-clear (#32)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue