Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
mahara
mahara
Commits
2a3b570b
Commit
2a3b570b
authored
Mar 17, 2016
by
Robert Lyon
Committed by
Gerrit Code Review
Mar 17, 2016
Browse files
Merge "Bug 1171311: Allow group admins to moderate group page comments"
parents
81561648
c45a3413
Changes
2
Hide whitespace changes
Inline
Side-by-side
htdocs/artefact/comment/lib.php
View file @
2a3b570b
...
...
@@ -375,9 +375,17 @@ class ArtefactTypeComment extends ArtefactType {
$artefactid
=
$artefact
->
get
(
'id'
);
}
else
{
$canedit
=
$USER
->
can_moderate_view
(
$view
);
$owner
=
$view
->
get
(
'owner'
);
$isowner
=
$userid
&&
$userid
==
$owner
;
if
(
$group
=
$view
->
get
(
'group'
))
{
$group_admins
=
group_get_admin_ids
(
$group
);
$canedit
=
(
array_search
(
$userid
,
$group_admins
)
!==
false
)
?
true
:
false
;
$owner
=
null
;
$isowner
=
null
;
}
else
{
$canedit
=
$USER
->
can_moderate_view
(
$view
);
$owner
=
$view
->
get
(
'owner'
);
$isowner
=
$userid
&&
$userid
==
$owner
;
}
$artefactid
=
null
;
}
...
...
test/behat/features/artefact/comment/moderate_group_comment.feature
0 → 100644
View file @
2a3b570b
@javascript
@core
@core_artefact
@core_content
@artefact_comment
Feature
:
Moderating group comments
Background
:
Given the following "users" exist
:
|
username
|
password
|
email
|
firstname
|
lastname
|
institution
|
authname
|
role
|
|
userA
|
Kupuhipa1
|
test01@example.com
|
User
|
Eh
|
mahara
|
internal
|
member
|
|
userB
|
Kupuhipa1
|
test02@example.com
|
User
|
Bee
|
mahara
|
internal
|
member
|
|
userC
|
Kupuhipa1
|
test03@example.com
|
User
|
Sea
|
mahara
|
internal
|
member
|
And the following "groups" exist
:
|
name
|
owner
|
description
|
grouptype
|
open
|
invitefriends
|
editroles
|
submittableto
|
allowarchives
|
members
|
staff
|
|
GroupA
|
userA
|
This
is
group
A
|
standard
|
ON
|
ON
|
all
|
ON
|
ON
|
userB
|
|
And the following "pages" exist
:
|
title
|
description
|
ownertype
|
ownername
|
|
Page1
|
Page
one
|
group
|
GroupA
|
And the following "permissions" exist
:
|
title
|
accesstype
|
accessname
|
allowcomments
|
approvecomments
|
|
Page1
|
loggedin
|
loggedin
|
1
|
1
|
Scenario
:
Moderating a group comment when approve comments is turned on
# Adding a comment to a group page as a non-group member
Given
I log in as
"userC"
with password
"Kupuhipa1"
And
I go to portfolio page
"Page1"
And
I set the field
"Message"
to
"This is a comment from userC"
And
I enable the switch
"Make public"
And
I press
"Comment"
Then
I should see
"You have requested that this comment be made public."
And
I log out
# Checking that normal group member is not able to moderate comment
Given
I log in as
"userB"
with password
"Kupuhipa1"
And
I go to portfolio page
"Page1"
Then
I should not see
"This is a comment from userC"
And
I log out
# Moderating the comment as group admin
Given
I log in as
"userA"
with password
"Kupuhipa1"
And
I go to portfolio page
"Page1"
Then
I should see
"This is a comment from userC"
And
I press
"Make public"
\ No newline at end of file
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