Join GitHub today
Mark and remove inactive users from a group #868
As mentioned in #853, it would be nice to remove inactive users from a group:
Questions were raised by @djahnie
I think activity should be counted per group and read/write access should both be counted as activity. It will therefore be possible to get removed from a group while being active in another one. It will also be possible to stay active by just visiting the group from time to time.
I agree on your definition of activity and that it has to be counted per group.
What are the first steps to implementing something like this? I guess a new field in the database that has the binary choice of being set to 'active' or 'inactive' is needed, as well as some code, that counts the time since the last activity of a user. This is more of a backend task, am I right?
(In case this is not obvious, I'm trying to find more starter tasks...^^)
This also ties a bit into my ponderings on how to record activity in general (so it's clearer which people/groups are actively using it) - my ponderings led me to think in terms of 3 levels of activity:
Maybe it's also useful to distinguish between users that are active online (writing messages, editing things, etc) and passive ones (just click around a bit), but maybe not...
Historic data is better stored in influxdb I think and exported periodically, but the application also would/might/should have some historic data too, where it makes sense for the logic of the application (I think the application should not read from influxdb).
Perhaps a storage format for inside the application would be an activity table and record into time buckets per user+group, e.g.
So, actually, rethinking as I write, if we need to only know the last activity then could store that directly in the user/group join table (
... or even just repurpose the history table, and check when their last activity was (although that does not record things like logging in, but could (and just filter it from the normal view), but could end up with too much data in there that we don't really need.
The activity table could have counters for each time bucket row too if we wanted to keep track of how much activity too, not just whether there was some.
Seems enough thoughts for now.
@tiltec and I have been looking at this in a bit more detail this morning. We decided to implement the simplest useful answer to the problem which was to add a single "last_seen" field to the GroupMembership model. In terms of the user, the field is intended to represent the last time a user had used Karrot (via a browser or the app) to actively view data associated with a group.
Our initial implementation was to use the current_group field in AuthUser. This worked to some extent, however it was only updated when we use the 'Change group' menu option on a browser. (We also noticed that it is possible to open two different groups in two different browser tabs, which may lead to some issues but didn't seem to break anything.)
We discussed a few options:
Option 2 probably resolves the potential problems from option 1, but might have some new issues?
This was referenced
Feb 28, 2018
Option 2 is now working and has a mark_user_active endpoint.
We now envisage the following tasks:
referenced this issue
Feb 28, 2018
The current backend implementation marks a user as
#957 marks inactive users in the member list.