Skip to content

Commit

Permalink
Chore: Update chapterable functionality
Browse files Browse the repository at this point in the history
This will add a `#chapterable` method to both chapter ambassadors and
club ambassadors, that will refer the either their chapter or club
respectively.

Refs: #5349
  • Loading branch information
shaun-technovation committed Feb 4, 2025
1 parent 322254b commit d95fb17
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
4 changes: 1 addition & 3 deletions app/controllers/ambassador_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,7 @@ def current_ambassador
end

def current_chapterable
@current_chapterable ||= current_ambassador.chapter ||
current_ambassador.club ||
::NullChapter.new
@current_chapterable ||= current_ambassador.chapterable || ::NullChapter.new
end

def current_profile
Expand Down
3 changes: 2 additions & 1 deletion app/models/chapter_ambassador_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -127,9 +127,10 @@ def community_connections_viewed?
viewed_community_connections
end

def chapter
def chapterable
account.current_primary_chapter
end
alias_method :chapter, :chapterable

def chapterable_type
"chapter"
Expand Down
3 changes: 2 additions & 1 deletion app/models/club_ambassador_profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,10 @@ def onboarding?
!onboarded?
end

def club
def chapterable
account.current_primary_club
end
alias_method :club, :chapterable

def chapterable_type
"club"
Expand Down

0 comments on commit d95fb17

Please sign in to comment.