-
Notifications
You must be signed in to change notification settings - Fork 24
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
Add Issues Dashboard access by URL #207
Add Issues Dashboard access by URL #207
Conversation
Some implementation details to discuss:
|
For point 4, this is an issue from CATcher -- CATcher-org/CATcher#709 For point 2 (and perhaps 5 as well), do consider creating another PR/Issue for that |
@@ -67,7 +69,7 @@ export class HeaderComponent implements OnInit { | |||
}); | |||
|
|||
this.auth.currentAuthState.subscribe((state) => { | |||
if (auth.isAuthenticated()) { | |||
if (auth.isAuthenticated() && !cacheRepoFromUrlService.hasRepoLocation()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Upon testing, I realised that changing repositories actually leads to having to authenticate again (as you mentioned in your comment). I think it might be good to persist session to sessionStorage in order for better UI/UX. However, I think this works pretty well by itself in the mean time, so let's add it as a separate issue and work on it after this is merged.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think gycgabriel mentioned above that this is an existing issue from CATcher.
When we access pages by manually typing in a new url, it refreshes the whole app. Looking into this, I think we could save the github access token to sessionStorage to prevent re-authentication, but I'm not sure of how secure/safe this would be, considering the scope set for the accessToken
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Overall, nice PR and changes look good to go! Have left a couple comments for review, and once those are done, LGTM 🚀
const repoLocation = this.cacheRepoFromUrlService.repoLocation || this.urlEncodedRepo; | ||
this.repoForm.get('repo').setValue(repoLocation); | ||
|
||
if (this.cacheRepoFromUrlService.hasRepoLocation()) { | ||
this.setupSession(); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
From this, we only set up a session if cacheRepoFromUrlService.repoLocation != null
But setupSession does not use cacheRepoFromUrlService
, and it will never set up the session if we are using the url encoded repo.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi based on my understanding, setupSession does not need cacheRepoFromUrlService
since it only uses the value of the repoForm
's 'repo' field that will be filled up if hasRepoLocation
Regarding the session not being setup if url encoded repo is used, could you clarify why this is so?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, everything looks good to go! 🚀
Hi @vigneshsankariyer1234567890, if the changes are alright could you help me to merge this PR? |
0650c92
into
CATcher-org:main
A follow up note: this kind of features need to be documented in a user guide or else users will never realize they exist. |
Summary:
Fixes #94
Type of change:
Changes Made:
CacheRepoFromUrlService
that provides getter and setter for repoLocation stored in session storageParseUrlParamsGuard::canActivate
that usesCacheRepoFromUrlService
to cache the 'org' and 'repo' params from URL into session storageapp-routing
that usesParseUrlParamsGuard::canActivate
sessionSelectionComponent::autofillRepo
to fill and submit repoform if repoLocation is in session storagecurrentAuthState
inHeaderComponent
now callsopenChangeRepoDialog
only if user is authenticated and repoLocation not in session storageNOT_AUTHENTICATED_ERROR
now thrown for unauthenticated access on protected routesScreenshots:
With valid repo location
With invalid repo location
Proposed Commit Message:
Checklist: