Skip to content

Commit

Permalink
[#3009] Mark new activities terminology consistent
Browse files Browse the repository at this point in the history
Always use new/old activities, don't mix in other terms like
read/unread, seen/unseen.
  • Loading branch information
Sean Hammond committed Nov 15, 2012
1 parent af925e2 commit aed806f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions ckan/controllers/user.py
Expand Up @@ -503,9 +503,9 @@ def dashboard(self, id=None):

c.dashboard_activity_stream = h.dashboard_activity_stream(id)

# Mark the user's new activities as read whenever they view their
# Mark the user's new activities as old whenever they view their
# dashboard page.
get_action('dashboard_mark_activities_as_read')(context, {})
get_action('dashboard_mark_all_new_activities_as_old')(context, {})

return render('user/dashboard.html')

Expand Down
2 changes: 1 addition & 1 deletion ckan/logic/action/get.py
Expand Up @@ -2267,7 +2267,7 @@ def dashboard_new_activities_count(context, data_dict):
return len([activity for activity in activities if activity['is_new']])


def dashboard_mark_activities_as_read(context, data_dict):
def dashboard_mark_all_new_activities_as_old(context, data_dict):
'''Mark all the authorized user's new dashboard activities as old.
This will reset dashboard_new_activities_count to 0.
Expand Down
8 changes: 4 additions & 4 deletions ckan/tests/functional/api/test_dashboard.py
Expand Up @@ -74,10 +74,10 @@ def dashboard_new_activities(self, user):
activity_list = self.dashboard_activity_list(user)
return [activity for activity in activity_list if activity['is_new']]

def dashboard_mark_activities_as_read(self, user):
def dashboard_mark_all_new_activities_as_old(self, user):
params = json.dumps({})
response = self.app.post(
'/api/action/dashboard_mark_activities_as_read',
'/api/action/dashboard_mark_all_new_activities_as_old',
params=params,
extra_environ={'Authorization': str(user['apikey'])})
assert response.json['success'] is True
Expand All @@ -104,7 +104,7 @@ def test_02_own_activities_do_not_count_as_new(self):
# We would have to do this if, when you follow something, you only get
# the activities from that object since you started following it, and
# not all its past activities as well.
self.dashboard_mark_activities_as_read(self.new_user)
self.dashboard_mark_all_new_activities_as_old(self.new_user)

# Create a new dataset.
params = json.dumps({
Expand Down Expand Up @@ -189,6 +189,6 @@ def test_06_mark_new_activities_as_read(self):
her dashboard activity stream.'''
assert self.dashboard_new_activities_count(self.new_user) > 0
assert len(self.dashboard_new_activities(self.new_user)) > 0
self.dashboard_mark_activities_as_read(self.new_user)
self.dashboard_mark_all_new_activities_as_old(self.new_user)
assert self.dashboard_new_activities_count(self.new_user) == 0
assert len(self.dashboard_new_activities(self.new_user)) == 0

0 comments on commit aed806f

Please sign in to comment.