reflow-project / weloop

WeLoop is a React/TypeScript client for ZenPub and a key component of ReflowOS
https://weloop.reflowproject.eu
GNU Affero General Public License v3.0
5 stars 5 forks source link

Unable to find my new user in dropdown when creating a new Resource #87

Closed viktorsmari closed 3 years ago

viktorsmari commented 3 years ago

Problem: How can new users create new Resources?

How to reproduce:

  1. Create a new account and sign in
  2. Create a new Resource
  3. You don't see your name available in the select dropdowns (receiver and provider)

This means it's not possible for new users to create resources.

Can we use this query instead in receiver and provider?

{users(limit:30) {
  edges {
    id
    name
  }
}}

Or use the agents

{agents {
  id
}}
oksanasalohubova commented 3 years ago

I tried to get all users and put it in the list of receivers and providers but - if I try to set my name fore action in which my name does not showed in filtered list - I got a bad request - You are not provider or receiver!

How can new users create new Resources? - the answer is : backend team allow to create Resources for all users already after registration

And after this fixes we need uncomment function above in frontend and pass it's result in providers and receivers list

viktorsmari commented 3 years ago

@oksanasalohubova if my new user first does this:

mutation {
  createEconomicEvent(
    event: {
      action: "transfer",
      note: "lalala"
    },
    newInventoriedResource: {
      name: "New inventory via ecoEvent"
    }
  )
  {
    economicEvent {
      id
      note
    }
  }
}

After this query, the user is now able to select his name from the receiver and provider dropdown in the new Resource modal.

Can we enable create a new Resource using this method? 2021-06-29_10-08-33

Is there an easier way, using this mutation, that we can use to create a new inventory?

viktorsmari commented 3 years ago

We added a 'quick hack' to add new users to the RECEIVER list. In order to create a new Resource via event and be able to transfer it to yourself, your username needs to be in the provider and receiver list.

This button which is now under My profile executes the mutation in the previous comment:
2021-06-29_20-51-49

oksanasalohubova commented 3 years ago

https://github.com/reflow-project/weloop/pull/93 new PR

Now you will see new user in provider and receiver list immediately after registration and login I set agent list as provider and receiver

I have not found a way to get a timely update of the list of providers and receivers without reloading the page If this solution is acceptable, then the Create default Economic Event to become a provide button is no longer needed, but it remains in the code, in case the user suddenly does not appear in the list of agents.

viktorsmari commented 3 years ago

Issue fixed after using agents query instead of user query!