Skip to content

Add logic to set due date from addons, based on #2362#2379

Merged
eikek merged 1 commit intoeikek:masterfrom
madduck:addon-due-dates
Nov 15, 2023
Merged

Add logic to set due date from addons, based on #2362#2379
eikek merged 1 commit intoeikek:masterfrom
madduck:addon-due-dates

Conversation

@madduck
Copy link
Copy Markdown
Contributor

@madduck madduck commented Nov 12, 2023

This allows addons to set or remove the due date, by outputting the following structure:

{ "duedate": 1707908400000, "action": "set-due-date" }

Alternatively, you may set duedate to null to remove a due date.

Thanks to @eikek and @v6ak for the handholding!

@eikek
Copy link
Copy Markdown
Owner

eikek commented Nov 12, 2023

Now that's interesting! This should have never slipped through ci

[info] compiling 7 Scala sources to /home/runner/work/docspell/docspell/website/target/scala-2.13/classes ...
[error] /home/runner/work/docspell/docspell/website/src/main/scala/docspell/website/AddonOutputExample.scala:24:51: type mismatch;
[error]  found   : docspell.common.Timestamp
[error]  required: Option[docspell.common.Timestamp]
[error]           ItemAction.SetDueDate(Timestamp.ofMillis(1707908400000L)),
[error]                                                   ^
[error] /home/runner/work/docspell/docspell/website/src/main/scala/docspell/website/AddonOutputExample.scala:10:24: Unused import
[error] import io.circe.syntax._
[error]                        ^
[error] two errors found
[error] (website / Compile / compileIncremental) Compilation failed

Edit: my bad! this is the new "due date" action. So the examples need to be fixed. I was confusing it with the earlier "set-date".

@madduck
Copy link
Copy Markdown
Contributor Author

madduck commented Nov 14, 2023

Now that's interesting! This should have never slipped through ci

[info] compiling 7 Scala sources to /home/runner/work/docspell/docspell/website/target/scala-2.13/classes ...
[error] /home/runner/work/docspell/docspell/website/src/main/scala/docspell/website/AddonOutputExample.scala:24:51: type mismatch;
[error]  found   : docspell.common.Timestamp
[error]  required: Option[docspell.common.Timestamp]
[error]           ItemAction.SetDueDate(Timestamp.ofMillis(1707908400000L)),
[error]                                                   ^
[error] /home/runner/work/docspell/docspell/website/src/main/scala/docspell/website/AddonOutputExample.scala:10:24: Unused import
[error] import io.circe.syntax._
[error]                        ^
[error] two errors found
[error] (website / Compile / compileIncremental) Compilation failed

Edit: my bad! this is the new "due date" action. So the examples need to be fixed. I was confusing it with the earlier "set-date".

I have no idea what your comment has to do with the fact that the Timestamp.ofMillis contructor obviously generates a type that is not Option[Timestamp], or what the io.circe.syntax._ import has to do with my PR. :(

@eikek
Copy link
Copy Markdown
Owner

eikek commented Nov 15, 2023

Forget my comment, I just confused this error message with a similar one from a previous change.

So the error message says, that it expects an Option[Timestamp] but you gave it a value of type Timestamp. You can just wrap it, like for example Some(Timestamp.ofMillis(...)).

The error about the import is a follow up. The project is configured to error out also on compiler warnings. And the compiler tries to find many errors (it doesn't stop on the first one). Due to the previous error, it finds this import is unused.

Signed-off-by: martin f. krafft <madduck@madduck.net>
@madduck
Copy link
Copy Markdown
Contributor Author

madduck commented Nov 15, 2023

@eikek Again, thanks for the hand-holding!

@eikek
Copy link
Copy Markdown
Owner

eikek commented Nov 15, 2023

Thank you!

@eikek eikek merged commit 1cd517b into eikek:master Nov 15, 2023
@madduck madduck deleted the addon-due-dates branch November 23, 2023 21:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants