Skip to content
Projects
Groups
Snippets
Help
Sign in / Register
Toggle navigation
Minds Frontend
Project overview
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
384
Merge Requests
55
CI / CD
Security & Compliance
Packages
Wiki
Snippets
Members
Collapse sidebar
Close sidebar
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Commits
42585598
Commit
42585598
authored
1 hour ago
by
Marcelo Rivera
Browse files
Options
Download
(fix): disable old onboarding service if the new onboarding feature is enabled
parent
8f06abbe
feat/onboarding
1 merge request
!674
Onboarding
Pipeline
#106623177
failed with stages
in 32 minutes and 17 seconds
Changes
3
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
30 additions
and
7 deletions
+30
-7
src/app/modules/onboarding/channel/onboarding.service.spec.ts
View file @
42585598
...
...
@@ -2,6 +2,7 @@ import { ChannelOnboardingService } from './onboarding.service';
import
{
clientMock
}
from
'
../../../../tests/client-mock.spec
'
;
import
{
fakeAsync
}
from
'
@angular/core/testing
'
;
import
{
sessionMock
}
from
'
../../../../tests/session-mock.spec
'
;
import
{
featuresServiceMock
}
from
'
../../../../tests/features-service-mock.spec
'
;
describe
(
'
ChannelOnboardingService
'
,
()
=>
{
let
service
:
ChannelOnboardingService
;
...
...
@@ -9,7 +10,12 @@ describe('ChannelOnboardingService', () => {
beforeEach
(()
=>
{
jasmine
.
clock
().
uninstall
();
jasmine
.
clock
().
install
();
service
=
new
ChannelOnboardingService
(
clientMock
,
sessionMock
);
featuresServiceMock
.
mock
(
'
onboarding-december-2019
'
,
false
);
service
=
new
ChannelOnboardingService
(
clientMock
,
sessionMock
,
featuresServiceMock
);
clientMock
.
response
=
{};
const
url
=
'
api/v2/onboarding/progress
'
;
...
...
This diff is collapsed.
src/app/modules/onboarding/channel/onboarding.service.ts
View file @
42585598
...
...
@@ -5,6 +5,7 @@ import { TokenRewardsOnboardingComponent } from './rewards/rewards.component';
import
{
EventEmitter
}
from
'
@angular/core
'
;
import
{
Client
}
from
'
../../../services/api/client
'
;
import
{
Session
}
from
'
../../../services/session
'
;
import
{
FeaturesService
}
from
'
../../../services/features.service
'
;
export
class
ChannelOnboardingService
{
slides
=
[
...
...
@@ -31,11 +32,15 @@ export class ChannelOnboardingService {
// these are updated per each slide when calculating the next one, except for the first time onboarding
pendingItems
:
Array
<
string
>
=
[];
static
_
(
client
:
Client
,
session
:
Session
)
{
return
new
ChannelOnboardingService
(
client
,
session
);
static
_
(
client
:
Client
,
session
:
Session
,
featuresService
:
FeaturesService
)
{
return
new
ChannelOnboardingService
(
client
,
session
,
featuresService
);
}
constructor
(
private
client
:
Client
,
private
session
:
Session
)
{
constructor
(
private
client
:
Client
,
private
session
:
Session
,
private
featuresService
:
FeaturesService
)
{
this
.
session
.
userEmitter
.
subscribe
(
v
=>
{
if
(
!
v
)
{
this
.
reset
();
...
...
@@ -44,7 +49,12 @@ export class ChannelOnboardingService {
}
async
checkProgress
()
{
if
(
!
this
.
session
.
isLoggedIn
())
return
;
if
(
!
this
.
session
.
isLoggedIn
()
||
this
.
featuresService
.
has
(
'
onboarding-december-2019
'
)
)
{
return
;
}
try
{
const
response
:
any
=
await
this
.
client
.
get
(
'
api/v2/onboarding/progress
'
);
...
...
@@ -58,6 +68,12 @@ export class ChannelOnboardingService {
}
async
showModal
(
force
:
boolean
=
false
)
{
if
(
!
this
.
session
.
isLoggedIn
()
||
this
.
featuresService
.
has
(
'
onboarding-december-2019
'
)
)
{
return
false
;
}
if
(
!
force
)
{
const
status
=
localStorage
.
getItem
(
'
already_onboarded
'
);
...
...
@@ -108,7 +124,7 @@ export class ChannelOnboardingService {
// empty is 1 because username is always there from the beginning
this
.
currentSlide
++
;
}
else
{
//here we just go to the next slide with incomplete stuff
//
here we just go to the next slide with incomplete stuff
const
i
=
this
.
currentSlide
+
1
;
this
.
pendingItems
=
[];
...
...
This diff is collapsed.
src/app/modules/onboarding/onboarding.module.ts
View file @
42585598
...
...
@@ -22,6 +22,7 @@ import { TokenRewardsOnboardingComponent } from './channel/rewards/rewards.compo
import
{
Client
}
from
'
../../services/api/client
'
;
import
{
SuggestionsModule
}
from
'
../suggestions/suggestions.module
'
;
import
{
Session
}
from
'
../../services/session
'
;
import
{
FeaturesService
}
from
'
../../services/features.service
'
;
@
NgModule
({
imports
:
[
...
...
@@ -49,7 +50,7 @@ import { Session } from '../../services/session';
OnboardingService
,
{
provide
:
ChannelOnboardingService
,
deps
:
[
Client
,
Session
],
deps
:
[
Client
,
Session
,
FeaturesService
],
useFactory
:
ChannelOnboardingService
.
_
,
},
],
...
...
This diff is collapsed.
Please
register
or
sign in
to comment