Skip to content

Commit 2ae12b2

Browse files
authored
Only show gh syncer to insiders (exercism#7895)
1 parent 5f0c870 commit 2ae12b2

File tree

5 files changed

+14
-21
lines changed

5 files changed

+14
-21
lines changed

app/helpers/react_components/student/iterations_list.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,7 @@ def to_s
1515
download_cmd: exercise.download_cmd,
1616
has_test_runner: exercise.has_test_runner?
1717
},
18-
is_user_lifetime_insider: solution.user.lifetime_insider?,
19-
is_user_admin: solution.user.admin?,
18+
is_github_syncer_visible: solution.user.insider?,
2019
track: {
2120
title: track.title,
2221
slug: track.slug,

app/helpers/view_components/settings_nav.rb

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,10 @@ def to_s
88
items = [
99
item_for("Account settings", :settings, :general),
1010
item_for("API / CLI", :api_cli_settings, :api_cli),
11-
item_for("Integrations", :integrations_settings, :integrations),
12-
item_for("GitHub Syncer", :settings_github_syncer, :github_syncer),
11+
item_for("Integrations", :integrations_settings, :integrations)
12+
]
13+
items << item_for("GitHub Syncer", :settings_github_syncer, :github_syncer) if current_user.insider?
14+
items += [
1315
item_for("Preferences", :user_preferences_settings, :preferences),
1416
item_for("Communication Preferences", :communication_preferences_settings, :communication),
1517
item_for("Donations", :donations_settings, :donations),

app/javascript/components/student/IterationsList.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ export type IterationsListProps = {
5656
track: Track
5757
links: Links
5858
syncer: GithubSyncerSettings | null
59-
isUserLifetimeInsider: boolean
60-
isUserAdmin: boolean
59+
isGithubSyncerVisible: boolean
6160
}
6261

6362
export default function IterationsList({
@@ -67,8 +66,7 @@ export default function IterationsList({
6766
track,
6867
links,
6968
syncer,
70-
isUserLifetimeInsider,
71-
isUserAdmin,
69+
isGithubSyncerVisible,
7270
}: IterationsListProps): JSX.Element {
7371
const [isOpen, setIsOpen] = useState<boolean[]>([])
7472

@@ -169,8 +167,7 @@ export default function IterationsList({
169167
iteration={iteration}
170168
syncer={syncer}
171169
exercise={exercise}
172-
isUserLifetimeInsider={isUserLifetimeInsider}
173-
isUserAdmin={isUserAdmin}
170+
isGithubSyncerVisible={isGithubSyncerVisible}
174171
track={track}
175172
links={links}
176173
isOpen={isOpen[index]}

app/javascript/components/student/iterations-list/Information.tsx

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,15 @@ export const Information = ({
2424
links,
2525
onDelete,
2626
syncer,
27-
isUserLifetimeInsider,
28-
isUserAdmin,
27+
isGithubSyncerVisible,
2928
}: {
3029
iteration: Iteration
3130
exercise: Exercise
3231
track: Track
3332
links: Links
3433
onDelete: (iteration: Iteration) => void
3534
syncer: GithubSyncerSettings | null
36-
isUserLifetimeInsider: boolean
37-
isUserAdmin: boolean
35+
isGithubSyncerVisible: boolean
3836
}): JSX.Element | null => {
3937
const [tab, setTab] = useState<TabIndex>('analysis')
4038

@@ -54,7 +52,7 @@ export const Information = ({
5452
<GraphicalIcon icon="tests" />
5553
Tests
5654
</Tab>
57-
{isUserAdmin && (
55+
{isGithubSyncerVisible && (
5856
<Tab id="github-backup" context={TabsContext} className="--small">
5957
<GraphicalIcon icon="external-site-github" />
6058
Backup

app/javascript/components/student/iterations-list/IterationReport.tsx

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ export const IterationReport = ({
1818
onCompressed,
1919
onDelete,
2020
syncer,
21-
isUserLifetimeInsider,
22-
isUserAdmin,
21+
isGithubSyncerVisible,
2322
}: {
2423
iteration: Iteration
2524
exercise: Exercise
@@ -30,8 +29,7 @@ export const IterationReport = ({
3029
onCompressed: () => void
3130
onDelete: (iteration: Iteration) => void
3231
syncer: GithubSyncerSettings | null
33-
isUserLifetimeInsider: boolean
34-
isUserAdmin: boolean
32+
isGithubSyncerVisible: boolean
3533
}): JSX.Element => {
3634
return (
3735
<details open={isOpen} className="iteration c-details">
@@ -83,8 +81,7 @@ export const IterationReport = ({
8381
</div>
8482
<div className="information">
8583
<Information
86-
isUserLifetimeInsider={isUserLifetimeInsider}
87-
isUserAdmin={isUserAdmin}
84+
isGithubSyncerVisible={isGithubSyncerVisible}
8885
iteration={iteration}
8986
exercise={exercise}
9087
track={track}

0 commit comments

Comments
 (0)