diff --git a/openedx/features/course_bookmarks/plugins.py b/openedx/features/course_bookmarks/plugins.py index 3f24942ae8..17880af8b9 100644 --- a/openedx/features/course_bookmarks/plugins.py +++ b/openedx/features/course_bookmarks/plugins.py @@ -12,7 +12,7 @@ class CourseBookmarksTool(CourseTool): The course bookmarks tool. """ @classmethod - def is_enabled(cls, course_key): + def is_enabled(cls, request, course_key): """ Always show the bookmarks tool. """ diff --git a/openedx/features/course_experience/course_tools.py b/openedx/features/course_experience/course_tools.py index 1057f355bc..76ecb4e857 100644 --- a/openedx/features/course_experience/course_tools.py +++ b/openedx/features/course_experience/course_tools.py @@ -18,7 +18,7 @@ class CourseTool(object): """ @classmethod - def is_enabled(cls, course_key): + def is_enabled(cls, request, course_key): """ Returns true if this tool is enabled for the specified course key. """ diff --git a/openedx/features/course_experience/plugins.py b/openedx/features/course_experience/plugins.py index 611c348382..4cb091544f 100644 --- a/openedx/features/course_experience/plugins.py +++ b/openedx/features/course_experience/plugins.py @@ -3,13 +3,15 @@ Platform plugins to support the course experience. This includes any locally defined CourseTools. """ - from django.core.urlresolvers import reverse from django.utils.translation import ugettext as _ -from . import UNIFIED_COURSE_TAB_FLAG, SHOW_REVIEWS_TOOL_FLAG -from views.course_reviews import CourseReviewsModuleFragmentView from course_tools import CourseTool +from courseware.courses import get_course_by_id +from views.course_reviews import CourseReviewsModuleFragmentView +from views.course_updates import CourseUpdatesFragmentView + +from . import SHOW_REVIEWS_TOOL_FLAG, UNIFIED_COURSE_TAB_FLAG class CourseUpdatesTool(CourseTool): @@ -31,11 +33,13 @@ class CourseUpdatesTool(CourseTool): return 'fa fa-newspaper-o' @classmethod - def is_enabled(cls, course_key): + def is_enabled(cls, request, course_key): """ Returns True if this tool is enabled for the specified course key. """ - return UNIFIED_COURSE_TAB_FLAG.is_enabled(course_key) + course = get_course_by_id(course_key) + has_updates = CourseUpdatesFragmentView.has_updates(request, course) + return UNIFIED_COURSE_TAB_FLAG.is_enabled(course_key) and has_updates @classmethod def url(cls, course_key): @@ -64,7 +68,7 @@ class CourseReviewsTool(CourseTool): return 'fa fa-star' @classmethod - def is_enabled(cls, course_key): + def is_enabled(cls, request, course_key): """ Returns True if this tool is enabled for the specified course key. """ diff --git a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html index 21abafd7fe..8f858d31db 100644 --- a/openedx/features/course_experience/templates/course_experience/course-home-fragment.html +++ b/openedx/features/course_experience/templates/course_experience/course-home-fragment.html @@ -75,7 +75,7 @@ from openedx.features.course_experience.course_tools import CourseToolsPluginMan

${_("Course Tools")}