lgommans / dro.pm

Drop links, text and files for easy sharing
GNU General Public License v3.0
23 stars 5 forks source link

Switching between short and custom link doesn't upload previously entered content #4

Closed MagicLegend closed 4 years ago

MagicLegend commented 4 years ago

A picture says more than a thousand words: Gifje

Issue is that the newly entered custom url is not valid until the textbox used for entering content is touched. Also shouldn't this action invalidate the old url (dro.pm/e in this example)? Otherwise you'd still end up with a copy of the content that could be easily found by others.

lgommans commented 4 years ago

Thanks for the report! Not sure when I'll have time to work on this, maybe this weekend (if nobody beats me to it) or maybe later.

lgommans commented 4 years ago
[master b112298] Fix #4
 4 files changed, 168 insertions(+), 51 deletions(-)

Well, that turned out to be a little more elaborate than expected. To fix this properly, I basically made two new API endpoints (move to move one link's contents to another when switching tabs, and setExpireAfterDownload to set the toggle when clicking the checkbox), now keep a list of old links to which something was uploaded (so that we can clear them) (why not just a variable "previousLink"? Because async events: it might fire out of order and try to clear some link twice while not clearing an old link at all), and of course changed the rest of the code to work with this and update the UI properly.

Due to all this added complexity, I feel like I probably added a new bug, especially with flaky network conditions. Do test :)

lgommans commented 4 years ago

Due to all this added complexity, I feel like I probably added a new bug

Ah yes, there we go already =P