(Remove) Redundant TMDB ID value check that's always true#5269
(Remove) Redundant TMDB ID value check that's always true#5269Roardom merged 1 commit 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
There was a problem hiding this comment.
I think I'd rather keep the explicitness for now. It's impossible to link the event emitters to the event listeners in the code, and at least the way it was before, it was all referenced on the same line. Maybe at some point it can be all moved into alpine. For now, can you revert the changes you made to the category changing?
There was a problem hiding this comment.
Alright, first commit removed. Also changed the PR title.
ddcdcb1 to
eabbb18
Compare
|
Thank you! |
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.