Skip to content

Universal nav integration updates #689

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jmgasper opened this issue Dec 6, 2022 · 4 comments
Closed

Universal nav integration updates #689

jmgasper opened this issue Dec 6, 2022 · 4 comments

Comments

@jmgasper
Copy link
Collaborator

jmgasper commented Dec 6, 2022

Issue 1

I've integrated Tool Navigation and the Footer Navigation with a hard-coded user in the forum theme.
We should add and fix several files in the forums repo(https://github.com/topcoder-platform/forums) to implement all requiremets.
'We have to ensure that it displays properly for: Anonymous (not logged in) user + Logged in user'
The forums theme uses Smarty templates. Smarty is a web template system written in PHP, facilitating the separation of presentation (HTML/CSS) from application logic. Vanilla Forums uses Topcoder JWT token to authenticate users and we need to use the data in smarty templates from session. Unfortunately, we have access to Vanilla User only, not Topcoder User in smart templates. We need to write some logic and commit several files in the forums repo(https://github.com/topcoder-platform/forums) to implement this requirements.

Issue 2

We need to update config files in the forums repo to support both envs (PROD/DEV) and make URLs to be configurable for the forum-theme.
In the submission section: 'You must submit a patch file against commit hash 2500e65 of the "dev" branch of the forums-theme Github repo'. What commit hash of the forums repo(https://github.com/topcoder-platform/forums) should be used?
Please let me know if there are no changes in the scope of the challenge.

@atelomycterus
Copy link
Collaborator

atelomycterus commented Dec 6, 2022

@jmgasper The question about user fields. Universal Nav displays user initials at the top of the page. JWT token doesn't contain user initials. I've also looked at a member payload and there are no user initails.
image

In the challenge the tc-website (topcoder-archive/tc-website@e51ce08) is mentioned for reference. In this commit you can see that user initials are s calculated as the first two letter from user handle. This is not correct and perhaps this is by mistake. Please let me know if you are ok with that.

Updated: I implemented issue 1 and issues 2. I am waiting for the commit in the forums-theme. Let me know when I can push the code in repos (forum, Topcoder plugin and theme)

@jmgasper
Copy link
Collaborator Author

jmgasper commented Dec 6, 2022

I think using the first two from the user's handle is fine here, thanks.

@atelomycterus
Copy link
Collaborator

atelomycterus commented Dec 7, 2022

@jmgasper Please apply PRS:

Thanks!

Configuration

  1. You can configure UniversalNavUrl in forums\config\vanilla\config.php. The current configuration:
$Configuration['Theme']['UniversalNavUrl'] = getenv('VANILLA_ENV') === 'prod'? '//uni-nav.topcoder.com/v1/tc-universal-nav.js':'//uni-nav.topcoder-dev.com/v1/tc-universal-nav.js';
  1. User Id Claim, Photo Url Claim also are availble in congi.php and they can be configured in Topcoder Plugin as User name claim. The current configuration:
$Configuration['Plugins']['Topcoder']['SSO']['TopcoderHS256']['UserIDClaim'] = getenv('VANILLA_ENV') == 'prod'? 'https://topcoder.com/userId' : 'https://topcoder-dev.com/userId';
$Configuration['Plugins']['Topcoder']['SSO']['TopcoderRS256']['UserIDClaim'] = getenv('VANILLA_ENV') == 'prod'? 'https://topcoder.com/userId' : 'https://topcoder-dev.com/userId';
$Configuration['Plugins']['Topcoder']['SSO']['TopcoderHS256']['PhotoUrlClaim'] = getenv('VANILLA_ENV') == 'prod'? 'picture' : 'picture';
$Configuration['Plugins']['Topcoder']['SSO']['TopcoderRS256']['PhotoUrlClaim'] = getenv('VANILLA_ENV') == 'prod'? 'picture' : 'picture';

Testing

image

Please let me know if you have any questuions.

@jmgasper
Copy link
Collaborator Author

jmgasper commented Dec 8, 2022

@atelomycterus - All looks good, thanks!

@jmgasper jmgasper closed this as completed Dec 8, 2022
@jmgasper jmgasper added this to the v1.9.5 milestone Dec 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants