Skip to content

Commit

Permalink
Merge branch 'main' of github.com:mirumee/saleor into taxes-by-sync-w…
Browse files Browse the repository at this point in the history
…ebhooks
  • Loading branch information
fowczarek committed Apr 29, 2022
2 parents a7627d3 + fa393b4 commit 3634de0
Show file tree
Hide file tree
Showing 61 changed files with 3,071 additions and 1,150 deletions.
29 changes: 25 additions & 4 deletions CHANGELOG.md
Expand Up @@ -4,14 +4,23 @@ All notable, unreleased changes to this project will be documented in this file.

# Unreleased

### Other changes
- Fix for sending incorrect prices to Avatax - #9633 by @korycins

# 3.3.1

- Drop manual calls to emit post_migrate in migrations (#9647) (b32308802)
- Fix search indexing of empty variants (#9640) (31833a717)

# 3.3.0

### Breaking changes

- PREVIEW_FEATURE: replace error code `NOT_FOUND` with `CHECKOUT_NOT_FOUND` for mutation `OrderCreateFromCheckout` - #9569 by @korycins

### Other changes

- Fix filtering product attributes by date range - #9543 by @IKarbowiak
- Fix for raising Permission Denied when anonymous user calls `checkout.customer` field - #9573 by @korycins
- Use fulltext search for products (#9344) (4b6f25964) by @patrys
- Precise timestamps for publication dates - #9581 by @IKarbowiak
- Change `publicationDate` fields to `publishedAt` date time fields.
- Types and inputs where `publicationDate` is deprecated and `publishedAt` field should be used instead:
Expand All @@ -29,8 +38,20 @@ All notable, unreleased changes to this project will be documented in this file.
- Deprecate `publicationDate` on `CollectionInput` and `CollectionCreateInput`.
- Deprecate `PUBLICATION_DATE` in `CollectionSortField`, the `PUBLISHED_AT` should be used instead.
- Deprecate `PUBLICATION_DATE` in `PageSortField`, the `PUBLISHED_AT` should be used instead.
- Add a new column `pubished at` to export products. The new field should be used instead of `publication_date`.
- Add a new column `published at` to export products. The new field should be used instead of `publication_date`.
- Add an alternative API for fetching metadata - #9231 by @patrys
- New webhook events related to gift card changes (#9588) (52adcd10d) by @SzymJ
- New webhook events for changes related to channels (#9570) (e5d78c63e) by @SzymJ
- Tighten the schema types for output fields (#9605) (81418cb4c) by @patrys
- Include permissions in schema descriptions of protected fields (#9428) (f0a988e79) by @maarcingebala
- Update address database (#9585) (1f5e84e4a) by @patrys
- Handle pagination with invalid cursor that is valid base64 (#9521) (3c12a1e95) by @jakubkuc
- Handle all Braintree errors (#9503) (20f21c34a) by @L3str4nge
- Fix `recalculate_order` dismissing weight unit (#9527) (9aea31774)
- Fix filtering product attributes by date range - #9543 by @IKarbowiak
- Fix for raising Permission Denied when anonymous user calls `checkout.customer` field - #9573 by @korycins
- Optimize stock warehouse resolver performance (955489bff) by @tomaszszymanski129
- Improve shipping zone filters performance (#9540) (7841ec536) by @tomaszszymanski129

# 3.2.0

Expand All @@ -45,7 +66,6 @@ All notable, unreleased changes to this project will be documented in this file.
instead.
- Enable JWT expiration by default - #9483 by @maarcingebala


### Other changes

#### Saleor Apps
Expand All @@ -69,6 +89,7 @@ All notable, unreleased changes to this project will be documented in this file.
- Allow plugins to create their custom error code - #9300 by @LeOndaz

#### Other

- Use full-text search for products search API - #9344 by @patrys

- Include required permission in mutations' descriptions - #9363 by @maarcingebala
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "saleor",
"version": "3.3.0-a.0",
"version": "3.3.1",
"engines": {
"node": ">=16 <17",
"npm": ">=7"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
@@ -1,6 +1,6 @@
[tool.poetry]
name = "saleor"
version = "3.3.0-a.0"
version = "3.3.1"
description = "A modular, high performance, headless e-commerce platform built with Python, GraphQL, Django, and React."
authors = [ "Saleor Commerce <hello@saleor.io>" ]
license = "BSD-3-Clause"
Expand Down
2 changes: 1 addition & 1 deletion saleor/__init__.py
@@ -1,4 +1,4 @@
from .celeryconf import app as celery_app

__all__ = ["celery_app"]
__version__ = "3.3.0-a.0"
__version__ = "3.3.1"
35 changes: 19 additions & 16 deletions saleor/account/migrations/0055_alter_user_options.py
@@ -1,24 +1,27 @@
# Generated by Django 3.2.6 on 2021-08-25 10:29
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations
from django.db.models.signals import post_migrate


def assing_permissions(apps, schema_editor):
# force post signal as permissions are created in post migrate signals
# related Django issue https://code.djangoproject.com/ticket/23422
emit_post_migrate_signal(2, False, "default")
Group = apps.get_model("auth", "Group")
Permission = apps.get_model("auth", "Permission")

impersonate_user = Permission.objects.filter(
codename="impersonate_user", content_type__app_label="account"
).first()
manage_users = Permission.objects.filter(
codename="manage_users", content_type__app_label="account"
)

for group in Group.objects.filter(permissions__in=manage_users).iterator():
group.permissions.add(impersonate_user)
def on_migrations_complete(sender=None, **kwargs):
Group = apps.get_model("auth", "Group")
Permission = apps.get_model("auth", "Permission")
ContentType = apps.get_model("contenttypes", "ContentType")

ct, _ = ContentType.objects.get_or_create(app_label="account", model="user")
impersonate_user, _ = Permission.objects.get_or_create(
name="Impersonate user.", content_type=ct, codename="impersonate_user"
)

manage_users = Permission.objects.filter(
codename="manage_users", content_type__app_label="account"
)

for group in Group.objects.filter(permissions__in=manage_users).iterator():
group.permissions.add(impersonate_user)

post_migrate.connect(on_migrations_complete, weak=False)


class Migration(migrations.Migration):
Expand Down
Expand Up @@ -10,7 +10,7 @@ def update_user_search_document_values(apps, _schema_editor):
def on_migrations_complete(sender=None, **kwargs):
set_user_search_document_values.delay()

post_migrate.connect(on_migrations_complete)
post_migrate.connect(on_migrations_complete, weak=False)


class Migration(migrations.Migration):
Expand Down
26 changes: 15 additions & 11 deletions saleor/channel/migrations/0001_initial.py
@@ -1,21 +1,25 @@
# Generated by Django 3.0.6 on 2020-06-16 07:54

from django.conf import settings
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations, models
from django.db.models.signals import post_migrate


def assing_permissions(apps, schema_editor):
# force post signal as permissions are created in post migrate signals
# related Django issue https://code.djangoproject.com/ticket/23422
emit_post_migrate_signal(2, False, "default")
Group = apps.get_model("auth", "Group")
Permission = apps.get_model("auth", "Permission")
manage_channels = Permission.objects.filter(
codename="manage_channels", content_type__app_label="channel"
).first()
for group in Group.objects.iterator():
group.permissions.add(manage_channels)
def on_migrations_complete(sender=None, **kwargs):
Group = apps.get_model("auth", "Group")
Permission = apps.get_model("auth", "Permission")
ContentType = apps.get_model("contenttypes", "ContentType")

ct, _ = ContentType.objects.get_or_create(app_label="channel", model="channel")
manage_channels, _ = Permission.objects.get_or_create(
name="Manage channels.", content_type=ct, codename="manage_channels"
)

for group in Group.objects.iterator():
group.permissions.add(manage_channels)

post_migrate.connect(on_migrations_complete, weak=False)


def get_default_currency(Checkout, Order, Product, ShippingMethod, Voucher):
Expand Down
53 changes: 27 additions & 26 deletions saleor/checkout/migrations/0040_add_handle_checkouts_permission.py
@@ -1,35 +1,36 @@
# Generated by Django 3.2.12 on 2022-03-08 10:35

from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations
from django.db.models.signals import post_migrate


def assign_permissions(apps, schema_editor):
# force post signal as permissions are created in post migrate signals
# related Django issue https://code.djangoproject.com/ticket/23422
emit_post_migrate_signal(2, False, "default")
Permission = apps.get_model("auth", "Permission")
App = apps.get_model("app", "App")
Group = apps.get_model("auth", "Group")

handle_checkouts = Permission.objects.filter(
codename="handle_checkouts", content_type__app_label="checkout"
).first()
manage_checkouts = Permission.objects.filter(
codename="manage_checkouts", content_type__app_label="checkout"
).first()

apps = App.objects.filter(
permissions=manage_checkouts,
)
for app in apps.iterator():
app.permissions.add(handle_checkouts)

groups = Group.objects.filter(
permissions=manage_checkouts,
)
for group in groups.iterator():
group.permissions.add(handle_checkouts)
def on_migrations_complete(sender=None, **kwargs):
Permission = apps.get_model("auth", "Permission")
App = apps.get_model("app", "App")
Group = apps.get_model("auth", "Group")
ContentType = apps.get_model("contenttypes", "ContentType")

ct, _ = ContentType.objects.get_or_create(
app_label="checkout", model="checkout"
)
handle_checkouts, _ = Permission.objects.get_or_create(
name="Handle checkouts", content_type=ct, codename="handle_checkouts"
)

manage_checkouts = Permission.objects.filter(
codename="manage_checkouts", content_type__app_label="checkout"
).first()

app_qs = App.objects.filter(permissions=manage_checkouts)
for app in app_qs.iterator():
app.permissions.add(handle_checkouts)

groups = Group.objects.filter(permissions=manage_checkouts)
for group in groups.iterator():
group.permissions.add(handle_checkouts)

post_migrate.connect(on_migrations_complete, weak=False)


class Migration(migrations.Migration):
Expand Down
50 changes: 25 additions & 25 deletions saleor/checkout/migrations/0043_create_checkout_tax_fields.py
Expand Up @@ -3,36 +3,36 @@
from decimal import Decimal

import django.utils.timezone
from django.core.management.sql import emit_post_migrate_signal
from django.db import migrations, models
from django.db.models.signals import post_migrate


def assign_permission(apps, schema_editor):
# force post signal as permissions are created in post migrate signals
# related Django issue https://code.djangoproject.com/ticket/23422
emit_post_migrate_signal(2, False, "default")
Permission = apps.get_model("auth", "Permission")
App = apps.get_model("app", "App")
Group = apps.get_model("auth", "Group")
def assign_permissions(apps, schema_editor):
def on_migrations_complete(sender=None, **kwargs):
Permission = apps.get_model("auth", "Permission")
App = apps.get_model("app", "App")
Group = apps.get_model("auth", "Group")

handle_taxes = Permission.objects.filter(
codename="handle_taxes", content_type__app_label="checkout"
).first()
manage_checkouts = Permission.objects.filter(
codename="manage_checkouts", content_type__app_label="checkout"
).first()
handle_taxes = Permission.objects.filter(
codename="handle_taxes", content_type__app_label="checkout"
).first()
manage_checkouts = Permission.objects.filter(
codename="manage_checkouts", content_type__app_label="checkout"
).first()

apps = App.objects.filter(
permissions=manage_checkouts,
)
for app in apps.iterator():
app.permissions.add(handle_taxes)
apps_qs = App.objects.filter(
permissions=manage_checkouts,
)
for app in apps_qs.iterator():
app.permissions.add(handle_taxes)

groups = Group.objects.filter(
permissions=manage_checkouts,
)
for group in groups.iterator():
group.permissions.add(handle_taxes)
groups = Group.objects.filter(
permissions=manage_checkouts,
)
for group in groups.iterator():
group.permissions.add(handle_taxes)

post_migrate.connect(on_migrations_complete, weak=False)


class Migration(migrations.Migration):
Expand All @@ -53,7 +53,7 @@ class Migration(migrations.Migration):
),
},
),
migrations.RunPython(assign_permission),
migrations.RunPython(assign_permissions),
migrations.AddField(
model_name="checkout",
name="price_expiration",
Expand Down
2 changes: 1 addition & 1 deletion saleor/core/permissions/__init__.py
Expand Up @@ -106,4 +106,4 @@ def has_one_of_permissions(requestor, permissions=None):

def message_one_of_permissions_required(permissions):
permission_msg = ", ".join([p.name for p in permissions])
return f"Requires one of the following permissions: {permission_msg}."
return f"\n\nRequires one of the following permissions: {permission_msg}."
4 changes: 2 additions & 2 deletions saleor/graphql/app/schema.py
Expand Up @@ -80,7 +80,7 @@ class AppQueries(graphene.ObjectType):
filter=AppExtensionFilterInput(
description="Filtering options for apps extensions."
),
description=f"{ADDED_IN_31} List of all extensions. {PREVIEW_FEATURE}",
description="List of all extensions." + ADDED_IN_31 + PREVIEW_FEATURE,
permissions=[
AuthorizationFilters.AUTHENTICATED_STAFF_USER,
AuthorizationFilters.AUTHENTICATED_APP,
Expand All @@ -91,7 +91,7 @@ class AppQueries(graphene.ObjectType):
id=graphene.Argument(
graphene.ID, description="ID of the app extension.", required=True
),
description=f"{ADDED_IN_31} Look up an app extension by ID. {PREVIEW_FEATURE}",
description="Look up an app extension by ID." + ADDED_IN_31 + PREVIEW_FEATURE,
permissions=[
AuthorizationFilters.AUTHENTICATED_STAFF_USER,
AuthorizationFilters.AUTHENTICATED_APP,
Expand Down
2 changes: 1 addition & 1 deletion saleor/graphql/app/types.py
Expand Up @@ -208,7 +208,7 @@ class App(ModelObjectType):
)
extensions = NonNullList(
AppExtension,
description=f"{ADDED_IN_31} App's dashboard extensions. {PREVIEW_FEATURE}",
description="App's dashboard extensions." + ADDED_IN_31 + PREVIEW_FEATURE,
required=True,
)

Expand Down
4 changes: 2 additions & 2 deletions saleor/graphql/attribute/types.py
Expand Up @@ -321,8 +321,8 @@ class AssignedVariantAttribute(graphene.ObjectType):

class Meta:
description = (
f"{ADDED_IN_31} Represents assigned attribute to variant with "
"variant selection attached."
"Represents assigned attribute to variant with variant selection attached."
+ ADDED_IN_31
)


Expand Down
8 changes: 4 additions & 4 deletions saleor/graphql/channel/mutations.py
Expand Up @@ -34,9 +34,9 @@ class ChannelCreateInput(ChannelInput):
)
default_country = CountryCodeEnum(
description=(
f"{ADDED_IN_31} Default country for the channel. Default country can be "
"Default country for the channel. Default country can be "
"used in checkout to determine the stock quantities or calculate taxes "
"when the country was not explicitly provided."
"when the country was not explicitly provided." + ADDED_IN_31
),
required=True,
)
Expand Down Expand Up @@ -92,9 +92,9 @@ class ChannelUpdateInput(ChannelInput):
slug = graphene.String(description="Slug of the channel.")
default_country = CountryCodeEnum(
description=(
f"{ADDED_IN_31} Default country for the channel. Default country can be "
"Default country for the channel. Default country can be "
"used in checkout to determine the stock quantities or calculate taxes "
"when the country was not explicitly provided."
"when the country was not explicitly provided." + ADDED_IN_31
)
)
add_shipping_zones = NonNullList(
Expand Down

0 comments on commit 3634de0

Please sign in to comment.