-
Notifications
You must be signed in to change notification settings - Fork 37
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
[#433] connects nation community (connects #433) #440
Conversation
src/app/home/home.component.html
Outdated
@@ -29,10 +29,10 @@ | |||
<p class="menu-item-text" *ngIf="notification.doc.status==='unread' && notification.doc.link ===''"> | |||
{{notification.doc.message}} {{notification.doc.time | date: 'MMM d, yyyy'}} | |||
</p> | |||
<p *ngIf="notification.status!=='unread' && notification.doc.link"> |
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.
These changes from the Duplicate notification
commit should be removed as they are for a different PR. Please make sure to begin branches from the master
branch.
@Rupesh87 I think different entities. That way we avoid conflicts if the uuid assigned locally to the configuration is the same as one that already exists on the nation in communityregistrationrequests. An unlikely scenario, but it's easy for us to avoid. Also, please make sure to fix linting errors before pushing: |
community.registrationRequest = 'accepted'; | ||
this.couchService.get('_users/_all_docs?include_docs=true') | ||
.subscribe((data) => { | ||
data.rows.map(data => { |
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.
This block includes 4 levels of nested CouchDB requests/subscribes, 3 of which are nested in a map
.
- Please do not loop over even 1 couch request. Use _bulk_docs instead.
- Do not nest subscribes. Create different functions and/or use the switchMap rxjs operator to clean this up.
Please add karma test if possible |
src/app/shared/couchdb.service.ts
Outdated
@@ -14,8 +14,8 @@ export class CouchService { | |||
return Object.assign({}, this.defaultOpts, opts) || this.defaultOpts; | |||
} | |||
|
|||
private couchDBReq(type: string, db: string, opts: any, data?: any) { | |||
const url = this.baseUrl + db; | |||
private couchDBReq(type: string, db: string, opts: any, data?: any, parentLink?: any) { |
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.
We should include parentLink in the opts variable and adjust the rest of the code to match. I'd rather we have one optional parameter for the methods available on the CouchService.
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.
@paulbert httpRequest is using opts so we used another optional (parentLink). If we are going to include parentLink inside opts then we have to remove parentLink while requesting. so which approach we should follow???
'password': this.loginForm.value.password, | ||
roles: [], | ||
'type': 'user', | ||
'isUserAdmin': true, |
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.
isUserAdmin should only be set on the local user, not the parent user
this.couchService.post('communityregistrationrequests', configuration, {}, configuration.parent_domain) | ||
]).debug('Sending request to parent planet').subscribe((data) => { | ||
userDetail['request_id'] = data[3].id; | ||
this.couchService.put('/_users/org.couchdb.user:' + this.loginForm.value.username, |
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.
Please use switchMap rather than nesting observables.
A few things noted today:
I think these should be dealt with in a new issue, but if any of these can be fixed quickly feel free to add them in this PR. |
Just raising a question: do we want to add a document to We'll have to make some adjustments if so, notably the ids will not match so if we sync the two dbs we will have duplicate sessions recorded. Also we should have a field that stores the nation/community name in the session so we know what the user logged into. |
Yes, we think we need to maintain login activities in parent environment as well. But it is not necessary to do that. So, what’s your plan? Should we remove the login activities to the parent planet ? |
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.
This was poorly merged with the changes to the master. The service should not be reliant on the route, and services should not directly affect a template.
67083a5
to
fa3b24e
Compare
No description provided.