seanmorley15 / AdventureLog

Self-hostable travel tracker and trip planner.
https://adventurelog.app
Other
396 stars 12 forks source link

Allowing other users to edit/add items to a collection/adventure #282

Closed Snuupy closed 5 days ago

Snuupy commented 2 weeks ago

When I share a collection or adventure with someone, it might be because I'm going on a trip with them! I'd like them to be able to add things to the itinerary as well so everything is neat and organized when we go. Right now, I think I'd have to share an account or something for them to be able to add items, but with a feature that would allow others to edit shared collection data, they can also use their own account.

seanmorley15 commented 2 weeks ago

This idea is definitely on the roadmap. I will keep this issue updated! Thanks

seanmorley15 commented 2 weeks ago

Update: I am currently working on this feature in the development branch. This is a two step process.

  1. Add Users tab to web-ui to explore other public users and view their public adventures and collections. (DONE)
  2. Add ability to link users to the adventure/collection as a shared user, this will allow them to edit it and add new adventures to collections. There will also be a "Shared with Me" tab to see what users have shared with you. Additionally if a user shares an adventure with you, you can add it to your own profile to mark as visited.

This update is large and will probably take a little while longer. Thanks a lot and let me know if there is anything I am missing!

Snuupy commented 2 weeks ago

Wow you really did think this through properly! That seems to be all for this feature. I can't think of anything else related to this right now that would be necessary. I'd be happy to test this too when we're there and provide feedback :)

Please take your time with dev - this app is a huge stress reliever for disorganized people like me and is great for staying organized for travels.

seanmorley15 commented 6 days ago

Good news @Snuupy!! Sharing is now ready to be tested in the sharing branch. I will be merging it soon but there are just a few other things I want to test first. If you want to test it, you can just switch to the sharing branch and comment out the image on the docker-compose file and uncomment the build image line for both the frontend and backend. This update has been one of the hardest yet but I know this will be amazing for collaborative planning. There are also a few minor changes unrelated to sharing as well (such as the aesthetic dark theme which is my new favorite)

I hope you enjoy!!

Snuupy commented 6 days ago

@seanmorley15 I'm testing it now. Looks great! I created a 2nd user to test sharing. If you create a collection (shared or not), add an adventure, then try to update it, you get an error so it looks like adventures in collections aren't able to be updated.

here are the logs:

adventurelog-backend   | "GET /auth/user/ HTTP/1.1" 200 243
adventurelog-backend   | Bad Request: /api/adventures/53a5ef86-e577-4efd-bd60-30e3022ebb91/
adventurelog-backend   | "PATCH /api/adventures/53a5ef86-e577-4efd-bd60-30e3022ebb91/ HTTP/1.1" 400 66
adventurelog-backend   | 2024 Spain
adventurelog-backend   | "GET /auth/user/ HTTP/1.1" 200 243
adventurelog-backend   | 2024 Spain
adventurelog-backend   | Bad Request: /api/adventures/53a5ef86-e577-4efd-bd60-30e3022ebb91/
adventurelog-backend   | "PATCH /api/adventures/53a5ef86-e577-4efd-bd60-30e3022ebb91/ HTTP/1.1" 400 66

I am able to see the shared collection of adventures under "Shared With Me". I just can't edit adventures in collections (shared or not) for some reason, not sure why.

Aesthetic dark is the best theme. I did want an AMOLED black theme to save my eyes and you did it before I even put in a feature request for it! 🎉

seanmorley15 commented 5 days ago

@Snuupy yes, you are totally right. The issue was the is_public variable being mismatched between the adventures, now they are set to the value of the collection. Now if you link a public adventure to private collection it will become private. The only minor thing is that the public/private chip on the card will not change until refresh due to a this operation using an older method of fetching (long story short its insignificant right now but I will fix it later and its totally functional at the moment). Feel free to keep testing because this kind of thing is hard to ensure it works unless everyone tries their own workflows! I plan to release this update sometime this week, hopefully Friday! Thanks!

Snuupy commented 5 days ago

Somehow I managed to break the login for the admin user. I missed collecting the log, but it was something to do with editing an adventure and even though I'm using the right password for the user (as confirmed with both my password manager and the API on port 8000), it refuses to log in. Maybe the user got corrupted. I am resetting the db now to see if I can reproduce lol

I think it's when the collection is public but the adventure is private and I try to update it or something, I saw an error line that said error, found 2 or something instead of finding 1

so somehow something duplicated and that causes the user to not be able to log in no matter what (even though a forced password reset via API)

I will keep playing with this

seanmorley15 commented 5 days ago

@Snuupy, this is interesting, I have not heard of this message before. Assuming you are just testing around with it, I would delete the db and volumes and try again with this new patch because something most likely got messed up in the process. Sorry this happened, keep me posted!

Also, before releasing a new version I always do a migration test from an older version and the most recent commits passed so this should not be an issue between the different production versions.

Snuupy commented 5 days ago

yeah I'll pull the latest commits and try to break it again with db from scratch, no worries! it's what happens with alpha/pre-release software :)

I was able to pull the (originally very little) data I had off of a shared collection (teehee) from another user that could still login, lol so no data lost 😂

let me see if I can break it again...

Snuupy commented 5 days ago

Yeah it happened again, it's to do with changing the username for the admin, logout, then try to login with the new username

seanmorley15 commented 5 days ago

@Snuupy, I just deployed a fresh version of AdventureLog sharing branch version and changed all of the fields on admin then logged back in successfully. Are you able to provide a list of steps to reproduce this issue? Thanks a lot for your help!

Snuupy commented 4 days ago

Aha! I see what happened. It's only on usernames with capitals in them (such as Snuupy, or Abc, or Admin) 😅 This applies to both admins and users.

Apologies for the lack of clarity - it was due to moving parts and fast changing code (a good thing!)

I am on main branch now on latest commit as of writing (5df1c4cba92b6785a2bdc69cff6cc581b9784eba)

Steps to reproduce:

  1. clone github repo on main, uncomment build lines
  2. docker compose build
  3. verify docker build images:
    root@snuminipc:~/AdventureLog/src# docker images
    REPOSITORY                                       TAG                IMAGE ID       CREATED         SIZE
    ghcr.io/seanmorley15/adventurelog-frontend       latest             44c9de6d754a   2 minutes ago   328MB
    ghcr.io/seanmorley15/adventurelog-backend        latest             f32587353f59   3 minutes ago   1.33GB
  4. docker compose up -d && docker compose logs -f
  5. navigate to url, click login using admin:admin
  6. go to https://adventurelog.domain.tld/settings (user settings)
  7. under Username, change from admin to Abc
  8. log out
  9. try to login with Abc:admin
  10. see that it borks
  11. Note that you cannot log in with BOTH abc AND Abc. You are now locked out.

Now...I wonder if I can regain access somehow now. I actually don't know if this is related to the sharing feature or not, I just discovered it while playing with it. Could be a separate issue actually.

Edit: also I think notifications like "success" etc. should be at the bottom right, not top right (blocks user/hamburger menus)

Edit 2: and now I am nitpicking, but dates (under Itinerary by Date) should be left-aligned, either center + left aligned, OR left side with some padding, but not center + center aligned. And the map should be centered, not left aligned (also imo). See wanderlog as an example. The details under it should have an indent, and then also left aligned.

Edit 3: line breaks/tabs in adventure description (or any text block/description) should be rendered on page

Edit 4: this one is a bit bigger, create a collection, set date to middle of the month to 1st week of another month, create adventure, select lodging, select the entire span of the trip. See that for some reason the last few days are missing the lodging even though it should have it.

image image

All in all, this is a great project and I'm really glad you made this and are improving it! Thought I'd just point out a few things I've learned to notice throughout my career :)

seanmorley15 commented 4 days ago

@Snuupy, thank you so much for taking the time to figure these things out. The login and username change issue has been fixed in the main branch. If you need to fix a broken user, go into the admin panel at server_url+/admin go to users and select the affected user. Then change their username to all lowercase. Also, I have change to toast so its still top right but its not all that way at the top so it does not block the menu (let me know if this is too much of a workaround, I just like the top right because it looks better for mobile). I am going to take a look at the other things you have mentioned and get those addressed as well, I just wanted to fix the login one first because its more critical. The other issues will be moved here - #200 Thanks a lot!

Snuupy commented 4 days ago

@seanmorley15 I think Edit 4 is the biggest issue of the ones that aren't fixed yet since it's misleading/confusing when something is listed from date A to B but it is displayed for less days than that. It makes the user think they aren't staying at a place for that long when they are supposed to be.

top right with padding for notifs is fine (I haven't tested yet), just as long as the buttons aren't covered lol

thank you! I will take a look to see if I run into anything else :)