codidact / qpixel

Q&A-based community knowledge-sharing software
https://codidact.com
GNU Affero General Public License v3.0
397 stars 68 forks source link

add profile links from other communities #1409

Closed cellio closed 2 months ago

cellio commented 2 months ago

Minimally addresses https://github.com/codidact/qpixel/issues/284 by adding an "all communities" tab to the user profile to hold links to that user's profile on all other network communities where a profile exists.

Here's a moderator viewing its own tab:

tab with table: community profile link, mod status where applicable, number of posts, rep

And here's how someone else's profile looks:

same table columns, fewer tabs

The guts of the profile tab are separated from the "container" (network.html.erb renders _network.html.erb) to make it easier to pick this up and move it to a truly global place later if we can work out how to do that. (See discussion on the linked issue.) Right now, your network profile is part of your user page on each specific community, just like your inbox is, even though these things are really "higher up".

To support this, I added several "accessor" functions to the user model to go fetch information on specific communities. I followed the pattern of the pre-existing has_ability_on function.

Currently this table shows the number of (undeleted) posts on each community. I was going to separate that out by post type, but post types can be defined in configuration, so that means walking the list of all post types to get their names and counts on each community (some of which might not be enabled on some communities), and I decided to defer that until we decide we need it. If the consensus from user feedback is that we should have that, we can do it as followup work.

This initial implementation does nothing special with sorting, and I believe the order will automatically be the same as the site switcher and the dashboard. This implementation also does not give the user a way to change the sort order. A full implementation would be user-customizable, which requires storing settings somewhere. Also, we need to work out the UI for custom ordering.

This implementation does not yet have any user-private information. I once proposed a design that would show you things like where you have new inbox items or flag responses. I'd still like to do that, but even without it, I think a basic list is better than what we have today. As a moderator I have sometimes needed to look at a user's activity on other communities, and neither URL editing nor navigating the users list is satisfactory.

I learned a lot about Ruby/Rails while doing this and probably failed to learn other things. I suspect there are stylistic anomalies in my code ("no don't do it that way!"), which I hope reviewers will point out so I can fix them.

ws909 commented 2 months ago

For bookkeeping, I’d suggest renaming this to «Listing profile information from across the network», since it isn’t actually a network-profile.

cellio commented 2 months ago

For bookkeeping, I’d suggest renaming this to «Listing profile information from across the network», since it isn’t actually a network-profile.

When you say "renaming", where do you mean?

ws909 commented 2 months ago

When you say "renaming", where do you mean?

PR title; currently named "basic network profile".

cellio commented 2 months ago

Other than a single redo item (the rest are optional suggestions), LGTM at a quick glance (at least from the initial implementation standpoint)!

I addressed your comments -- with luck, in the ways you intended. But I see rubocop is unhappy again, so we might have to undo one of those.