Merge pull request 'fix: allow guest recommend swipe' (#44) from codex/fix-guest-recommend-swipe into master
Reviewed-on: #44
This commit was merged in pull request #44.
This commit is contained in:
@@ -1607,3 +1607,11 @@
|
||||
- 处理:后续如果需要重新暴露存档入口,优先评估是否应回到“玩过”或别的独立弹窗流程,不要默认把存档再塞回常用功能宫格或设置列表。
|
||||
- 验证:`npm test -- src/components/rpg-entry/RpgEntryHomeView.recharge.test.tsx -t "mobile profile page matches the reference layout sections|profile scan action opens camera scanner instead of recharge panel"`。
|
||||
- 关联:`src/components/rpg-entry/RpgEntryHomeView.tsx`、`docs/【项目基线】当前产品与工程约束-2026-05-15.md`、`docs/【玩法创作】平台入口与玩法链路-2026-05-15.md`。
|
||||
|
||||
## 访客推荐页上下滑不要绑定登录态
|
||||
|
||||
- 现象:访客模式进入移动端推荐页后,推荐内容可展示和点击底部“下一个”,但在作品信息区域上下滑不会切换推荐作品,表现为推荐页不能上下滑动。
|
||||
- 原因:推荐页滑动切换逻辑 `beginRecommendDrag(...)` 误把 `isAuthenticated` 作为启用条件;访客态虽然允许浏览和通过底部按钮切换,却无法触发同一套拖拽切换。
|
||||
- 处理:推荐页拖拽只校验当前是否有作品、多作品可切换以及是否正在提交动画,不再要求登录;登录态相关操作仍由点赞、改造等按钮自身权限控制。
|
||||
- 验证:`npx vitest run src/components/rpg-entry/RpgEntryHomeView.recharge.test.tsx` 覆盖访客态纵向滑动不弹登录且触发下一条推荐。
|
||||
- 关联:`src/components/rpg-entry/RpgEntryHomeView.tsx`、`src/components/rpg-entry/RpgEntryHomeView.recharge.test.tsx`。
|
||||
|
||||
@@ -3246,6 +3246,41 @@ test('logged out active recommend bottom tab selects next work without login', a
|
||||
expect(openLoginModal).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
test('logged out recommend card supports vertical swipe without login', () => {
|
||||
vi.useFakeTimers();
|
||||
const onSelectNextRecommendEntry = vi.fn();
|
||||
const openLoginModal = vi.fn();
|
||||
|
||||
renderLoggedOutHomeView(openLoginModal, {
|
||||
latestEntries: [
|
||||
puzzlePublicEntry,
|
||||
{
|
||||
...puzzlePublicEntry,
|
||||
workId: 'puzzle-work-guest-next',
|
||||
profileId: 'puzzle-profile-guest-next',
|
||||
ownerUserId: 'user-guest-next',
|
||||
publicWorkCode: 'PZ-GUEST-NEXT',
|
||||
worldName: '访客下一张',
|
||||
},
|
||||
],
|
||||
activeRecommendEntryKey: 'puzzle:user-2:puzzle-profile-public-1',
|
||||
onSelectNextRecommendEntry,
|
||||
recommendRuntimeContent: <div data-testid="guest-recommend-runtime" />,
|
||||
});
|
||||
|
||||
const meta = screen.getByLabelText('奇幻拼图 作品信息') as HTMLElement;
|
||||
act(() => {
|
||||
dispatchPointerEvent(meta, 'pointerdown', { pointerId: 1, clientY: 320 });
|
||||
dispatchPointerEvent(meta, 'pointermove', { pointerId: 1, clientY: 220 });
|
||||
dispatchPointerEvent(meta, 'pointerup', { pointerId: 1, clientY: 220 });
|
||||
vi.advanceTimersByTime(180);
|
||||
});
|
||||
|
||||
expect(onSelectNextRecommendEntry).toHaveBeenCalledTimes(1);
|
||||
expect(openLoginModal).not.toHaveBeenCalled();
|
||||
vi.useRealTimers();
|
||||
});
|
||||
|
||||
test('mobile recommend meta loads real author avatar from public user summary', async () => {
|
||||
mockGetPublicAuthUserById.mockResolvedValueOnce({
|
||||
id: 'user-2',
|
||||
|
||||
@@ -5282,7 +5282,6 @@ export function RpgEntryHomeView({
|
||||
(event: PointerEvent<HTMLElement>) => {
|
||||
if (
|
||||
recommendDragCommitDirection ||
|
||||
!isAuthenticated ||
|
||||
!activeRecommendEntry ||
|
||||
recommendedFeedEntries.length <= 1
|
||||
) {
|
||||
@@ -5298,7 +5297,6 @@ export function RpgEntryHomeView({
|
||||
},
|
||||
[
|
||||
activeRecommendEntry,
|
||||
isAuthenticated,
|
||||
recommendDragCommitDirection,
|
||||
recommendedFeedEntries.length,
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user