Search Communities: Add hidden communisties in list if you are a manager
This commit is contained in:
parent
cbb35da785
commit
3786d98ec5
|
@ -1 +1 @@
|
|||
Subproject commit 045665ae107501603df4ad02ed95c9842c9c8a3e
|
||||
Subproject commit 02efeb40382226445223ad82088b8387a2368180
|
|
@ -10,7 +10,6 @@ import {CommunitiesService} from "../../openaireLibrary/connect/communities/comm
|
|||
import {Session, User} from "../../openaireLibrary/login/utils/helper.class";
|
||||
import {CommunityInfo} from "../../openaireLibrary/connect/community/communityInfo";
|
||||
import {StringUtils} from "../../openaireLibrary/utils/string-utils.class";
|
||||
import {HelperFunctions} from "../../openaireLibrary/utils/HelperFunctions.class";
|
||||
import {UserManagementService} from "../../openaireLibrary/services/user-management.service";
|
||||
import {Breadcrumb} from "../../openaireLibrary/utils/breadcrumbs/breadcrumbs.component";
|
||||
import {NewSearchPageComponent} from "../../openaireLibrary/searchPages/searchUtils/newSearchPage.component";
|
||||
|
@ -78,11 +77,9 @@ export class SearchCommunitiesComponent {
|
|||
}
|
||||
|
||||
public ngOnInit() {
|
||||
var firstLoad = true;
|
||||
this.properties = properties;
|
||||
this.piwikSiteId = this.properties.piwikSiteId;
|
||||
this.baseUrl = this.properties.searchLinkToCommunities;
|
||||
|
||||
this.subscriptions.push(this.route.queryParams.subscribe(params => {
|
||||
this.searchPage.resultsPerPage = 10;
|
||||
this.keyword = (params['fv0'] ? params['fv0'] : '');
|
||||
|
@ -100,7 +97,7 @@ export class SearchCommunitiesComponent {
|
|||
this.selectedFields = [];
|
||||
this.searchPage.prepareSearchPage(this.fieldIds, this.selectedFields, this.refineFields, [], this.fieldIdsMap, null, params, "community", null);
|
||||
|
||||
let queryParams = params;//this.searchPage.getQueryParamsFromUrl(params);
|
||||
let queryParams = params;
|
||||
if (typeof document !== 'undefined') {
|
||||
this.subscriptions.push(this.userManagementService.getUserInfo().subscribe(user => {
|
||||
this.user = user;
|
||||
|
@ -140,11 +137,7 @@ export class SearchCommunitiesComponent {
|
|||
this.totalResults[i].isSubscribed = Session.isSubscribedTo('community', this.totalResults[i].communityId, this.user);
|
||||
}
|
||||
}
|
||||
if (this.user) {
|
||||
this._getResults(params);
|
||||
} else {
|
||||
this._getResults(params);
|
||||
}
|
||||
this._getResults(params);
|
||||
},
|
||||
err => {
|
||||
this.handleError('Error getting communities', err);
|
||||
|
@ -177,22 +170,11 @@ export class SearchCommunitiesComponent {
|
|||
private showCommunities() {
|
||||
let ret: CommunityInfo[] = [];
|
||||
for (let result of this.results) {
|
||||
if (result.status == 'hidden') {
|
||||
continue;
|
||||
} else if (result.status == "manager") {
|
||||
|
||||
let mail = (this.user) ? this.user.email : null;
|
||||
if (mail == null) { // no user
|
||||
// continue;
|
||||
ret.push(result); // we want to show the private results as well (disabled though)
|
||||
} else if (Session.isCommunityCurator(this.user) || Session.isPortalAdministrator(this.user)) {
|
||||
ret.push(result);
|
||||
} else if (result.managers.indexOf(mail) != -1) {
|
||||
ret.push(result);
|
||||
}
|
||||
continue;
|
||||
if (result.status == 'hidden' && result.isManager) {
|
||||
ret.push(result);
|
||||
} else if (result.status == "manager" || result.status == "all") {
|
||||
ret.push(result);
|
||||
}
|
||||
ret.push(result);
|
||||
}
|
||||
this.results = ret;
|
||||
}
|
||||
|
@ -202,7 +184,6 @@ export class SearchCommunitiesComponent {
|
|||
* keyword searching, filter, paging and sorting.
|
||||
*
|
||||
* @param params
|
||||
* @param status
|
||||
*/
|
||||
public applyParams(params: Map<string, string>) {
|
||||
this.showCommunities();
|
||||
|
|
Loading…
Reference in New Issue