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
Bookwyrm groups #1490
Bookwyrm groups #1490
Conversation
adds a group creation form to user dashboard
- add list cards to groups page based on lists page - add sort to members on group page
you probably want this otherwise nothing previously added for group creation will work :-)
- creates groups/user_groups template for listing a user's groups on their user page
- search for users to add to a group - display suggested users on search results screen TODO: actaully enable users to be added! TODO: groups/suggested_users probably could be replaced with some logic in snippets/suggested_users.html
- this will also enable members to be removed easily by managers in a future commit.
- remove GroupList model - add a group foreign key value to List model - remove reference to lists in Group model
Allows 'group' to be blank when saving a list. Removes the 'group' field when saving a list with curation other than 'group' - this stops the list "sticking" to a group after it is changed from group curation to something else.
When creating or editing a list, the group selection dropdown will only appear if the user selects "group" as the curation option (or it is already selected). - fix typo in bookwyrm.js comments - add data-hides trigger for hiding elements after they have been unhidden, where simple toggles are not the right approach
This will allow privacy management to use existing code. Some template updates also are for rationalising how groups are created and edited.
Thanks for these suggestions :-) Re 1 and 2, this was definitely there at some point, so I must have accidentally broken both of those when I was refactoring. If there are no groups it should invite you to make a group with a link that takes you to your Groups page (which has the button to create a group) Re 3 - makes sense, I think moving the searchbox into the main panel is the better solution. Re 4 and 5 I agree but managing state is something I always find tricky so if it can be a follow up PR that would be preferable so I can look into how best to do it and any examples of ways you've handled anything similar. Re 6 - absolutely! Re 7 - sounds straightforward, will add it to the list of other fixes. You should expect a (hopefully) final load of fixes this weekend! |
- don't unnecessarily query DB in List views - use more efficient query in remove_from_group List class method
This reverts commit 41f27a4. I forgot that update() can only be done on a query result, not on an object, so we will need to go back to querying in order to update rather than saving.
Use .save() twice, but with broadcast=False on the second update. This is more efficient than doing a query and update() and avoids the duplicate AP broadcast.
- fix form details not appearing in group member search view - fix query term appearing in main search box when searching for new members - direct request user back to the group rather than the user when adding a user to a group
- require confirmation before removing a member - require confirmation before removing self - make button text less verbose - use more standardised formatting for group editing form - improve button colours - add missing trans tags - reload group page when removing member
Whoops, forgot to add this functionality earlier. - allow owner to delete a group - change all group lists to closed curation with group=False when group deleted
@mouse-reeve LOL so clearly I need some help with tests, I've managed to break ALL of them. Other than that:
Looking forward to seeing this in production once we've sorted out the tests. |
All tests failing is so much better than just some tests failing. It looks like the migrations need to be updated - if you merge in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Once the tests are passing I think this is good to go :)
There are database migrations in main ahead of this branch so they need to be merged in to the branch before we can merge back into main.
Some fediverse applications implement the URL for a group as "https://tavern.town/`groups`/sneakerheads". Bookwyrm could probably accept both Awesome feature tho, |
Thank you! Right now, groups aren't federated (see #1548). In terms of compatibility, the url shouldn't make a difference, since the applications should be providing those in the activitypub serializations |
Wow, this turned out to be bigger than I expected. Apologies, if I make any in future I'll try to break the changes up a bit.
This PR relates to:
#1318
#170
This PR creates:
Group
s that a user can join via aGroupMembership
group
curation option for Book Listsgroup
value for lists, so that lists can be associated with a group for curation purposesGroups do not currently interact with ActivityPub, but could. I am not confident to implement this functionality at this stage, hence not including it, but that's the only reason. I'd be happy to look into this for a later PR. Hopefully I haven't accidentally inluded any AP functionality where it shouldn't be.
Outstanding problems/questions to resolve/things to note
I can't work out how to adjust
privacy_filter
so that Group members can see groups they wouldn't otherwise see (i.e. groups with privacy levels ofdirect
, or offollowers
when the viewer isn't a follower), whilst ensuring that the privacy filter nevertheless works in all other cases (e.g. when a user is blocked). Currently thereforeprivacy_filter
is NOT applied to group list display on group pages (howeverraise_visible_to_user
will still prevent anyone from seeing a list they shouldn't have access to)I re-used some of the user suggestions code for new users, for searching for potential group members. I have, however, created a new filter function to exlude non-local users, for use until groups are AP compliant.
I am assuming that I should not commit anything in the
migrations
directory, and that maintainers will runmakemigrations
where appropriate: let me know if this assumption is wrong.I am not sure what to do about group members who block each other. Currently:
group.user
has blocked a user, the second user cannot access the group page but can access any lists assigned to the group if they are owned by someone else, and can add & delete items on those lists;group.user
creates a list, other members who are blocked by that user cannot see the list (but can see it listed on the group page)The second case could be fixed if
privacy_filter
worked for groups and group lists. The first case may not matter much because a group owner can simply remove any member from the group, but it is a bit weird and not really ideal.I get a
Object of type LocalStream is not JSON serializable
error when attempting to unblock a user in my development environment. I'm not sure whether this is an actual bug in Bookwyrm, a problem with my setup, or if I somehow broke something in the codebase. This may need to be checked!I'm guessing you probably want some tests - I created some new classes and filters. What are the expectations/requirements around this?
Groups
Group
.group.user
may send aGroupMemberInvitation
to any other user as long as they are not blocked either wayGroupMemberInvitation
to create aGroupMembership
.GroupMembership
connecting them to aGroup
) can:List
with acuration
value ofgroup
and assign the List to this groupList
s associated with the group, on the group home pageList
associated with the group, regardless of its privacy value (unless thelist.user
has blocked them)list.user
has blocked them)/group/{id}
Lists
curation
value ofgroup
Group
list.user
.closed
curation with agroup
ofNone
.Notifications
Group members are notified when:
group.user
s (group owners) are notified when:Users are notified when:
group.user
invites them to join a groupAbuse and privacy
I have attempted to think about the potential for abuse and mitigate it, however I've probably missed something, and as noted above there are some outstanding problems to resolve.
list.user
leaves the group and givencuration=private
group.owner
direct
, only group members will be able to access it.privacy_filter
needs to be adjusted, or an alternative created for groups, so that the ability to see the existence of a list is also determined by privacy levels (e.g.direct
lists don't appear on a group's list of Lists)Design
As much as possible all changes are based on existing code and attempt to integrate seamlessly. I'm open to presenting any of the new options differently.