Skip to content
GitLab
Menu
Why GitLab
Pricing
Contact Sales
Explore
Why GitLab
Pricing
Contact Sales
Explore
Sign in
Get free trial
Commits on Source (2)
(fix): canView attribute should also check for permissions feature flag
· 1dee01d8
Marcelo Rivera
authored
Oct 02, 2019
1dee01d8
(fix): spec tests
· 02d78072
Marcelo Rivera
authored
Oct 02, 2019
02d78072
Hide whitespace changes
Inline
Side-by-side
src/app/common/components/post-menu/post-menu.component.spec.ts
View file @
02d78072
...
...
@@ -27,7 +27,7 @@ import { activityServiceMock } from '../../../../tests/activity-service-mock.spe
import
{
storageMock
}
from
'
../../../../tests/storage-mock.spec
'
;
import
{
featuresServiceMock
}
from
'
../../../../tests/features-service-mock.spec
'
;
import
{
Storage
}
from
'
../../../services/storage
'
;
import
{
PermissionsService
}
from
'
../../services/permissions.service
'
;
import
{
PermissionsService
}
from
'
../../services/permissions
/permissions
.service
'
;
import
{
MockService
}
from
'
../../../utils/mock
'
;
/* tslint:disable */
...
...
src/app/modules/channels/channel.component.spec.ts
View file @
02d78072
...
...
@@ -7,13 +7,13 @@ import {
tick
,
}
from
'
@angular/core/testing
'
;
import
{
MockComponent
,
MockDirective
,
MockService
}
from
'
../../utils/mock
'
;
import
{
MockComponent
,
MockService
}
from
'
../../utils/mock
'
;
import
{
CommonModule
as
NgCommonModule
}
from
'
@angular/common
'
;
import
{
Router
,
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
RouterTestingModule
}
from
'
@angular/router/testing
'
;
import
{
Client
}
from
'
../../services/api/client
'
;
import
{
By
,
Title
}
from
'
@angular/platform-browser
'
;
import
{
By
}
from
'
@angular/platform-browser
'
;
import
{
clientMock
}
from
'
../../../tests/client-mock.spec
'
;
import
{
uploadMock
}
from
'
../../../tests/upload-mock.spec
'
;
import
{
sessionMock
}
from
'
../../../tests/session-mock.spec
'
;
...
...
@@ -39,7 +39,7 @@ import { BlockListService } from '../../common/services/block-list.service';
import
{
ChannelMode
}
from
'
../../interfaces/entities
'
;
import
{
ClientMetaService
}
from
'
../../common/services/client-meta.service
'
;
import
{
clientMetaServiceMock
}
from
'
../../../tests/client-meta-service-mock.spec
'
;
import
{
PermissionsService
}
from
'
../../common/services/permissions.service
'
;
import
{
PermissionsService
}
from
'
../../common/services/permissions
/permissions
.service
'
;
describe
(
'
ChannelComponent
'
,
()
=>
{
let
comp
:
ChannelComponent
;
...
...
@@ -185,27 +185,39 @@ describe('ChannelComponent', () => {
const
carousel
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-channel--carousel
'
));
const
sidebar
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-channel--sidebar
'
));
const
feed
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-channel--feed
'
));
expect
(
carousel
).
not
.
toBeNull
();
expect
(
sidebar
).
not
.
toBeNull
();
expect
(
feed
).
not
.
toBeNull
();
comp
.
filter
=
'
supporters
'
;
fixture
.
detectChanges
();
const
supporters
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-channel--supporters
'
)
);
expect
(
supporters
).
not
.
toBeNull
();
comp
.
filter
=
'
subscribers
'
;
fixture
.
detectChanges
();
const
subscribers
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-channel--subscribers
'
)
);
expect
(
subscribers
).
not
.
toBeNull
();
comp
.
filter
=
'
subscriptions
'
;
fixture
.
detectChanges
();
const
subscriptions
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m-channel--subscriptions
'
)
);
expect
(
supporters
).
not
.
toBeNull
();
comp
.
filter
=
'
subscriptors
'
;
expect
(
subscriptions
).
not
.
toBeNull
();
comp
.
filter
=
'
requests
'
;
fixture
.
detectChanges
();
const
subscriptor
s
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m
inds-channel-subscriptors
'
)
const
request
s
=
fixture
.
debugElement
.
query
(
By
.
css
(
'
m
-subscriptionsRequests__list
'
)
);
expect
(
supporter
s
).
not
.
toBeNull
();
expect
(
request
s
).
not
.
toBeNull
();
});
it
(
'
should load() on init
'
,
()
=>
{
...
...
src/app/modules/channels/channel.component.ts
View file @
02d78072
...
...
@@ -9,7 +9,7 @@ import { Session } from '../../services/session';
import
{
ScrollService
}
from
'
../../services/ux/scroll
'
;
import
{
RecentService
}
from
'
../../services/ux/recent
'
;
import
{
MindsUser
}
from
'
../../interfaces/entities
'
;
import
{
ChannelMode
,
MindsUser
}
from
'
../../interfaces/entities
'
;
import
{
MindsChannelResponse
}
from
'
../../interfaces/responses
'
;
import
{
ContextService
}
from
'
../../services/context.service
'
;
import
{
FeaturesService
}
from
'
../../services/features.service
'
;
...
...
@@ -46,7 +46,14 @@ export class ChannelComponent {
@
ViewChild
(
'
feed
'
,
{
static
:
false
})
private
feed
:
ChannelSortedComponent
;
get
canView
()
{
return
this
.
permissions
.
canInteract
(
this
.
user
,
Flags
.
VIEW
);
if
(
this
.
features
.
has
(
'
permissions
'
))
{
return
this
.
permissions
.
canInteract
(
this
.
user
,
Flags
.
VIEW
);
}
return
(
this
.
user
.
mode
!==
ChannelMode
.
CLOSED
||
this
.
user
.
subscribed
||
this
.
user
.
guid
===
this
.
session
.
getLoggedInUser
().
guid
);
}
constructor
(
...
...
src/app/modules/groups/profile/groups-settings-button.spec.ts
View file @
02d78072
...
...
@@ -21,7 +21,7 @@ import { overlayModalServiceMock } from '../../../../tests/overlay-modal-service
import
{
GroupsService
}
from
'
../groups-service
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
import
{
featuresServiceMock
}
from
'
../../../../tests/features-service-mock.spec
'
;
import
{
PermissionsService
}
from
'
../../../common/services/permissions.service
'
;
import
{
PermissionsService
}
from
'
../../../common/services/permissions
/permissions
.service
'
;
let
groupConfig
=
{
countMembers
:
Promise
.
resolve
(
1
),
...
...