(Fix) Don't reset DB IDs when .torrent is selected#5269
(Fix) Don't reset DB IDs when .torrent is selected#5269Oha-you wants to merge 2 commits intoHDInnovations:developmentfrom
Conversation
PR Summary
|
|
Adding another commit here. UNIT3D/resources/js/unit3d/helper.js Line 191 in 735b4b7 Introduced after the split happened: #4563 But I think just checking if the title is set should be enough. I doubt people set DB IDs first when they upload a torrent anyway. |
b45f1ce to
c91499f
Compare
| id="torrent" | ||
| required | ||
| @change="uploadExtension.hook(); cat = $refs.catId.value" | ||
| @change="uploadExtension.hook()" |
There was a problem hiding this comment.
I believe the reason this code is needed is because the uploadExtension.hook() changes #autocat's value, and alpine.js's x-model down below doesn't register this change and update its value, so it has to be done manually.
There was a problem hiding this comment.
You were right. But what if we trigger the change event in JS instead of the template?
Please see the updated commit.
Tested it with Movies and TV category selected by default, then added a TV/Movie torrent.
@change event was triggered and DB ID inputs got updated.
This discussion helped: alpinejs/alpine#1388
c91499f to
ddcdcb1
Compare
To reproduce:
Note: this doesn't happen when you change the category first.
But it does happen if you set it on page load with
torrents/create?category_id=2I'm not sure why
cat = $refs.catId.valuewas needed in@changeoriginally for #2243Because
catis assigned here anyway:UNIT3D/resources/views/torrent/create.blade.php
Lines 44 to 48 in 735b4b7
Values are reset because they listen to
catchanges:UNIT3D/resources/views/torrent/create.blade.php
Line 316 in 735b4b7
When you change the category from the dropdown list, IDs should reset - this is correct.
Also IDs are retrieved through TMDB API when the Title is not set and .torrent is selected.
But after you fill all the inputs in the upload form yourself, they shouldn't be touched.