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
f58076e7
Commit
f58076e7
authored
Jan 09, 2017
by
Brian Jacobel
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't hijack existing context to do this
parent
30f62203
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
14 additions
and
23 deletions
+14
-23
common/static/common/js/discussion/views/discussion_thread_list_view.js
+5
-12
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
+4
-6
common/static/common/templates/discussion/thread-list-item.underscore
+2
-2
lms/djangoapps/discussion/static/discussion/js/views/discussion_user_profile_view.js
+3
-3
No files found.
common/static/common/js/discussion/views/discussion_thread_list_view.js
View file @
f58076e7
...
@@ -93,7 +93,7 @@
...
@@ -93,7 +93,7 @@
this
.
courseSettings
=
options
.
courseSettings
;
this
.
courseSettings
=
options
.
courseSettings
;
this
.
hideRefineBar
=
options
.
hideRefineBar
;
this
.
hideRefineBar
=
options
.
hideRefineBar
;
this
.
supportsActiveThread
=
options
.
supportsActiveThread
;
this
.
supportsActiveThread
=
options
.
supportsActiveThread
;
this
.
profilePage
=
options
.
profilePag
e
||
false
;
this
.
hideReadState
=
options
.
hideReadStat
e
||
false
;
this
.
displayedCollection
=
new
Discussion
(
this
.
collection
.
models
,
{
this
.
displayedCollection
=
new
Discussion
(
this
.
collection
.
models
,
{
pages
:
this
.
collection
.
pages
pages
:
this
.
collection
.
pages
});
});
...
@@ -336,24 +336,17 @@
...
@@ -336,24 +336,17 @@
DiscussionThreadListView
.
prototype
.
renderThread
=
function
(
thread
)
{
DiscussionThreadListView
.
prototype
.
renderThread
=
function
(
thread
)
{
var
threadCommentCount
=
thread
.
get
(
'comments_count'
),
var
threadCommentCount
=
thread
.
get
(
'comments_count'
),
threadUnreadCommentCount
=
thread
.
get
(
'unread_comments_count'
),
threadUnreadCommentCount
=
thread
.
get
(
'unread_comments_count'
),
// @TODO: On the profile page, thread read state for the viewing user is not accessible via the API.
neverRead
=
!
thread
.
get
(
'read'
)
&&
threadUnreadCommentCount
===
threadCommentCount
,
// In this case, neverRead is set to false regardless of read state returned by the API.
// Fix this when the Discussions API can support this query.
neverRead
=
(
!
thread
.
get
(
'read'
)
&&
threadUnreadCommentCount
===
threadCommentCount
&&
!
this
.
profilePage
),
threadPreview
=
this
.
containsMarkup
(
thread
.
get
(
'body'
))
?
''
:
thread
.
get
(
'body'
),
threadPreview
=
this
.
containsMarkup
(
thread
.
get
(
'body'
))
?
''
:
thread
.
get
(
'body'
),
context
=
_
.
extend
(
context
=
_
.
extend
(
{
{
neverRead
:
neverRead
,
neverRead
:
neverRead
,
threadUrl
:
thread
.
urlFor
(
'retrieve'
),
threadUrl
:
thread
.
urlFor
(
'retrieve'
),
threadPreview
:
threadPreview
,
threadPreview
:
threadPreview
,
showThreadPreview
:
this
.
showThreadPreview
showThreadPreview
:
this
.
showThreadPreview
,
hideReadState
:
this
.
hideReadState
},
},
thread
.
toJSON
(),
thread
.
toJSON
()
this
.
profilePage
?
{
unread_comments_count
:
0
}
:
{}
// See comment above about profile page
);
);
return
$
(
this
.
threadListItemTemplate
(
context
).
toString
());
return
$
(
this
.
threadListItemTemplate
(
context
).
toString
());
};
};
...
...
common/static/common/js/spec/discussion/view/discussion_thread_list_view_spec.js
View file @
f58076e7
...
@@ -718,16 +718,14 @@
...
@@ -718,16 +718,14 @@
).
toEqual
(
newCommentsOnUnreadThread
+
' new'
);
).
toEqual
(
newCommentsOnUnreadThread
+
' new'
);
});
});
it
(
'should display every thread as read if profilePage is passed to the constructor'
,
function
()
{
it
(
'should display every thread as read if hideReadState: true is passed to the constructor'
,
function
()
{
// @TODO: This is temporary, see comment in DiscussionThreadListView.prototype.renderThread
this
.
view
=
makeView
(
new
Discussion
(
this
.
threads
),
{
hideReadState
:
true
});
this
.
view
=
makeView
(
new
Discussion
(
this
.
threads
),
{
profilePage
:
true
});
this
.
view
.
render
();
this
.
view
.
render
();
expect
(
this
.
view
.
$
(
'.never-read'
).
length
).
toEqual
(
0
);
expect
(
this
.
view
.
$
(
'.never-read'
).
length
).
toEqual
(
0
);
});
});
it
(
'does not show the "x new" indicator for any thread if profilePage is passed'
,
function
()
{
it
(
'does not show the "x new" indicator for any thread if hideReadState: true is passed'
,
function
()
{
// @TODO: This is temporary, see comment in DiscussionThreadListView.prototype.renderThread
this
.
view
=
makeView
(
new
Discussion
(
this
.
threads
),
{
hideReadState
:
true
});
this
.
view
=
makeView
(
new
Discussion
(
this
.
threads
),
{
profilePage
:
true
});
this
.
view
.
render
();
this
.
view
.
render
();
expect
(
this
.
view
.
$
(
'.forum-nav-thread-unread-comments-count'
).
length
).
toEqual
(
0
);
expect
(
this
.
view
.
$
(
'.forum-nav-thread-unread-comments-count'
).
length
).
toEqual
(
0
);
});
});
...
...
common/static/common/templates/discussion/thread-list-item.underscore
View file @
f58076e7
<li data-id="<%- id %>" class="forum-nav-thread<% if (neverRead) { %> never-read<% } %>">
<li data-id="<%- id %>" class="forum-nav-thread<% if (
!hideReadState &&
neverRead) { %> never-read<% } %>">
<a href="<%- threadUrl %>" class="forum-nav-thread-link">
<a href="<%- threadUrl %>" class="forum-nav-thread-link">
<div class="forum-nav-thread-wrapper-0">
<div class="forum-nav-thread-wrapper-0">
<%
<%
...
@@ -75,7 +75,7 @@
...
@@ -75,7 +75,7 @@
%>
%>
</span>
</span>
<% if (!neverRead && unread_comments_count > 0) { %>
<% if (!
hideReadState && !
neverRead && unread_comments_count > 0) { %>
<span class="forum-nav-thread-unread-comments-count">
<span class="forum-nav-thread-unread-comments-count">
<%-
<%-
StringUtils.interpolate(
StringUtils.interpolate(
...
...
lms/djangoapps/discussion/static/discussion/js/views/discussion_user_profile_view.js
View file @
f58076e7
...
@@ -40,9 +40,9 @@
...
@@ -40,9 +40,9 @@
el
:
this
.
$
(
'.inline-threads'
),
el
:
this
.
$
(
'.inline-threads'
),
courseSettings
:
this
.
courseSettings
,
courseSettings
:
this
.
courseSettings
,
hideRefineBar
:
true
,
// TODO: re-enable the search/filter bar when it works correctly
hideRefineBar
:
true
,
// TODO: re-enable the search/filter bar when it works correctly
//
TODO: remove. Used temporarily to disable read state on profile page. See comment in
//
@TODO: On the profile page, thread read state for the viewing user is not accessible via API.
//
discussion_thread_list_view.js / DiscussionThreadListView.prototype.renderThread
//
Fix this when the Discussions API can support this query. Until then, hide read state.
profilePag
e
:
true
hideReadStat
e
:
true
}).
render
();
}).
render
();
this
.
discussionThreadListView
.
on
(
'thread:selected'
,
_
.
bind
(
this
.
navigateToThread
,
this
));
this
.
discussionThreadListView
.
on
(
'thread:selected'
,
_
.
bind
(
this
.
navigateToThread
,
this
));
...
...
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