Skip to content

Draft: Rebuild store-edit screen in Vue, plus Rest API for editing store properties

Chris Oelmueller requested to merge salvage-859 into master

Closes store-chain part of #609 (closed) and some small part of #9 (closed) for &3

What does this MR do?

Rebuild the store-edit screen in Vue. Creating a store now only requires the minimum set of fields. A lot of translation handling was also refactored to the new Symfony system or directly moved into Vue.

Most editable store properties are instantly updating in the DB using a set of new REST endpoints. Only location and address picker are still using the old implementation, for now. They should be rebuilt in follow-up merge requests.

The MR also makes it possible again for certain users to add store chain entries to the database.

How confident are you it won't break things if deployed?

That's still to be determined. I noticed some problems with the region chooser but apparently I'm also having those on prod + beta, so it might be a client issue. Otherwise I checked the paths for existing stores and newly created minimal ones. They didn't throw any exceptions or warnings I noticed. The API endpoints were also tested against different permission levels and malformed input.

Links to related issues

This should make it easier to work on the following issues:

How to test

Steps a reviewer can take to verify that this MR does what it says it does e.g.

  1. View existing stores (on the map, on the store page, in the store list etc)
  2. Edit existing stores
  3. Create a new store
  4. Call some of the new API endpoints manually with users who should and shouldn't have access

Screenshots (if applicable)

image

image

image

image

Checklist

  • added a test, or explain why one is not needed/possible...
  • no unrelated changes
  • asked someone for a code review
  • joined #foodsharing-beta channel at https://slackin.yunity.org
  • added an entry to CHANGELOG.md (description, merge request link, username(s))
  • Once your MR has been merged, you are responsible to update the #foodsharing-beta Slack channel about what has been changed here. They will test your work in different browsers, roles or other settings

Main tasks

  • Rest-API for updating the entire set of store properties at once, and global save button to call it
  • alternatively: generic update API for store properties (should be hardened in a second step)
  • simple mapper to translate properties back and forth (de / en)
  • creating new stores should still work
  • figure out a way to integrate address picker, and use its values for the address fields
  • figure out a way to integrate region picker (bezirkChoose) and its custom JS
  • refactor: adjust store acceptance tests to handle the new UI
  • properly translate properties in StoreGateway (happens in frontend right now) => #939
  • basic validation ( + trimming?) for editing /store/data field values => how to branch?
  • double-check how user input is handled (get rid of strip_tags where possible)
  • mitigate XSS potential
  • fix trim property -- docs say the @change event comes after, this is not what happens ( + leading ws is trimmed, trailing is not)
  • UI feedback when saving a changed value
  • easy UI path back to the store view (probably modified breadcrumbs)
  • REBUILD MIGRATION from StoreEdit: validate field + allow null to phinx
  • correct UI feedback, reset model to old value in case of an error
  • refactor: use a transaction for renaming stores

What would be nice to have / could happen in follow-up merge requests?

  • only send bell notifications once the store is "ready" for people to join, instead of upon creation
  • make it possible to create stores with a bare minimum of input, then edit them later
    (or build the new form so it can also handle creating stores)
  • allow modifying the team status here (section "Fetch") either additionally or instead of the store-overview dropdown => !1414 (closed)
  • functionality to create new entries for store-categories => decision: hide for now
  • functionality to create new entries for store-chains (only for some users, see #609 (closed) )
  • automatically insert the new entry into the store-chain picker option list
  • programmatic handling of which fields are required (baked into template right now, visual only)
  • edit-button next to rendered store description => #940 (closed)
  • include hint/info about markdown syntax when editing
  • API testing for the new endpoint(s)
  • move most of the remaining PHP-side option queries into the frontend / grab text from client-side translation?
  • allow setting null values for publicity + sticker (and adjust the store UI everywhere to accept this as possible value for display) #33
  • new store status for stores which don't exist anymore, hide them on map. Closes #786 (closed)
Edited by Christian Walgenbach

Merge request reports