EUDAT-B2SHARE / b2share

B2SHARE software for the EUDAT CDI services.
https://b2share.eudat.eu
GNU General Public License v2.0
35 stars 33 forks source link

The "(admin page)" link on the community admin profile page is broken #1834

Closed defnull closed 3 years ago

defnull commented 3 years ago

The Admin role of the community "Test" (admin page) link on the profile page points to /communities/undefined/admin.

hevp commented 3 years ago

Hello, thanks for reporting.

Unfortunately I cannot replicate this. Can you retrace your steps here from creating the community to displaying the link?

And you mean the user profile page I presume?

defnull commented 3 years ago

Yes, the /user profile page.

I followed the instructions verbatim. I created a test community, added a schema, added myself to it as a community admin, and that's it.

The /api/user/ response contains roles.0.name = com:632b602f9368473aa33654aad53b931e:admin and the /api/communities/ response also lists the same role in hits.hits.0.roles.admin.name, so the server-side state is correct I guess. Adding a breakpoint in user.jsx line 134 (within communitiesListTemp.reduce()) reveals that the reduction never happens, even if communitiesListTemp.size > 1 is true. I'd guess communitiesListTemp is of wrong type. This react stuff is really hard to debug, though. Since communitiesList is now empty, the createLink() function will build a link with undefined in it, even if the name parameter is correct.

hevp commented 3 years ago

Most likely the resulting object is never properly initialized on the reduce call and therefore it has the wrong type judging by the logs.

This has been addressed, code refactored and will be included in the next release.