Commit graph

46 commits

Author SHA1 Message Date
5d577db649 Oops, load the data for the bulk item quantity form on the trades page! 2024-01-21 06:42:24 -08:00
470c805880 Save last trade activity time onto User
In impress-2020, we do a big slow query to figure out which users have
been active in trades recently. Now, we cache that timestamp on the
User model.

This won't have any immediate effect; it's to clear the way for Classic
DTI to receive the better trade ratios feature people like from 2020.

I also added some unit testing infra because I finally wanted it! for
all the ways you can trigger this timestamp lol

Note too that this is a bit of an unusually complex migration, but my
hope is that the batching and query structure and such helps it run
surprisingly fast! 🤞
2024-01-19 00:00:46 -08:00
7a3aa609ba Use the main app for outfit saving, not impress-2020
This came in a few parts!
1. Add meta tags to let us know we're logged in.
2. Install React Query, which has the data-loading sensibilities I like
   about Apollo without the GraphQL that has honestly been a drag.
3. Replace the outfit-loading and outfit-saving calls with API calls to
   the main app.
4. Update the main app's API calls to use our more flexible data
   constructs like "pose".

Would've loved to do this more incrementally, but it's hard to! You
can't split out outfit-loading and outfit-saving, or auth from any of
that, or the state gets all out-of-sorts.

Still, this is a good nugget we've pulled out all-in-all, and one that
people have been asking for! Can maybe look to logged-in item search
soon too, for own/want data?
2023-11-02 16:54:35 -07:00
0e7bbd526f Clarify the error behavior on AuthUser syncing
I added bangs to signify they're mutative operations, but also the bang on `create!` helps ensure we'll bail if User creation fails for some reason.
2023-10-23 19:05:08 -07:00
eee097a9f8 Sync AuthUser and User names
Callbacks are handy for this!
2023-10-23 19:05:07 -07:00
621a0bc211 Mark some more relationships as optional
I noticed this was stopping changing your default list visibility bc contact neopets connection can't be empty, so I fixed that!

And then I just decided to scroll through every `belongs_to` relationship and add optional to the ones that jumped out at me lol
2023-10-23 19:05:07 -07:00
700e26d7df Remove old OpenNeo ID auth code
This removes login/logout/session logic for integrating with OpenNeo ID, replacing them with stubs that just redirect to `/?TODO` when you click login, and helpers that act as if you're not logged in.

This gives us a clean slate to plug in new Devise logic to integrate with the `openneo_id` database directly!
2023-10-23 19:05:07 -07:00
d97c32b5da Upgrade to Rails 5.2.8.1
Some important little upgrades but mostly straightforward!

Note that there's still a known issue where item searches crash, I was hoping that this was a bug in Rails 4.2 that would be fixed on upgading to 5, but nope, oh well!

Also uhh I just got a bit silly and didn't actually mean to go all the way to 5.2 in one go, I had meant to start at 5.0… but tbh the 5.1 and 5.2 changes seem small, and this seems to be working, so. Yeah ok let's roll!
2023-10-23 19:05:05 -07:00
Matchu
fd87b41c17 Oops, add unowned & unwanted support to search!
Uhhh idk how I messed this up, but right, wanting is not the opposite of owning, LOL!
2023-10-23 19:05:04 -07:00
Matchu
248e710fcb Use strong parameters for User 2023-10-23 19:05:04 -07:00
Matchu
6581597d7c Add user:owns/wants back to item search
Not so bad, using a condition on `has_many` `through` was a cute trick!!
2023-10-23 19:05:03 -07:00
Matchu
a29e016555 Update to new scope syntax
Ohh ok, without this change all of our `scope`s were just immediately evaluating the argument and fetching _all_ such matching records immediately, instead of waiting to actually be called. This led to bugs like `pet_type.as_json` returning ALL pet states in the whole db, because the `PetState.emotion_order` scope was being treated as a single predefined query, rather than a query fragment to merge into the current context.

This also explains what happened in 724ed83: that's why things before the scope in the query were being ignored.
2023-10-23 19:05:03 -07:00
Matchu
dcf254a78d finally let people remove all items from the list at once.
I've been doing this manually via email for a long time,
since building new stuff in the logged-in world was a pain in the old env.

But now here we are! Finally, finally :)
2015-07-19 12:35:49 -04:00
ebb0a75b72 whoops; if no contact neopets username, return nil 2014-04-25 23:04:59 -05:00
b2fca6b6c1 closet hangers index uses neopets connections dropdown 2014-01-18 22:50:14 -06:00
72b174c9b3 store all neopets usernames for logged-in users, but breaks closet_hangers#index 2014-01-18 21:55:01 -06:00
8288b8a10d username form, backed by localstorage for guests; not yet backed by db for logged-in users 2014-01-17 11:12:56 -06:00
6b340f906e Cache trade info on items#show, finally! I think it's the performance culprit. 2013-12-27 14:49:46 -05:00
9e3cac82ec use proxies for item html, too
Some lame benchmarking on my box, dev, cache classes, many items:

No proxies:
    Fresh JSON:  175,  90,  90,  93,  82, 88, 158, 150, 85, 167 = 117.8
    Cached JSON: (none)
    Fresh HTML:  371, 327, 355, 328, 322, 346 = 341.5
    Cached HTML: 173, 123, 175, 187, 171, 179 = 168

Proxies:
    Fresh JSON:  175, 183, 269, 219, 195, 178 = 203.17
    Cached JSON:  88,  70,  89, 162,  80,  77 = 94.3
    Fresh HTML:  494, 381, 350, 334, 451, 372 = 397
    Cached HTML: 176, 170, 104, 101, 111, 116 = 129.7

So, overhead is significant, but the gains when cached (and that should be
all the time, since we currently have 0 evictions) are definitely worth
it. Worth pushing, and probably putting some future effort into reducing
overhead.

On production (again, lame), items#index was consistently averaging
73-74ms when super healthy, and 82ms when pets#index was being louder
than usual. For reference is all. This will probably perform
significantly worse at first (in JSON, anyway, since HTML is already
mostly cached), so it might be worth briefly warming the cache after
pushing.
2013-06-26 23:50:19 -07:00
5e55423dca now that we're on rails 3.2, mount resque at /resque - just for
meeeeee :)

`User#admin?` is now defined as `name == 'matchu'`. I feel kinda
bad about hardcoding that, but I also don't care enough right
now :P
2013-03-05 21:09:08 -06:00
a80f70bb88 phew, fixed some issues with contribution saving in rails 3.2 2013-03-05 20:51:24 -06:00
f3d64840d6 filter lists on petpage export 2012-04-08 15:59:51 -05:00
285c7858c0 app can now load environment even if schema not yet loaded 2011-09-06 11:15:09 -05:00
63bc0067c0 user#assign_closeted_to_items! now assigns when there are duplicates 2011-08-03 10:18:03 -04:00
75961abc17 privacy for unlisted hangers 2011-07-30 19:45:28 -04:00
b86ce67c02 first pass at closet lists, including form 2011-07-26 20:27:23 -04:00
033e71e9bf parameterize user params like items, plus a cleaner parameterization scheme 2011-07-26 18:49:52 -04:00
6d155ecaf1 show owned/wanted icons and search filters 2011-07-22 16:52:40 -04:00
c5103b6557 neomail link on closets 2011-07-20 15:16:22 -04:00
3a193d534d closeted icon, all over the place 2011-07-14 13:56:44 -04:00
1c84a4bef9 closet page, closet hanger 2011-07-14 13:56:20 -04:00
dfea1a1097 add extra error tracking to saving user, too 2011-02-23 16:01:43 -05:00
abb29aae4b hopefully raise more descriptive error message when contribution fails to save 2011-02-22 18:45:53 -05:00
8ff6c5ad9c pet state order fix, and maybe some contribution fixes 2011-02-22 17:54:20 -05:00
3aeeac3bfc maybe the redundant += contributions for user is triggering the RecordNotSaved exception. remove that line and see what happens 2011-02-21 12:02:45 -05:00
bcffdc0630 stop using radio and label for pet states, to fix ie bug 2011-02-07 08:46:15 -05:00
8c8776ff63 devise implemented, but not remembering 2011-01-26 13:40:15 -05:00
ca155314fa home page caching, reset top contributors only when necessary 2010-12-11 09:37:39 -05:00
8e6a34b69c fix contributions for pet states and items
dependent contributables would only count as contributed if their parent
was being contributed for the first time, too. the trick was to delay
actually *assigning* them to their parents until the very, very end
2010-11-15 17:56:16 -05:00
6b92c2aa33 loading current user outfit list, deleting outfits, toggling star 2010-11-11 13:43:22 -05:00
7db0beec75 points for bulk pet adding 2010-11-06 19:07:15 -04:00
d10ab2615f actually contributing things, yay 2010-11-06 18:08:45 -04:00
446a117ec8 top contributors 2010-11-06 12:15:10 -04:00
a5b119a9bc contributions viewing 2010-11-06 11:52:58 -04:00
c8acdc4e8d working home page 2010-11-05 18:45:05 -04:00
895c6e721e auth works - yaaay 2010-10-18 17:58:45 -04:00