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)
(feat): Show "log in to comment" when logged out
· fbc5c0f4
Emiliano Balbuena
authored
Nov 08, 2019
and
Mark Harding
committed
Nov 08, 2019
fbc5c0f4
Merge branch 'goal/log-in-notice-comment-thread' into 'master'
· 9cb3a5b1
Mark Harding
authored
Nov 08, 2019
(feat): Show "log in to comment" when logged out Closes
#2052
See merge request
!631
9cb3a5b1
Hide whitespace changes
Inline
Side-by-side
src/app/modules/comments/list/list.component.scss
View file @
9cb3a5b1
...
...
@@ -404,9 +404,24 @@ m-comments__tree,
font-size
:
12px
;
text-align
:
center
;
margin
:
(
$minds-padding
*
2
)
0
;
@include
m-theme
()
{
color
:
themed
(
$m-grey-300
);
}
a
{
font-weight
:
inherit
;
color
:
inherit
;
cursor
:
pointer
;
b
{
font-weight
:
bold
;
@include
m-theme
()
{
color
:
themed
(
$m-blue
);
}
}
}
}
.m-comments--load-error-label
{
...
...
src/app/modules/comments/poster/poster.component.html
View file @
9cb3a5b1
<div
class=
"m-comment m-comment--poster minds-block"
*ngIf=
"!readonly"
>
<div
class=
"m-comment m-comment--poster minds-block"
*ngIf=
"!readonly && isLoggedIn"
>
<div
class=
"minds-avatar"
>
<a
[routerLink]=
"['/', session.getLoggedInUser().username]"
>
<img
[src]=
"getAvatar()"
class=
"mdl-shadow--2dp"
/>
...
...
@@ -146,3 +149,18 @@
</div>
</div>
</div>
<div
class=
"m-comments--start-conversation-label"
*ngIf=
"!isLoggedIn && level < 1"
>
<a
(click)=
"showLoginModal(); $event.preventDefault()"
>
<ng-container
*ngIf=
"!conversation; else loggedOutConversationMessage"
i18n
>
<b>
Log in
</b>
to comment
</ng-container>
<ng-template
#loggedOutConversationMessage
>
<ng-container
i18n
>
<b>
Log in
</b>
to send a message
</ng-container>
</ng-template>
</a>
</div>
src/app/modules/comments/poster/poster.component.ts
View file @
9cb3a5b1
...
...
@@ -18,6 +18,7 @@ import { Textarea } from '../../../common/components/editors/textarea.component'
import
{
SocketsService
}
from
'
../../../services/sockets
'
;
import
autobind
from
'
../../../helpers/autobind
'
;
import
{
AutocompleteSuggestionsService
}
from
'
../../suggestions/services/autocomplete-suggestions.service
'
;
import
{
SignupModalService
}
from
'
../../modals/signup/service
'
;
@
Component
({
selector
:
'
m-comment__poster
'
,
...
...
@@ -33,6 +34,7 @@ export class CommentPosterComponent {
@
Input
()
readonly
:
boolean
=
false
;
@
Input
()
currentIndex
:
number
=
-
1
;
@
Input
()
conversation
:
boolean
=
false
;
@
Input
()
level
:
number
=
0
;
@
Output
(
'
optimisticPost
'
)
optimisticPost$
:
EventEmitter
<
any
>
=
new
EventEmitter
();
...
...
@@ -47,6 +49,7 @@ export class CommentPosterComponent {
constructor
(
public
session
:
Session
,
public
client
:
Client
,
private
signupModal
:
SignupModalService
,
public
attachment
:
AttachmentService
,
public
sockets
:
SocketsService
,
public
suggestions
:
AutocompleteSuggestionsService
,
...
...
@@ -196,6 +199,14 @@ export class CommentPosterComponent {
return
true
;
// TODO: fix
}
get
isLoggedIn
()
{
return
this
.
session
.
isLoggedIn
();
}
showLoginModal
()
{
this
.
signupModal
.
open
();
}
detectChanges
()
{
this
.
cd
.
markForCheck
();
this
.
cd
.
detectChanges
();
...
...
src/app/modules/comments/thread/thread.component.html
View file @
9cb3a5b1
...
...
@@ -42,6 +42,7 @@
<p
class=
"m-comments--start-conversation-label"
*ngIf=
"
isLoggedIn &&
!inProgress &&
!error &&
comments?.length === 0 &&
...
...
@@ -119,6 +120,7 @@
[entity]=
"entity"
[currentIndex]=
"comments.length - 1"
[conversation]=
"conversation"
[level]=
"level"
(posted)=
"onPosted($event)"
(optimisticPost)=
"onOptimisticPost($event)"
>
...
...
src/app/modules/comments/thread/thread.component.ts
View file @
9cb3a5b1
...
...
@@ -315,6 +315,10 @@ export class CommentsThreadComponent implements OnInit {
return
true
;
}
get
isLoggedIn
()
{
return
this
.
session
.
isLoggedIn
();
}
ngOnChanges
(
changes
)
{
// console.log('[comment:list]: on changes', changes);
}
...
...
src/app/modules/modals/modal.scss
View file @
9cb3a5b1
...
...
@@ -10,7 +10,7 @@ m-modal-signup-on-action {
left
:
0
;
width
:
100%
;
height
:
100%
;
z-index
:
101
;
z-index
:
9999990
;
}
.m-modal-container
{
...
...
src/app/modules/modals/signup/signup.html
View file @
9cb3a5b1
...
...
@@ -2,6 +2,7 @@
[open]=
"open"
(closed)=
"onClose($event)"
*ngIf=
"!session.isLoggedIn() || display != 'initial'"
(click)=
"$event.stopPropagation()"
>
<div
class=
"mdl-card__title"
...
...