Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
be19c1a9
Commit
be19c1a9
authored
Oct 20, 2014
by
Waqas Khalid
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #5610 from mlkwaqas/waqas/tnl607-forum-post-are-uneditable
Post with the discussion id containing dots uneditable
parents
6013c529
9ba03c8a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
48 additions
and
8 deletions
+48
-8
common/static/coffee/spec/discussion/view/discussion_thread_edit_view_spec.js
+47
-7
common/static/coffee/src/discussion/views/discussion_topic_menu_view.js
+1
-1
No files found.
common/static/coffee/spec/discussion/view/discussion_thread_edit_view_spec.js
View file @
be19c1a9
...
...
@@ -26,16 +26,16 @@
};
});
testUpdate
=
function
(
view
,
thread
)
{
testUpdate
=
function
(
view
,
thread
,
newTopicId
,
newTopicName
)
{
spyOn
(
$
,
'ajax'
).
andCallFake
(
function
(
params
)
{
expect
(
params
.
url
.
path
()).
toEqual
(
DiscussionUtil
.
urlFor
(
'update_thread'
,
'dummy_id'
));
expect
(
params
.
data
.
thread_type
).
toBe
(
'discussion'
);
expect
(
params
.
data
.
commentable_id
).
toBe
(
'other_topic'
);
expect
(
params
.
data
.
commentable_id
).
toBe
(
newTopicId
);
expect
(
params
.
data
.
title
).
toBe
(
'changed thread title'
);
params
.
success
();
return
{
always
:
function
()
{}};
});
view
.
$el
.
find
(
'a.topic-title
'
)[
1
]
.
click
();
// set new topic
view
.
$el
.
find
(
'a.topic-title
[data-discussion-id="'
+
newTopicId
+
'"]'
)
.
click
();
// set new topic
view
.
$
(
'.edit-post-title'
).
val
(
'changed thread title'
);
// set new title
view
.
$
(
"label[for$='post-type-discussion']"
).
click
();
// set new thread type
view
.
$
(
'.post-update'
).
click
();
...
...
@@ -43,20 +43,20 @@
expect
(
thread
.
get
(
'title'
)).
toBe
(
'changed thread title'
);
expect
(
thread
.
get
(
'thread_type'
)).
toBe
(
'discussion'
);
expect
(
thread
.
get
(
'commentable_id'
)).
toBe
(
'other_topic'
);
expect
(
thread
.
get
(
'courseware_title'
)).
toBe
(
'Other Topic'
);
expect
(
thread
.
get
(
'commentable_id'
)).
toBe
(
newTopicId
);
expect
(
thread
.
get
(
'courseware_title'
)).
toBe
(
newTopicName
);
expect
(
view
.
$
(
'.edit-post-title'
)).
toHaveValue
(
''
);
expect
(
view
.
$
(
'.wmd-preview p'
)).
toHaveText
(
''
);
};
it
(
'can save new data correctly in tab mode'
,
function
()
{
this
.
createEditView
();
testUpdate
(
this
.
view
,
this
.
thread
);
testUpdate
(
this
.
view
,
this
.
thread
,
'other_topic'
,
'Other Topic'
);
});
it
(
'can save new data correctly in inline mode'
,
function
()
{
this
.
createEditView
({
"mode"
:
"inline"
});
testUpdate
(
this
.
view
,
this
.
thread
);
testUpdate
(
this
.
view
,
this
.
thread
,
'other_topic'
,
'Other Topic'
);
});
testCancel
=
function
(
view
)
{
...
...
@@ -73,5 +73,45 @@
this
.
createEditView
({
"mode"
:
"inline"
});
testCancel
(
this
.
view
);
});
describe
(
'renderComments'
,
function
()
{
beforeEach
(
function
()
{
this
.
course_settings
=
new
DiscussionCourseSettings
({
'category_map'
:
{
'children'
:
[
'Topic'
,
'General'
,
'Basic Question'
],
'entries'
:
{
'Topic'
:
{
'is_cohorted'
:
true
,
'id'
:
'topic'
},
"General"
:
{
"sort_key"
:
"General"
,
"is_cohorted"
:
false
,
"id"
:
"6.00.1x_General"
},
"Basic Question"
:
{
"is_cohorted"
:
false
,
"id"
:
"6>00'1x
\"
Basic_Question"
}
}
},
'is_cohorted'
:
true
});
});
it
(
'can save new data correctly for current discussion id without dots'
,
function
()
{
this
.
createEditView
({
topicId
:
"topic"
});
testUpdate
(
this
.
view
,
this
.
thread
,
"6.00.1x_General"
,
"General"
);
});
it
(
'can save new data correctly for current discussion id with dots'
,
function
()
{
this
.
createEditView
({
topicId
:
"6.00.1x_General"
});
testUpdate
(
this
.
view
,
this
.
thread
,
"6>00'1x
\"
Basic_Question"
,
"Basic Question"
);
});
it
(
'can save new data correctly for current discussion id with special characters'
,
function
()
{
this
.
createEditView
({
topicId
:
"6>00'1x
\"
Basic_Question"
});
testUpdate
(
this
.
view
,
this
.
thread
,
"6.00.1x_General"
,
"General"
);
});
});
});
}).
call
(
this
);
common/static/coffee/src/discussion/views/discussion_topic_menu_view.js
View file @
be19c1a9
...
...
@@ -40,7 +40,7 @@
this
.
selectedTopic
=
this
.
$
(
'.js-selected-topic'
);
this
.
hideTopicDropdown
();
if
(
this
.
getCurrentTopicId
())
{
this
.
setTopic
(
this
.
$
(
'a.topic-title'
).
filter
(
'[data-discussion-id=
'
+
this
.
getCurrentTopicId
()
+
'
]'
));
this
.
setTopic
(
this
.
$
(
'a.topic-title'
).
filter
(
'[data-discussion-id=
"'
+
this
.
getCurrentTopicId
()
+
'"
]'
));
}
else
{
this
.
setTopic
(
this
.
$
(
'a.topic-title'
).
first
());
}
...
...
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