Skip to content

Commit

Permalink
redirect to active version if navigating to versions deep link #359
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnuesslein committed Mar 21, 2022
1 parent f6b26fa commit 85d71c9
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
7 changes: 6 additions & 1 deletion apps/graphql/resolvers/generics.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,12 @@ def object_edit(
obj.modified_by = user

# this is a live Object for which we create a new Version
if not obj_version_id:
# or it is the version of the currently active Deal
if not obj_version_id or (
ObjectVersion.objects.filter(object_id=obj_id).first().id == obj_version_id
and obj.draft_status is None
and obj.status == 3
):
obj.draft_status = DRAFT_STATUS["DRAFT"]
if otype == "deal":
obj.fully_updated = False
Expand Down
15 changes: 3 additions & 12 deletions frontend/src/store/queries.js
Original file line number Diff line number Diff line change
Expand Up @@ -435,18 +435,9 @@ export const deal_gql_query = gql`
comment
processed_by_receiver
}
# comments {
# id
# userinfo
# comment
# submit_date
# title
# parent {
# id
# }
# tree_path
# newest_activity
# }
current_draft {
id
}
status
draft_status
}
Expand Down
16 changes: 8 additions & 8 deletions frontend/src/views/Account/Register.vue
Original file line number Diff line number Diff line change
Expand Up @@ -138,14 +138,14 @@
components: { PageTitle, VueHcaptcha },
data() {
return {
username: null,
first_name: null,
last_name: null,
email: null,
phone: null,
information: null,
password: null,
password_confirm: null,
username: "",
first_name: "",
last_name: "",
email: "",
phone: "",
information: "",
password: "",
password_confirm: "",
token: "",
submit_disabled: true,
register_failed_message: "",
Expand Down
7 changes: 7 additions & 0 deletions frontend/src/views/Deal/Detail.vue
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,13 @@
if (!deal && !this.$store.getters.userAuthenticated)
this.$router.push({ name: "login", query: { next: this.$route.fullPath } });
if (!deal) this.$router.push({ name: "list_deals" });
if (
this.dealVersion == deal.versions[0].id &&
deal.status === 3 &&
deal.draft_status === null
)
this.$router.push({ name: "deal_detail", params: { dealId: this.dealId } });
if (deal.status === 1 && !this.dealVersion)
this.$router.push({
name: "deal_detail",
Expand Down

0 comments on commit 85d71c9

Please sign in to comment.