Skip to content
Next
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Switch to GitLab Next
Sign in / Register
Toggle navigation
Minds Frontend
Project
Project
Details
Activity
Releases
Cycle Analytics
Insights
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Locked Files
Issues
843
Issues
843
List
Boards
Labels
Service Desk
Milestones
Merge Requests
46
Merge Requests
46
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Security & Compliance
Security & Compliance
Dependency List
Packages
Packages
List
Container Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Minds
Minds Frontend
Compare Revisions
dee7455ba2ca2d4550e849257059a88c1a3ef69f...3bbbb6d55ccdc3a93ebffe612d5e04e49ee67f1b
Source
3bbbb6d55ccdc3a93ebffe612d5e04e49ee67f1b
Select Git revision
...
Target
dee7455ba2ca2d4550e849257059a88c1a3ef69f
Select Git revision
Compare
Commits (2)
(fix): check logged in status before opening wire modal
· 644a6102
Marcelo Rivera
authored
22 minutes ago
644a6102
(fix): code style // properties should go before methods
· 3bbbb6d5
Marcelo Rivera
authored
12 minutes ago
3bbbb6d5
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
121 additions
and
103 deletions
+121
-103
channel.component.ts
src/app/modules/pro/channel/channel.component.ts
+98
-92
channel.service.ts
src/app/modules/pro/channel/channel.service.ts
+23
-11
No files found.
src/app/modules/pro/channel/channel.component.ts
View file @
3bbbb6d5
...
...
@@ -52,6 +52,91 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
@
ViewChild
(
'
overlayModal
'
,
{
static
:
true
})
protected
overlayModal
:
OverlayModalComponent
;
get
currentUser
()
{
if
(
!
this
.
session
.
isLoggedIn
())
{
return
null
;
}
return
this
.
session
.
getLoggedInUser
();
}
get
homeRouterLink
()
{
return
this
.
channelService
.
getRouterLink
(
'
home
'
);
}
get
feedRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
feed
'
,
params
);
}
get
videosRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
videos
'
,
params
);
}
get
imagesRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
images
'
,
params
);
}
get
articlesRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
articles
'
,
params
);
}
get
groupsRouterLink
()
{
return
this
.
channelService
.
getRouterLink
(
'
groups
'
);
}
get
proSettingsLink
()
{
return
[
'
/pro/settings
'
];
}
get
proSettingsHref
()
{
return
window
.
Minds
.
site_url
+
'
pro/settings
'
;
}
get
isProDomain
()
{
return
this
.
site
.
isProDomain
;
}
@
HostBinding
(
'
style.backgroundImage
'
)
get
backgroundImageCssValue
()
{
if
(
!
this
.
channel
)
{
return
'
none
'
;
}
return
`url(
${
this
.
channel
.
pro_settings
.
background_image
}
)`
;
}
@
HostBinding
(
'
class
'
)
get
cssColorSchemeOverride
()
{
if
(
!
this
.
channel
)
{
return
''
;
}
return
`m-theme--wrapper m-theme--wrapper__
${
this
.
channel
.
pro_settings
.
scheme
||
'
light
'
}
`
;
}
constructor
(
protected
element
:
ElementRef
,
protected
session
:
Session
,
...
...
@@ -109,6 +194,10 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
});
}
@
HostListener
(
'
window:resize
'
)
onResize
()
{
this
.
collapseNavItems
=
window
.
innerWidth
<=
768
;
}
setTitle
()
{
if
(
!
this
.
channel
)
{
this
.
title
.
setTitle
(
this
.
username
||
'
Minds Pro
'
);
...
...
@@ -117,8 +206,8 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
const
title
=
[
(
this
.
channel
.
pro_settings
.
title
as
string
)
||
this
.
channel
.
name
||
this
.
channel
.
username
,
this
.
channel
.
name
||
this
.
channel
.
username
,
];
switch
(
this
.
type
)
{
...
...
@@ -166,14 +255,12 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
this
.
channel
=
await
this
.
channelService
.
load
(
this
.
username
);
this
.
bindCssVariables
();
this
.
setTitle
();
if
(
this
.
sessionStorage
.
get
(
'
pro::wire-modal::open
'
))
{
this
.
wire
();
}
}
catch
(
e
)
{
this
.
error
=
e
.
getMessage
();
}
this
.
shouldOpenWireModal
();
this
.
detectChanges
();
}
...
...
@@ -184,6 +271,8 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
this
.
error
=
e
.
getMessage
();
}
this
.
shouldOpenWireModal
();
this
.
detectChanges
();
}
...
...
@@ -213,27 +302,6 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
this
.
channelService
.
wire
();
}
@
HostBinding
(
'
style.backgroundImage
'
)
get
backgroundImageCssValue
()
{
if
(
!
this
.
channel
)
{
return
'
none
'
;
}
return
`url(
${
this
.
channel
.
pro_settings
.
background_image
}
)`
;
}
@
HostBinding
(
'
class
'
)
get
cssColorSchemeOverride
()
{
if
(
!
this
.
channel
)
{
return
''
;
}
return
`m-theme--wrapper m-theme--wrapper__
${
this
.
channel
.
pro_settings
.
scheme
||
'
light
'
}
`
;
}
@
HostListener
(
'
window:resize
'
)
onResize
()
{
this
.
collapseNavItems
=
window
.
innerWidth
<=
768
;
}
search
():
Promise
<
boolean
>
{
return
this
.
router
.
navigate
(
this
.
channelService
.
getRouterLink
(
'
all
'
,
{
query
:
this
.
query
})
...
...
@@ -251,71 +319,9 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
this
.
cd
.
detectChanges
();
}
get
currentUser
()
{
if
(
!
this
.
session
.
isLoggedIn
())
{
return
null
;
}
return
this
.
session
.
getLoggedInUser
();
}
get
homeRouterLink
()
{
return
this
.
channelService
.
getRouterLink
(
'
home
'
);
}
get
feedRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
private
shouldOpenWireModal
()
{
if
(
this
.
sessionStorage
.
get
(
'
pro::wire-modal::open
'
))
{
this
.
wire
();
}
return
this
.
channelService
.
getRouterLink
(
'
feed
'
,
params
);
}
get
videosRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
videos
'
,
params
);
}
get
imagesRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
images
'
,
params
);
}
get
articlesRouterLink
()
{
let
params
;
if
(
this
.
query
)
{
params
=
{
query
:
this
.
query
};
}
return
this
.
channelService
.
getRouterLink
(
'
articles
'
,
params
);
}
get
groupsRouterLink
()
{
return
this
.
channelService
.
getRouterLink
(
'
groups
'
);
}
get
proSettingsLink
()
{
return
[
'
/pro/settings
'
];
}
get
proSettingsHref
()
{
return
window
.
Minds
.
site_url
+
'
pro/settings
'
;
}
get
isProDomain
()
{
return
this
.
site
.
isProDomain
;
}
}
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/channel.service.ts
View file @
3bbbb6d5
...
...
@@ -6,7 +6,7 @@ import { EntitiesService } from '../../../common/services/entities.service';
import
normalizeUrn
from
'
../../../helpers/normalize-urn
'
;
import
{
OverlayModalService
}
from
'
../../../services/ux/overlay-modal
'
;
import
{
Session
}
from
'
../../../services/session
'
;
import
{
ActivatedRoute
}
from
'
@angular/router
'
;
import
{
ActivatedRoute
,
Router
}
from
'
@angular/router
'
;
import
{
WireCreatorComponent
}
from
'
../../wire/creator/creator.component
'
;
import
{
SessionsStorageService
}
from
'
../../../services/session-storage.service
'
;
import
{
SiteService
}
from
'
../../../services/site.service
'
;
...
...
@@ -29,6 +29,12 @@ export interface NavItems {
isActive
:
()
=>
boolean
;
}
type
PaginationParams
=
{
limit
?:
number
,
offset
?:
any
};
type
FeedsResponse
=
{
content
:
Array
<
any
>
;
offset
:
any
;
};
@
Injectable
()
export
class
ProChannelService
implements
OnDestroy
{
currentChannel
:
MindsUser
;
...
...
@@ -48,7 +54,8 @@ export class ProChannelService implements OnDestroy {
protected
route
:
ActivatedRoute
,
protected
modalService
:
OverlayModalService
,
protected
sessionStorage
:
SessionsStorageService
,
protected
site
:
SiteService
protected
router
:
Router
,
protected
site
:
SiteService
,
)
{
this
.
listen
();
}
...
...
@@ -128,21 +135,15 @@ export class ProChannelService implements OnDestroy {
return
this
.
featuredContent
;
}
async
getContent
({
limit
,
offset
,
}:
{
limit
?:
number
;
offset
?
}
=
{}):
Promise
<
{
content
:
Array
<
any
>
;
offset
:
any
;
}
>
{
async
getContent
(
params
:
PaginationParams
=
{}):
Promise
<
FeedsResponse
>
{
if
(
!
this
.
currentChannel
)
{
throw
new
Error
(
'
No channel
'
);
}
const
endpoint
=
`api/v2/feeds/channel/
${
this
.
currentChannel
.
guid
}
/all/top`
;
const
qs
=
{
limit
:
limit
||
24
,
from_timestamp
:
offset
||
''
,
limit
:
params
.
limit
||
24
,
from_timestamp
:
params
.
offset
||
''
,
sync
:
1
,
exclude
:
(
this
.
currentChannel
.
pro_settings
.
featured_content
||
[]).
join
(
'
,
'
)
||
...
...
@@ -310,7 +311,18 @@ export class ProChannelService implements OnDestroy {
}
wire
()
{
// save into sessionStorage before doing the logged in check so the modal opens after logging in
this
.
sessionStorage
.
set
(
'
pro::wire-modal::open
'
,
'
1
'
);
if
(
!
this
.
session
.
isLoggedIn
())
{
this
.
router
.
navigate
([
'
/login
'
]);
return
;
}
if
(
this
.
session
.
getLoggedInUser
().
guid
==
this
.
currentChannel
.
guid
)
{
return
;
}
this
.
modalService
.
create
(
WireCreatorComponent
,
this
.
currentChannel
,
{
onComplete
:
()
=>
{
...
...
This diff is collapsed.
Click to expand it.