feat: mark undone if task moved from isDoneBucket #3291
Labels
No Label
area/internal-code
changes requested
confirmed
dependencies
duplicate
good first issue
help wanted
hosting
invalid
kind/bug
kind/feature
question
wontfix
No Milestone
No project
No Assignees
4 Participants
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: vikunja/frontend#3291
Loading…
Reference in New Issue
No description provided.
Delete Branch "WofWca/frontend:mark-undone-after-moving-from-done-bucket"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Addresses #545 (not completely)
It already is marked as done if it's moved into the done bucket on
the backend:
6aadaaaffc/pkg/models/tasks.go (L867-L869)
Hi WofWca!
Thank you for creating a PR!
I've deployed the changes of this PR on a preview environment under this URL: https://3291-mark-undone-after-moving-from-do--vikunja-frontend-preview.netlify.app
You can use this url to view the changes live and test them out.
You will need to manually connect this to an api running somehwere. The easiest to use is https://try.vikunja.io/.
Have a nice day!
@ -426,2 +427,4 @@
taskAfter !== null ? taskAfter.kanbanPosition : null,
)
if (
oldBucket && // This shouldn't be `undefined`, but let's play it safe.
If I'm not wrong the
bucketId
could be0
. If that's the case we really should check forundefined
instead.Unless we can specify the reason for it being
0
I'm for keeping the comment. Makes it clear that we don't actually know it.Its the id of the default bucket. The comment is fine
By "default bucket" you mean a newly created
Bucket
instance, right? I don't think it's currently possible to move tasks from a bucket that hasn't been sent to the backend yet, is it?The default bucket is the leftmost bucket, where tasks are created (or moved to) when no bucket is specified.
IMU code is run when you drag a task between buckets or within a bucket, so the said task should always have
bucketId
set.Yeah in the frontend there should always be a bucket id set. What is was describing is the api behaviour.
By 'set' you mean 'some other value than
0
?My original intend here mostly was: I see it as bad style ff a possible value of a variable is
0
(which is true here, even if it might get replaced with something different shortly after). Because of that I thought:Might make sense here.
yes, exactly.
Yes, since the back-end can't have an actual bucket with an
id
of 0.Wait, are you saying that the value of
oldBucket
could be0
? No, it's either a bucket object, or undefined (the latter shouldn't happen). But ok, I'll update it to!= undefined
to covernull
andundefined
, but not 0.Even if you set it to
0
the api will set it to the default bucket.The initial set value in the frontend of
bucketId
is0
.So even if that might be replaced in the moment the API answers it currently is true for short period of time. If this is not wished, we should adjust the initial value in the model (e.g. as you said @WofWca to
undefined
).Note I talk here about the
bucketId
and not theoldBucket
. But since the latter is based on the former I thought not relying on implicit type conversion would be clearer.The
oldBucket
variable is the return value of thefind
function that is called on the array of bucket objects. Are you taking aboutoldBucket
ortask.bucketId
?Edit: saw the edit.
Either way, I don't care anymore :D This is way too much effort for way to few impact. Change as you wish ;)
Can we do this in the frontend as well in this pr?
That way we don't have to wait for the answer of the backend.
It is already this way, if you look closely. It's the reason I opened the MR actually, to make it easier to implement the offline version 😉
From the title I judged that this pr is about moving from the bucket, while you mention that it's marked as done when moving into the bucket. So I assumed that this doesn't currently happen in the frontend and isn't yet included in this pr.
Well, yeah, this MR is about moving from the bucket, since moving into the bucket already works on the
main
branch, but it works thanks to the backend.Yes. So with that in mind I thought it makes sense to do this additionally in the frontend in the sense of optimistic UI. We don't have to implement the full optimistic UI pattern here already, but I think it makes sense to align in the frontend what happens in both move directions.
@WofWca:
I think I didn't comprehend that this part of the code…
…does change the done state in both moving directions. So all good here, my bad for misunderstanding!
b83366f410
tob082e81629
Perhaps I wasn't good at communicating this.
So, is this ready for merging now?
We should do a follow-up at some point to change this in the api as well.