Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
946f23ab
Commit
946f23ab
authored
Sep 16, 2019
by
Piotr Gawron
Browse files
allow user to remove own comment
parent
ff285a55
Changes
3
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
946f23ab
minerva
(
14.0.0
~
beta
.1
)
unstable
;
urgency
=
low
*
Bug
fix
:
allow
user
to
remove
own
comments
(#
931
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Mon
,
16
Sep
2019
21
:
00
:
00
+
0200
minerva
(
14.0.0
~
beta
.1
)
unstable
;
urgency
=
low
*
Bug
fix
:
problem
with
changing
user
role
(#
932
)
...
...
frontend-js/src/main/js/gui/admin/CommentsAdminPanel.js
View file @
946f23ab
...
...
@@ -113,17 +113,18 @@ CommentsAdminPanel.prototype.refreshComments = function () {
comments
=
result
;
return
self
.
getServerConnector
().
getLoggedUser
();
}).
then
(
function
(
user
)
{
var
curatorAccess
=
self
.
getConfiguration
().
getPrivilegeType
(
PrivilegeType
.
IS_CURATOR
);
var
writeAccess
=
self
.
getConfiguration
().
getPrivilegeType
(
PrivilegeType
.
WRITE_PROJECT
);
var
isA
dmin
=
self
.
getConfiguration
().
getPrivilegeType
(
PrivilegeType
.
IS_ADMIN
);
var
a
dmin
Access
=
self
.
getConfiguration
().
getPrivilegeType
(
PrivilegeType
.
IS_ADMIN
);
var
disable
=
true
;
if
(
user
.
hasPrivilege
(
writeAccess
,
self
.
getProject
().
getProjectId
())
||
user
.
hasPrivilege
(
isA
dmin
))
{
if
(
(
user
.
hasPrivilege
(
writeAccess
,
self
.
getProject
().
getProjectId
())
&&
user
.
hasPrivilege
(
curatorAccess
))
||
user
.
hasPrivilege
(
a
dmin
Access
))
{
disable
=
false
;
}
var
dataTable
=
$
(
$
(
"
[name='commentsTable']
"
,
self
.
getElement
())[
0
]).
DataTable
();
var
data
=
[];
for
(
var
i
=
0
;
i
<
comments
.
length
;
i
++
)
{
data
.
push
(
self
.
commentToTableRow
(
comments
[
i
],
disable
));
data
.
push
(
self
.
commentToTableRow
(
comments
[
i
],
disable
&&
comments
[
i
].
getAuthor
()
!==
user
.
getLogin
()
));
}
dataTable
.
clear
().
rows
.
add
(
data
).
draw
();
});
...
...
@@ -169,12 +170,12 @@ CommentsAdminPanel.prototype.commentToTableRow = function (comment, disable) {
}
var
author
=
comment
.
getAuthor
();
if
(
author
===
undefined
)
{
if
(
author
===
undefined
||
author
===
null
)
{
author
=
"
N/A
"
;
}
var
email
=
comment
.
getEmail
();
if
(
email
===
undefined
)
{
if
(
email
===
undefined
||
email
===
null
)
{
email
=
"
N/A
"
;
}
...
...
frontend-js/src/main/js/map/data/Comment.js
View file @
946f23ab
...
...
@@ -25,7 +25,7 @@ function Comment(javaObject) {
this
.
setTitle
(
javaObject
.
title
);
this
.
setContent
(
javaObject
.
content
);
}
this
.
setAuthor
(
javaObject
.
autho
r
);
this
.
setAuthor
(
javaObject
.
owne
r
);
this
.
setEmail
(
javaObject
.
email
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment