From bb7139105a5bc24c2574892aa80ac294e5eb2759 Mon Sep 17 00:00:00 2001 From: Duda Nogueira Date: Fri, 14 Apr 2023 17:09:21 -0300 Subject: [PATCH] fix ci --- .github/workflows/ci.yml | 2 +- .gitignore | 2 +- .pre-commit-config.yaml | 2 +- merge_production_dotenvs_in_dotenv.py | 2 +- rocket_connect/asterisk/models.py | 1 - rocket_connect/instance/tasks.py | 2 -- rocket_connect/instance/tests.py | 1 - rocket_connect/plugins/base.py | 1 - rocket_connect/plugins/facebook.py | 1 - rocket_connect/plugins/instagram_direct.py | 1 - rocket_connect/plugins/metacloudapi_whatsapp.py | 3 --- rocket_connect/plugins/wppconnect.py | 1 - rocket_connect/users/admin.py | 1 - rocket_connect/users/tests/factories.py | 4 ++-- rocket_connect/users/views.py | 3 --- 15 files changed, 6 insertions(+), 21 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0c63ac7..625a180 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,7 +31,7 @@ jobs: # Run all pre-commit hooks on all the files. # Getting only staged files can be tricky in case a new PR is opened # since the action is run on a branch in detached head state - - name: Install and Run Pre-commit + - name: Install and Run Pre-commit uses: pre-commit/action@v3.0.0 # With no caching at all the entire ci process takes 4m 30s to complete! diff --git a/.gitignore b/.gitignore index 1364ec3..a915a2a 100644 --- a/.gitignore +++ b/.gitignore @@ -212,4 +212,4 @@ rocket_connect/media/ # end managed by open-wa version* -mongodb_version* \ No newline at end of file +mongodb_version* diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 073df73..86d2859 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,4 +1,4 @@ -exclude: "^docs/|/migrations/" +exclude: "^docs/|/migrations/|^emojipy" default_stages: [commit] repos: diff --git a/merge_production_dotenvs_in_dotenv.py b/merge_production_dotenvs_in_dotenv.py index 09fedbb..d702a5f 100644 --- a/merge_production_dotenvs_in_dotenv.py +++ b/merge_production_dotenvs_in_dotenv.py @@ -1,6 +1,6 @@ import os +from collections.abc import Sequence from pathlib import Path -from typing import Sequence import pytest diff --git a/rocket_connect/asterisk/models.py b/rocket_connect/asterisk/models.py index cea59ed..c80fcdb 100644 --- a/rocket_connect/asterisk/models.py +++ b/rocket_connect/asterisk/models.py @@ -4,7 +4,6 @@ class Call(models.Model): - unique_id = models.CharField(max_length=50, unique=True) previous_call = models.ForeignKey( "self", on_delete=models.CASCADE, null=True, blank=True diff --git a/rocket_connect/instance/tasks.py b/rocket_connect/instance/tasks.py index 18e2fa5..b3422bc 100644 --- a/rocket_connect/instance/tasks.py +++ b/rocket_connect/instance/tasks.py @@ -80,7 +80,6 @@ def alert_last_message_open_chat( context = Context(context_dict) template = Template(notification_template) for target in notification_target.split(","): - # render message message = template.render(context) if target.startswith("#"): @@ -89,7 +88,6 @@ def alert_last_message_open_chat( text=message, channel=target.replace("#", "") ) else: - # target may contain variables target_template = Template(target) rendered_target = target_template.render(context) diff --git a/rocket_connect/instance/tests.py b/rocket_connect/instance/tests.py index 6f95e5e..9f07989 100644 --- a/rocket_connect/instance/tests.py +++ b/rocket_connect/instance/tests.py @@ -40,7 +40,6 @@ def test_get_close_message(self): self.assertEqual(close_message, self.incoming.get_close_message()) def test_get_advanced_close_message(self): - # test advanced forced message forced_dpto1 = "Forced Message for Dpto 1" forced_dpto2 = "Forced Message for Dpto 2" diff --git a/rocket_connect/plugins/base.py b/rocket_connect/plugins/base.py index b16c83b..133979a 100644 --- a/rocket_connect/plugins/base.py +++ b/rocket_connect/plugins/base.py @@ -500,7 +500,6 @@ def get_room( # optionally allow welcome message if allow_welcome_message: if self.config.get("welcome_message"): - # only send welcome message when # 1 - open_room is False and there is a welcome_message # 2 - open_room is True, room_created is True and there is a welcome_message diff --git a/rocket_connect/plugins/facebook.py b/rocket_connect/plugins/facebook.py index 5e0023b..99a64e6 100644 --- a/rocket_connect/plugins/facebook.py +++ b/rocket_connect/plugins/facebook.py @@ -256,7 +256,6 @@ def change_agent_name(self, agent_name): class ConnectorConfigForm(BaseConnectorConfigForm): - access_token = forms.CharField( help_text="Facebook Access Token to get contact info", required=False, diff --git a/rocket_connect/plugins/instagram_direct.py b/rocket_connect/plugins/instagram_direct.py index 2cdf245..92f8a1d 100644 --- a/rocket_connect/plugins/instagram_direct.py +++ b/rocket_connect/plugins/instagram_direct.py @@ -65,7 +65,6 @@ def get_incoming_message_id(self): class ConnectorConfigForm(BaseConnectorConfigForm): - access_token = forms.CharField( help_text="Facebook Access Token to get contact info", required=False, diff --git a/rocket_connect/plugins/metacloudapi_whatsapp.py b/rocket_connect/plugins/metacloudapi_whatsapp.py index baef4b9..cc8ba24 100644 --- a/rocket_connect/plugins/metacloudapi_whatsapp.py +++ b/rocket_connect/plugins/metacloudapi_whatsapp.py @@ -13,7 +13,6 @@ class Connector(ConnectorBase): - # main incoming hub def incoming(self): """ @@ -121,7 +120,6 @@ def handle_challenge(self): return HttpResponseForbidden() def handle_message(self): - if self.message.get("type") == "unsupported": # do nothing return JsonResponse({"message": "unsupported type"}) @@ -352,7 +350,6 @@ def status_session(self): class ConnectorConfigForm(BaseConnectorConfigForm): - graph_url = forms.CharField( help_text="Facebook GraphQl endpoint with version, eg https://graph.facebook.com/v14.0/", required=True, diff --git a/rocket_connect/plugins/wppconnect.py b/rocket_connect/plugins/wppconnect.py index d401488..32328bd 100644 --- a/rocket_connect/plugins/wppconnect.py +++ b/rocket_connect/plugins/wppconnect.py @@ -1257,7 +1257,6 @@ def handle_ack_fromme_message(self): class ConnectorConfigForm(BaseConnectorConfigForm): - webhook = forms.CharField( help_text="Where WPPConnect will send the events", required=True, diff --git a/rocket_connect/users/admin.py b/rocket_connect/users/admin.py index e4bb9cb..e38d58a 100644 --- a/rocket_connect/users/admin.py +++ b/rocket_connect/users/admin.py @@ -10,7 +10,6 @@ @admin.register(User) class UserAdmin(auth_admin.UserAdmin): - form = UserChangeForm add_form = UserCreationForm fieldsets = ( diff --git a/rocket_connect/users/tests/factories.py b/rocket_connect/users/tests/factories.py index edd306c..36f9634 100644 --- a/rocket_connect/users/tests/factories.py +++ b/rocket_connect/users/tests/factories.py @@ -1,4 +1,5 @@ -from typing import Any, Sequence +from collections.abc import Sequence +from typing import Any from django.contrib.auth import get_user_model from factory import Faker, post_generation @@ -6,7 +7,6 @@ class UserFactory(DjangoModelFactory): - username = Faker("user_name") email = Faker("email") name = Faker("name") diff --git a/rocket_connect/users/views.py b/rocket_connect/users/views.py index cc31b1e..fbe2ba5 100644 --- a/rocket_connect/users/views.py +++ b/rocket_connect/users/views.py @@ -9,7 +9,6 @@ class UserDetailView(LoginRequiredMixin, DetailView): - model = User slug_field = "username" slug_url_kwarg = "username" @@ -19,7 +18,6 @@ class UserDetailView(LoginRequiredMixin, DetailView): class UserUpdateView(LoginRequiredMixin, SuccessMessageMixin, UpdateView): - model = User fields = ["name"] success_message = _("Information successfully updated") @@ -35,7 +33,6 @@ def get_object(self): class UserRedirectView(LoginRequiredMixin, RedirectView): - permanent = False def get_redirect_url(self):