Skip to content

Conversation

@Inferus
Copy link
Contributor

@Inferus Inferus commented Jan 18, 2024

Solving issue with friends link

friends_link_in_community_tab.mp4

ctx.hasClas || ctx.me.exists(u => u.hasTitle || u.roles.contains("ROLE_COACH"))

def apply()(using ctx: PageContext) =
def apply(me: lila.user.Me)(using ctx: PageContext) =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fun fact, PageContext already contains me. So if you want, you can revert that change to layout.scala remove the apply parameter and do ctx.me.map(me => a(href := routes.Relation.following(me.username))(trans.friends())),

Copy link
Contributor Author

@Inferus Inferus Jan 18, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah ok, I haven't think about it. I just saw a similar approach with dasher component where me is being passed to dasher as an argument (it is also in the layout file). That's why I did it like that!

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I only knew that one because others correct my code all the time!

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

def apply(me: lila.user.Me)(using ctx: PageContext) would mean that only logged in users can have a top nav menu.

Copy link
Contributor

@schlawg schlawg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where it should go in that menu, maybe last rather than inserting it into the middle, but I definitely think this makes the site better. Friends list should be more prominent on mobile.

@schlawg
Copy link
Contributor

schlawg commented Jan 18, 2024

This is probably a bit of a third rail, but if it's a slots issue - I think this is a better use of that 5th menu item than the additional Donate link. Everyone can see the Donate button right there on the front page. Nobody is going to be browsing the community menu and say "hey, looky here - I did not know this but I can give money to these folks".

topnav(),
ctx.me map { me =>
topnav(me)
},
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this removes the entire top nav menu for users that are not logged in. Also preventing them from logging in.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it!

@ornicar
Copy link
Collaborator

ornicar commented Jan 18, 2024

@ornicar ornicar merged commit b54a778 into lichess-org:master Jan 18, 2024
ornicar added a commit to schlawg/lila that referenced this pull request Jan 19, 2024
* master: (29 commits)
  remove snabbdom hack
  remove snabbdom hack
  check that keyboard functions are available during parsing
  mirror the keyboardMove optional functions
  remove unused functions
  Update play-json to 3.0.2
  Fixed formatting
  Fixed berserk sound playing even when round doesn't support berserk
  Fixed berserk sound playing even when round doesn't support berserk
  Added condition for playing berserk sound
  Removed unnecessary comment
  use existing TS function instead of hardcoding game state ID
  use existing game & player scala functions
  Feat: friends link in community (lichess-org#14499)
  fix homepage simul link - closes lichess-org#14433
  fix homepage feed display in bot mode, col-4 - closes lichess-org#14495
  [Mobile] Add "follow" to single pref API
  Only select published updates for non-feed-curator users
  reveal pieces on main board on game completion
  show mini-board pieces for completed games
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants