Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
drupal
Commits
12ead318
Commit
12ead318
authored
Nov 12, 2009
by
Dries
Browse files
- Patch
#613278
by Dave Reid, mfb: fixed forum module and added tests.
parent
e88a2178
Changes
2
Hide whitespace changes
Inline
Side-by-side
modules/forum/forum.module
View file @
12ead318
...
...
@@ -463,7 +463,7 @@ function forum_field_storage_pre_update($obj_type, $object, &$skip_fields) {
foreach
(
$language
as
$delta
)
{
$query
->
values
(
array
(
'nid'
=>
$object
->
nid
,
'title'
=>
$object
->
title
,
'title'
=>
$object
->
title
[
FIELD_LANGUAGE_NONE
][
0
][
'value'
]
,
'tid'
=>
$delta
[
'value'
],
'sticky'
=>
$object
->
sticky
,
'created'
=>
$object
->
created
,
...
...
@@ -1107,14 +1107,14 @@ function _forum_update_forum_index($nid) {
if
(
$count
>
0
)
{
// Comments exist.
$last_reply
=
db_query_range
(
'SELECT cid, name,
timestamp
, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC'
,
array
(
$last_reply
=
db_query_range
(
'SELECT cid, name,
created
, uid FROM {comment} WHERE nid = :nid AND status = :status ORDER BY cid DESC'
,
0
,
1
,
array
(
':nid'
=>
$nid
,
':status'
=>
COMMENT_PUBLISHED
,
)
,
0
,
1
)
->
fetchObject
();
))
->
fetchObject
();
db_update
(
'forum_index'
)
->
fields
(
array
(
'comment_count'
=>
$count
,
'last_comment_timestamp'
=>
$last_reply
->
timestamp
,
'last_comment_timestamp'
=>
$last_reply
->
created
,
))
->
condition
(
'nid'
,
$nid
)
->
execute
();
...
...
modules/forum/forum.test
View file @
12ead318
...
...
@@ -75,6 +75,16 @@ class ForumTestCase extends DrupalWebTestCase {
$this
->
createForumTopic
(
$this
->
forum
,
FALSE
);
$this
->
createForumTopic
(
$this
->
forum
,
FALSE
);
$this
->
drupalGet
(
'node'
);
// Test adding a comment to a forum topic.
$node
=
$this
->
createForumTopic
(
$this
->
forum
,
FALSE
);
$this
->
drupalPost
(
"node/
$node->nid
"
,
array
(
'comment'
=>
$this
->
randomName
()),
t
(
'Save'
));
$this
->
assertResponse
(
200
);
// Test editing a forum topic that has a comment.
$this
->
drupalLogin
(
$this
->
any_user
);
$this
->
drupalPost
(
"node/
$node->nid
/edit"
,
array
(),
t
(
'Save'
));
$this
->
assertResponse
(
200
);
}
/**
...
...
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