Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activities dissappear from UI when internal processes are run by ignored users #5698

Closed
amercader opened this issue Oct 28, 2020 · 0 comments · Fixed by #5699
Closed

Activities dissappear from UI when internal processes are run by ignored users #5698

amercader opened this issue Oct 28, 2020 · 0 comments · Fixed by #5699
Assignees

Comments

@amercader
Copy link
Member

CKAN version
2.0 onwards

Describe the bug
Activities shown on the organization or dashboard activity feed can suddenly disappear and show an empty list, eg:

Screenshot_2020-10-28 Activity Stream - Harvesestion - Organisations - CKAN(1)

to

Screenshot_2020-10-28 Activity Stream - Harvesestion - Organisations - CKAN(2)

Apparently the user didn't change anything on the frontend, and if you check the database, the activities are there.

The problem is how we handle the ckan.hide-activity-from-users configuration option. This allows you to define the users that you don't want to show activities from. It defaults to the internal site user as this is generally used to perform bulk internal processes like harvesting and you don't want to flood the activity stream with their operations.

The problem is that we first get the relevant activities from the database and then filter these activities in Python based on the users in the config option:

ckan/ckan/logic/action/get.py

Lines 2665 to 2671 in ccc582d

_activity_objects = model.activity.organization_activity_list(
org_id, limit=limit, offset=offset)
if not include_hidden_activity:
activity_objects = _filter_activity_by_user(
_activity_objects, _activity_stream_get_filtered_users())
else:
activity_objects = _activity_objects

The default limit is 31 so if we had 6 initial activities that were visible and at some point the site user goes and eg imports 50 datasets, we will get the most recent 31 activities by the site user from the database, and filter them all out so the none will be shown in the UI.

I could not find any reason for this filter to not be applied at the database query level, which is going to be more performant anyway.

Steps to reproduce
Steps to reproduce the behavior:

  • Create an organization
  • Perform some actions, eg update the org, create a dataset
  • Run a harvester, or create more than 30 datasets using the site user API key (or the key of a user listed in ckan.hide-activity-from-users)

Expected behavior
Activities should not disappear

@amercader amercader self-assigned this Oct 28, 2020
amercader added a commit that referenced this issue Oct 28, 2020
Fixes #5698

The `ckan.hide-activity-from-users` configuration option allows you to define
the users that you don't want to show activities from on the various activity
feeds. It defaults to the internal site user as this is generally used to
perform bulk internal processes like harvesting and you don't want to flood
the activity stream with their operations.

The problem is that we first get the relevant activities from the
database and then filter these activities in Python based on the users
in the config option.

This means that if more activities from the site user were performed
than the limit requested, they are fltered out and you get an empty
feed, eventhough the activities are still there.

These moves the filtering to the model queries.
amercader added a commit that referenced this issue Oct 28, 2020
amercader added a commit that referenced this issue Nov 4, 2020
smotornyuk added a commit that referenced this issue Nov 6, 2020
[#5698] Filter activities from user at the database level
amercader added a commit that referenced this issue Jan 15, 2021
Fixes #5698

The `ckan.hide-activity-from-users` configuration option allows you to define
the users that you don't want to show activities from on the various activity
feeds. It defaults to the internal site user as this is generally used to
perform bulk internal processes like harvesting and you don't want to flood
the activity stream with their operations.

The problem is that we first get the relevant activities from the
database and then filter these activities in Python based on the users
in the config option.

This means that if more activities from the site user were performed
than the limit requested, they are fltered out and you get an empty
feed, eventhough the activities are still there.

These moves the filtering to the model queries.
amercader added a commit that referenced this issue Jan 15, 2021
amercader added a commit that referenced this issue Jan 15, 2021
amercader added a commit that referenced this issue Jan 15, 2021
Fixes #5698

The `ckan.hide-activity-from-users` configuration option allows you to define
the users that you don't want to show activities from on the various activity
feeds. It defaults to the internal site user as this is generally used to
perform bulk internal processes like harvesting and you don't want to flood
the activity stream with their operations.

The problem is that we first get the relevant activities from the
database and then filter these activities in Python based on the users
in the config option.

This means that if more activities from the site user were performed
than the limit requested, they are fltered out and you get an empty
feed, eventhough the activities are still there.

These moves the filtering to the model queries.
amercader added a commit that referenced this issue Jan 15, 2021
amercader added a commit that referenced this issue Jan 15, 2021
amercader added a commit that referenced this issue Jan 15, 2021
Fixes #5698

The `ckan.hide-activity-from-users` configuration option allows you to define
the users that you don't want to show activities from on the various activity
feeds. It defaults to the internal site user as this is generally used to
perform bulk internal processes like harvesting and you don't want to flood
the activity stream with their operations.

The problem is that we first get the relevant activities from the
database and then filter these activities in Python based on the users
in the config option.

This means that if more activities from the site user were performed
than the limit requested, they are fltered out and you get an empty
feed, eventhough the activities are still there.

These moves the filtering to the model queries.
amercader added a commit that referenced this issue Jan 15, 2021
amercader added a commit that referenced this issue Jan 15, 2021
fostermh pushed a commit to cioos-siooc/ckan that referenced this issue Sep 10, 2021
jguo144 pushed a commit to OpenGov-OpenData/ckan that referenced this issue Oct 5, 2021
Fixes ckan#5698

The `ckan.hide-activity-from-users` configuration option allows you to define
the users that you don't want to show activities from on the various activity
feeds. It defaults to the internal site user as this is generally used to
perform bulk internal processes like harvesting and you don't want to flood
the activity stream with their operations.

The problem is that we first get the relevant activities from the
database and then filter these activities in Python based on the users
in the config option.

This means that if more activities from the site user were performed
than the limit requested, they are fltered out and you get an empty
feed, eventhough the activities are still there.

These moves the filtering to the model queries.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant