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
b543a03ef00005989188a02ba95e3045ed0e8799...4aeffc2adb6c8b02420b8f1dec6cec141d5d68fc
Source
4aeffc2adb6c8b02420b8f1dec6cec141d5d68fc
Select Git revision
...
Target
b543a03ef00005989188a02ba95e3045ed0e8799
Select Git revision
Compare
Commits (2)
(chore): Move remaining templates to .html files
· b4888938
Emiliano Balbuena
authored
16 hours ago
b4888938
(refactor): Use a single endpoint to fetch Pro channel and current user
· 4aeffc2a
Emiliano Balbuena
authored
15 hours ago
4aeffc2a
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
79 additions
and
82 deletions
+79
-82
channel.component.ts
src/app/modules/pro/channel/channel.component.ts
+3
-4
channel.service.ts
src/app/modules/pro/channel/channel.service.ts
+32
-32
login.component.html
src/app/modules/pro/channel/login/login.component.html
+28
-0
login.component.ts
src/app/modules/pro/channel/login/login.component.ts
+1
-30
group-tile.component.html
...modules/pro/channel/tiles/group/group-tile.component.html
+14
-0
group-tile.component.ts
...p/modules/pro/channel/tiles/group/group-tile.component.ts
+1
-16
No files found.
src/app/modules/pro/channel/channel.component.ts
View file @
4aeffc2a
...
...
@@ -206,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
)
{
...
...
@@ -251,8 +251,7 @@ export class ProChannelComponent implements OnInit, AfterViewInit, OnDestroy {
this
.
detectChanges
();
try
{
await
this
.
channelService
.
auth
();
this
.
channel
=
await
this
.
channelService
.
load
(
this
.
username
);
this
.
channel
=
await
this
.
channelService
.
loadAndAuth
(
this
.
username
);
this
.
bindCssVariables
();
this
.
setTitle
();
}
catch
(
e
)
{
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/channel.service.ts
View file @
4aeffc2a
...
...
@@ -29,7 +29,7 @@ export interface NavItems {
isActive
:
()
=>
boolean
;
}
type
PaginationParams
=
{
limit
?:
number
,
offset
?:
any
};
type
PaginationParams
=
{
limit
?:
number
;
offset
?:
any
};
type
FeedsResponse
=
{
content
:
Array
<
any
>
;
offset
:
any
;
...
...
@@ -55,7 +55,7 @@ export class ProChannelService implements OnDestroy {
protected
modalService
:
OverlayModalService
,
protected
sessionStorage
:
SessionsStorageService
,
protected
router
:
Router
,
protected
site
:
SiteService
,
protected
site
:
SiteService
)
{
this
.
listen
();
}
...
...
@@ -72,38 +72,57 @@ export class ProChannelService implements OnDestroy {
this
.
isLoggedIn$
.
unsubscribe
();
}
async
load
(
id
:
string
)
{
async
load
AndAuth
(
id
:
string
)
{
try
{
this
.
currentChannel
=
void
0
;
await
this
.
reload
(
id
);
const
response
=
(
await
this
.
client
.
get
(
`api/v2/pro/channel/
${
id
}
`
))
as
{
channel
;
me
?;
};
this
.
currentChannel
=
response
.
channel
;
if
(
this
.
site
.
isProDomain
&&
response
.
me
)
{
this
.
session
.
login
(
response
.
me
);
}
if
(
!
this
.
currentChannel
.
pro_settings
.
tag_list
)
{
this
.
currentChannel
.
pro_settings
.
tag_list
=
[];
}
this
.
onChannelChange
.
next
(
this
.
currentChannel
);
this
.
featuredContent
=
null
;
return
this
.
currentChannel
;
}
catch
(
e
)
{
if
(
e
.
status
===
0
)
{
throw
new
Error
(
'
Sorry, there was a timeout error.
'
);
throw
new
Error
(
'
Network error
'
);
}
else
{
console
.
log
(
"
couldn't load channel
"
,
e
);
throw
new
Error
(
"
Sorry, the channel couldn't be found
"
);
throw
new
Error
(
'
Error loading channel
'
);
}
}
}
async
reload
(
id
:
string
)
{
const
response
:
MindsChannelResponse
=
(
await
this
.
client
.
get
(
`api/v1/channel/
${
id
}
`
))
as
MindsChannelResponse
;
try
{
const
response
=
(
await
this
.
client
.
get
(
`api/v2/pro/channel/
${
id
}
`
))
as
{
channel
;
me
?;
};
this
.
currentChannel
=
response
.
channel
;
this
.
onChannelChange
.
next
(
this
.
currentChannel
);
this
.
currentChannel
=
response
.
channel
;
this
.
onChannelChange
.
next
(
this
.
currentChannel
);
return
this
.
currentChannel
;
return
this
.
currentChannel
;
}
catch
(
e
)
{
if
(
e
.
status
===
0
)
{
throw
new
Error
(
'
Network error
'
);
}
else
{
throw
new
Error
(
'
Error loading channel
'
);
}
}
}
async
getFeaturedContent
():
Promise
<
Array
<
any
>>
{
...
...
@@ -291,25 +310,6 @@ export class ProChannelService implements OnDestroy {
}
}
async
auth
()
{
if
(
!
this
.
site
.
isProDomain
)
{
// Not in Pro domain mode, user already injected
return
;
}
try
{
const
response
=
(
await
this
.
client
.
get
(
'
api/v1/channel/me
'
))
as
any
;
if
(
response
&&
response
.
channel
)
{
this
.
session
.
login
(
response
.
channel
);
}
}
catch
(
e
)
{
if
(
!
e
||
e
.
message
!==
'
The user could not be found
'
)
{
console
.
error
(
e
);
}
}
}
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
'
);
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/login/login.component.html
0 → 100644
View file @
4aeffc2a
<section
class=
"m-ProChannelLogin--hero"
>
<div
class=
"m-ProChannelLogin--hero--inner"
>
<div
class=
"m-ProChannelLogin--hero--slogans"
>
<h2>
{{ settings?.headline }}
</h2>
</div>
<div
class=
"m-ProChannelLogin--login"
>
<ng-container
*ngIf=
"currentSection === 'login'"
>
<span
class=
"m-proChannelLogin--subtext"
>
Not on {{ settings?.title }}?
<a
(click)=
"currentSection = 'register'"
>
Start a Minds channel
</a>
</span>
<minds-form-login
(done)=
"registered()"
></minds-form-login>
</ng-container>
<ng-container
*ngIf=
"currentSection === 'register'"
>
<span
class=
"m-proChannelLogin--subtext"
>
<a
(click)=
"currentSection = 'login'"
>
I already have a Minds account
</a>
</span>
<minds-form-register
(done)=
"registered()"
></minds-form-register>
</ng-container>
</div>
</div>
</section>
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/login/login.component.ts
View file @
4aeffc2a
...
...
@@ -7,36 +7,7 @@ import { Storage } from '../../../../services/storage';
@
Component
({
selector
:
'
m-pro--channel-login
'
,
template
:
`
<section class="m-ProChannelLogin--hero">
<div class="m-ProChannelLogin--hero--inner">
<div class="m-ProChannelLogin--hero--slogans">
<h2>{{ settings?.headline }}</h2>
</div>
<div class="m-ProChannelLogin--login">
<ng-container *ngIf="currentSection === 'login'">
<span class="m-proChannelLogin--subtext">
Not on {{ settings?.title }}?
<a (click)="currentSection = 'register'">Start a Minds channel</a>
</span>
<minds-form-login (done)="registered()"></minds-form-login>
</ng-container>
<ng-container *ngIf="currentSection === 'register'">
<span class="m-proChannelLogin--subtext">
<a (click)="currentSection = 'login'">
I already have a Minds account
</a>
</span>
<minds-form-register (done)="registered()"></minds-form-register>
</ng-container>
</div>
</div>
</section>
`
,
templateUrl
:
'
login.component.html
'
,
})
export
class
ProChannelLoginComponent
{
username
:
string
;
...
...
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/tiles/group/group-tile.component.html
0 → 100644
View file @
4aeffc2a
<div
class=
"banner"
>
<img
[src]=
"getBanner()"
/>
</div>
<div
class=
"m-proChannelGroupTile__content"
>
<div
class=
"avatar"
>
<img
[src]=
"getAvatar()"
/>
</div>
<div
class=
"body"
>
<h2>
{{ this.entity.name }}
</h2>
<p
i18n
>
Subscribers:
<span>
{{ this.entity['members:count'] }}
</span>
</p>
</div>
</div>
This diff is collapsed.
Click to expand it.
src/app/modules/pro/channel/tiles/group/group-tile.component.ts
View file @
4aeffc2a
...
...
@@ -8,22 +8,7 @@ import {
@
Component
({
selector
:
'
m-pro--channel--group-tile
'
,
template
:
`
<div class="banner">
<img [src]="getBanner()" />
</div>
<div class="m-proChannelGroupTile__content">
<div class="avatar">
<img [src]="getAvatar()" />
</div>
<div class="body">
<h2>{{ this.entity.name }}</h2>
<p i18n>
Subscribers: <span>{{ this.entity['members:count'] }}</span>
</p>
</div>
</div>
`
,
templateUrl
:
'
group-tile.component.html
'
,
})
export
class
ProGroupTileComponent
{
@
Input
()
entity
:
any
;
...
...
This diff is collapsed.
Click to expand it.