-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wip: postupload #813
base: main
Are you sure you want to change the base?
wip: postupload #813
Conversation
35aaddc
to
098f0a7
Compare
(0, _("I have received the letter")), | ||
(1, _("I have sent the letter")), | ||
), | ||
coerce=lambda x: bool(int(x)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is that safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
unsafe in what way? (I just copied it from elsewhere in the code.)
steps: Array | ||
}) | ||
|
||
const progressDesktop = computed(() => props.step / (props.steps.length - 1)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe a bit clearer: this one starts from zero, the other one from one
*/ | ||
|
||
// this could possibly move to lib/vue-helper.ts | ||
const vBsTooltip = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
great idea! could also be a helper component
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tried it quickly; failed because of vue2/3 mixture... will retry at some point
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stepHistory.push(nextStep || getNextStep()) | ||
} | ||
|
||
const gotoValid = computed(() => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe we should use a proper state machine for this, like xstate? this is very confusing to me
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes! having a visual representation will be very beneficial
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
plan of attack:
- attach the current implementation as-is to history api (like
.../#1100'
) - see if xstate can a. handle our state machine part and b. work with hash-history
- if not, consider a lightweight, handrolled state machine implementation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maybe vue-router could also work for this
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
but doesn't vue-router also always expose the state to the back-button, leaving states reachable which shouldn't be? resp., necessitate complex navigation guards, which are state-machine-like...
message = FoiMessage(request=foirequest, kind=MessageKind.POST) | ||
# hack, prevent: null value in column "timestamp" of relation "foirequest_foimessage" violates not-null constraint | ||
# this will be set to "proper" (noon) when finally submitted | ||
message.timestamp = datetime.datetime.now() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could this lead to timezone problems?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oof, hard to tell (for me). i think it shouldn't, because, as stated in the comment, it's a temporary non-null replacement, that shouldn't exist for too long.
but speaking of timezone problems, registered_mail_date
from your other comment might cause problems? it's supposed to be a "timeless" date, so it gets set to midnight. i found date
field logic hard to understand...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krmax44 suggest adding a constraint that allows this field to be nullable as long is_draft UNLESS this is the only timestamp/created_at-ish info
) | ||
return redirect(url) | ||
else: | ||
if is_fetch(request): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe better to filter on accept
header?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes. resolved by 998ad92
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoops, unresolved -- a normal form.submit
sends Accept: ...,*/*
so it does accepts("application/json")
, so this is no way to distinguish from a fetch
. I'll revert this unless you know a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@krmax44 will look into turning this into a proper api endpoint
def serialize_extra(obj): | ||
if isinstance(obj, Decimal): | ||
return { | ||
"__Decimal": True, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this a nice way or should we add a tag field that specifies the type of the object serialized here? e.g. something like
"__Decimal": True, | |
"__type__": "__Decimal", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i like your suggestion; tbh i don't use the type info anywhere - i just felt dirty not doing anything :) yagni?
764ed6a
to
14527b0
Compare
@@ -566,6 +566,8 @@ def is_pkce_required(client_id): | |||
"about": "/about/", | |||
"help": "/help/", | |||
"throttled": "/help/", | |||
# TODO english? | |||
"help_postupload_redaction": "/hilfe/plain/funktionen-der-plattform/schwaerzungen-durchfuehren/", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this should go into the theme repo: https://github.com/okfde/fragdenstaat_de/blob/40c44c2188808c5feb1d49dbfde0093b34e435e8/fragdenstaat_de/settings/base.py#L719
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it's there: https://github.com/okfde/fragdenstaat_de/blob/bikubi/postupload-wip3/fragdenstaat_de/settings/base.py#L726
but since post-upload.vue is part of froide, and this help url is kind of expected (short of hard coded), isn't it weird to leave it undefined, then? or should the text which contains this link be also moved to the theme repo?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
todo: split this up into smaller views; move the larger logic to a javascript module/class
} | ||
|
||
/* bootstrap doesn't provide this responsive position class out of the box | ||
* (it could be compiled in with utils/helpers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be configured: https://getbootstrap.com/docs/5.3/utilities/api/#using-the-api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done! wasn't sure if this one case was worth the overhead, but also hadn't seen that we already have utilities configured.. thx
vuedraggable, broken with Vue3, replaced with vueuse's sortable
e844a15
to
a54531f
Compare
No description provided.