修复账号切换后「我的」页当前账号展示错误,并统一举报摄影师首页 URI。

切换账号时以用户选中账号为准写入展示标题与业务作用域,避免沿用旧门店名称;同时将首页举报摄影师入口 URI 对齐为 report_photographer。

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-07-01 17:21:04 +08:00
parent fcb86d43f5
commit 5ab9b1b324
23 changed files with 419 additions and 92 deletions

View File

@ -147,6 +147,40 @@ final class AccountContextLoaderTests: XCTestCase {
XCTAssertTrue(accountContext.storeScopes.isEmpty)
XCTAssertNil(accountContext.currentStore)
}
/// /
func testRefreshSupplementalContextPreservesExistingStoreScopesWhenStoreAPIFails() async throws {
let accountContext = AccountContext()
accountContext.applyLogin(accountType: V9StoreUser.accountTypeValue)
accountContext.replaceScopes(
scenic: [BusinessScope(id: 88, name: "东湖景区", kind: .scenic)],
stores: [BusinessScope(id: 66, name: "东湖门店", kind: .store, parentScenicId: 88)],
currentScenicId: 88,
currentStoreId: 66
)
let permissionContext = PermissionContext()
let api = MockAccountContextAPI()
api.roles = [
RolePermissionResponse(
role: RoleInfo(id: 7, name: "运营"),
scenic: [ScenicInfo(id: 88, name: "东湖景区")]
)
]
api.scenicResponse = ScenicListAllResponse(total: 1, list: [ScenicListItem(id: 88, name: "东湖景区")])
api.storeError = APIError.networkFailed("门店接口失败")
try await AccountContextLoader().refreshSupplementalContext(
accountContext: accountContext,
permissionContext: permissionContext,
profileAPI: MockUserProfileAPI(),
accountContextAPI: api,
cachedCurrentScenicId: 88,
cachedCurrentStoreId: 66
)
XCTAssertEqual(accountContext.storeScopes.map(\.name), ["东湖门店"])
XCTAssertEqual(accountContext.currentStore?.name, "东湖门店")
}
}
@MainActor