Skip to content

Commit ad5c0b5

Browse files
committed
refactor: rename affiliateUsername to affiliateName across app
Replace all instances of affiliateUsername with affiliateName in templates, components, and models to better represent and display affiliate information. Update tests accordingly to use affiliateName. This improves clarity and consistency in handling affiliate data throughout the application.
1 parent 356c517 commit ad5c0b5

File tree

10 files changed

+13
-11
lines changed

10 files changed

+13
-11
lines changed

app/components/affiliate-link-page/accept-referral-button.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
{{else if this.currentUserIsReferrer}}
1818
<EmberTooltip @text="You can't accept your own referral offer." />
1919
{{else if this.currentUserHasActiveDiscountFromAffiliateReferral}}
20-
<EmberTooltip @text="You've already accepted {{this.currentUser.currentAffiliateReferral.affiliateLink.affiliateUsername}}'s referral offer." />
20+
<EmberTooltip @text="You've already accepted {{this.currentUser.currentAffiliateReferral.affiliateLink.affiliateName}}'s referral offer." />
2121
{{else if this.currentUserCanAccessMembershipBenefits}}
2222
<EmberTooltip @text="As a CodeCrafters member, you already have full access." />
2323
{{/if}}

app/components/affiliate-link-page/accept-referral-container.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
</div>
2222

2323
<div class="prose dark:prose-invert text-center max-w-sm">
24-
<b class="dark:text-gray-50">@{{@affiliateLink.affiliateUsername}}</b>
24+
<b class="dark:text-gray-50">@{{@affiliateLink.affiliateName}}</b>
2525
wants you to try CodeCrafters. Signing up is free.
2626
<b class="dark:text-gray-50">40% off</b>
2727
if you upgrade.

app/components/pay-page/choose-membership-plan-modal/plan-card.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
5959
{{#if @promotionalDiscount.isFromAffiliateReferral}}<span
6060
class="text-nowrap"
61-
>{{@promotionalDiscount.affiliateReferral.affiliateLink.affiliateUsername}}'s</span>
61+
>{{@promotionalDiscount.affiliateReferral.affiliateLink.affiliateName}}'s</span>
6262
referral offer{{else if @promotionalDiscount.isFromStage2Completion}}Stage 2 completion discount{{else if
6363
@promotionalDiscount.isFromSignup
6464
}}Signup discount{{/if}}, expires in

app/components/pay-page/referral-discount-notice.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
<img alt="avatar" src={{@discount.affiliateReferral.affiliateLink.affiliateAvatarUrl}} class="inline-block w-6 h-6" />
1919
{{/if}}
2020

21-
<b>{{@discount.affiliateReferral.affiliateLink.affiliateUsername}}</b>'s referral offer: Subscribe in
21+
<b>{{@discount.affiliateReferral.affiliateLink.affiliateName}}</b>'s referral offer: Subscribe in
2222
<span class="font-bold percy-timestamp font-mono text-lg border-b border-yellow-500 border-dashed">{{this.timeLeftText}}</span>
2323
to get
2424
<span class="font-bold">40% off</span>

app/models/affiliate-link.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ export default class AffiliateLinkModel extends Model {
99

1010
@hasMany('affiliate-referral', { async: false, inverse: 'affiliateLink' }) declare referrals: AffiliateReferralModel[];
1111

12-
@attr('string') declare affiliateUsername: string;
12+
@attr('string') declare affiliateName: string;
1313
@attr('string') declare affiliateAvatarUrl: string;
1414
@attr('string') declare slug: string;
1515
@attr('string') declare url: string;

app/templates/join-course.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{page-title (concat "Join " this.model.affiliateLink.affiliateUsername " on CodeCrafters") replace=true}}
1+
{{page-title (concat "Join " this.model.affiliateLink.affiliateName " on CodeCrafters") replace=true}}
22

33
{{! Note: This is very similar to the course overview page atm so it re-uses a lot of the same components. }}
44
<div class="container mx-auto lg:max-w-(--breakpoint-lg) pt-6 md:pt-10 pb-10 px-3 md:px-6">

app/templates/join-track.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{page-title (concat "Join " this.model.affiliateLink.affiliateUsername " on CodeCrafters") replace=true}}
1+
{{page-title (concat "Join " this.model.affiliateLink.affiliateName " on CodeCrafters") replace=true}}
22

33
{{! Note: This is very similar to the track page atm so it re-uses a lot of the same components. }}
44
<div class="container mx-auto lg:max-w-(--breakpoint-lg) px-3 md:px-6 py-6 md:py-10">

app/templates/join.hbs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{{page-title (concat "Join " this.model.affiliateLink.affiliateUsername " on CodeCrafters") replace=true}}
1+
{{page-title (concat "Join " this.model.affiliateLink.affiliateName " on CodeCrafters") replace=true}}
22

33
<div class="bg-white bg-github-green-dot-wall">
44
<div class="container mx-auto lg:max-w-(--breakpoint-xl) pt-8 sm:pt-16 pb-48 px-3 md:px-6">
@@ -41,7 +41,7 @@
4141

4242
<div class="flex flex-col gap-4 justify-center items-center mt-16">
4343
<AffiliateLinkPage::AcceptReferralButton @affiliateLink={{this.model.affiliateLink}} />
44-
<div class="text-xs text-slate-700 text-center">Get access to 40% off via @{{@model.affiliateLink.affiliateUsername}}</div>
44+
<div class="text-xs text-slate-700 text-center">Get access to 40% off via @{{this.model.affiliateLink.affiliateName}}</div>
4545
</div>
4646

4747
<h2 class="text-2xl font-bold text-gray-900 md:text-3xl text-center mt-16">
@@ -56,7 +56,7 @@
5656

5757
<div class="flex flex-col gap-4 justify-center items-center mt-16">
5858
<AffiliateLinkPage::AcceptReferralButton @affiliateLink={{this.model.affiliateLink}} />
59-
<div class="text-xs text-slate-700 text-center">Get access to 40% off via @{{@model.affiliateLink.affiliateUsername}}</div>
59+
<div class="text-xs text-slate-700 text-center">Get access to 40% off via @{{this.model.affiliateLink.affiliateName}}</div>
6060
</div>
6161
</div>
6262
</div>

tests/acceptance/affiliate-link-page/accept-referral-offer-test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ module('Acceptance | affiliate-link-page | accept-referral-offer', function (hoo
4242

4343
this.server.create('affiliate-link', {
4444
user: referrer,
45-
affiliateUsername: 'sarupbanskota',
45+
affiliateName: 'sarupbanskota',
4646
affiliateAvatarUrl: 'https://avatars.githubusercontent.com/u/1234567890?v=4',
4747
});
4848

tests/acceptance/pay-test.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,8 @@ module('Acceptance | pay-test', function (hooks) {
118118

119119
const affiliateLink = this.server.create('affiliate-link', {
120120
user: user,
121+
affiliateName: 'rohitpaulk',
122+
affiliateAvatarUrl: 'https://avatars.githubusercontent.com/u/1234567890?v=4',
121123
});
122124

123125
const affiliateReferral = this.server.create('affiliate-referral', {

0 commit comments

Comments
 (0)