hide simulate leaderboard for non-admin#7941
Conversation
WalkthroughThis pull request refines the conditional logic used to control the visibility of simulation-related elements in the ladder view. In the Pug template, the rendering of the inline simulation stats and the "Simulate" tab link now depends on whether the user is an admin and, in one case, whether the league type is not 'course'. Similarly, the JavaScript fetch method in the SimulateTabView has been updated to include an admin check alongside its ladder type condition, thereby restricting data fetch operations to admin users only. Changes
Sequence Diagram(s)sequenceDiagram
participant U as User
participant T as Ladder Template
participant F as SimulateTabView.fetch
U->>T: Load Ladder Page
alt User is Non-Admin
T->>T: Skip rendering simulation stats and "Simulate" tab
Note over T,U: Simulation elements remain hidden
else User is Admin
T->>T: Render simulation stats and "Simulate" tab (if leagueType ≠ 'course')
end
U->>F: Trigger data fetch (if applicable)
alt Admin & Level not ladder
F->>F: Execute fetch logic for leaderboard data
else
F->>F: Skip fetching data
end
Possibly related PRs
Suggested reviewers
Poem
Tip ⚡🧪 Multi-step agentic review comment chat (experimental)
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (2)
⏰ Context from checks skipped due to timeout of 90000ms (1)
🔇 Additional comments (4)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
result:

acutally i notice that course-ladder doesn't show up the simulate leaderboard but actually load it. that's why we have so many hits I think. and also notice that most of hero-ladders are closed, so most of home user may already turn to ai-league. i think hide this leaderboard make sense. let's see if anyone complain about it.
fix ENG-1679
Summary by CodeRabbit