Skip to content

Commit

Permalink
Merge branch 'main' into fix-component-hiding
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewtavis authored Jul 5, 2024
2 parents 2bb406c + 98c107c commit b93be56
Show file tree
Hide file tree
Showing 205 changed files with 6,298 additions and 3,066 deletions.
7 changes: 7 additions & 0 deletions .env.dev
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,10 @@ DATABASE_PASSWORD="postgres"

SECRET_KEY='secret'
DEBUG='1'

ACTIVIST_EMAIL="[email protected]"
EMAIL_HOST="smtp.activist.org"
EMAIl_PORT="587"
EMAIL_HOST_USER="[email protected]"
EMAIL_HOST_PASSWORD="activist123!?"
EMAIL_USE_TLS="True"
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Community discussion channels
- name: 👋 Community discussion channels
url: https://matrix.to/#/#activist_community:matrix.org
about: Join us in our public Matrix chat rooms!
4 changes: 2 additions & 2 deletions .github/workflows/pr_ci_backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,11 +30,11 @@ jobs:
echo PATH=$PATH >> $GITHUB_ENV
- name: Run Ruff Format - Formatting Check
run: ruff ./backend
run: ruff check ./backend

- name: Run Ruff - Linting and Import Sorting Check
if: always()
run: ruff ./backend
run: ruff check ./backend

- name: Run mypy - Static Type Checking
if: always()
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/pr_ci_i18n.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@ jobs:
with:
python-version: "3.11"

- name: Execute Repeat i18n Value Script
working-directory: ./frontend/i18n
run: python check_repeat_i18n_values.py
- name: Execute i18n Values Check
working-directory: ./frontend/i18n/check
run: python i18n_check_values.py

- name: Execute Unused i18n Key Script
- name: Execute i18n Keys Check
if: always()
working-directory: ./frontend/i18n
run: python check_unused_i18n_keys.py
working-directory: ./frontend/i18n/check
run: python i18n_check_keys.py
24 changes: 23 additions & 1 deletion .github/workflows/pr_ci_playwright_e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ jobs:
- name: Run Docker Compose
run: docker compose --env-file .env.dev up --build -d

- name: Check Docker Container Logs
run: docker compose --env-file .env.dev logs

- name: Setup Node environment
uses: actions/setup-node@v4
with:
Expand All @@ -52,7 +55,26 @@ jobs:
- name: Wait for web server to be ready
working-directory: ./frontend
run: |
yarn wait-on http://localhost:3000
MAX_ATTEMPTS=3
WAIT_TIME=30
ATTEMPT=1
while [[ $ATTEMPT -le $MAX_ATTEMPTS ]]
do
echo "Attempt $ATTEMPT of $MAX_ATTEMPTS"
yarn wait-on http://localhost:3000 --timeout ${WAIT_TIME}000
if [[ $? -eq 0 ]]; then
echo "Server is ready!"
break
else
echo "Server not ready, retrying..."
ATTEMPT=$((ATTEMPT + 1))
if [[ $ATTEMPT -gt $MAX_ATTEMPTS ]]; then
echo "Server failed to start after $MAX_ATTEMPTS attempts."
exit 1
fi
sleep 1
fi
done
- name: Run Playwright tests
working-directory: ./frontend
Expand Down
16 changes: 8 additions & 8 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.3.0
hooks:
Expand All @@ -15,11 +23,3 @@ repos:
# additional_dependencies:
# - prettier
# - prettier-plugin-tailwindcss

- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer
- id: check-yaml
- id: check-added-large-files
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,23 @@ git remote add upstream https://github.com/activist-org/activist.git
- `origin` (forked repository)
- `upstream` (activist repository)

4. Start your docker images with the following:
4. Create a virtual environment for the backend, activate it and install dependencies:

```bash
# Unix or MacOS:
python3 -m venv venv
source venv/bin/activate

# Windows:
python -m venv venv
venv\Scripts\activate.bat

# After activating venv:
pip install --upgrade pip
pip install -r backend/requirements-dev.txt
```

5. Start your docker images with the following:

```bash
docker compose --env-file .env.dev up
Expand All @@ -193,12 +209,12 @@ git remote add upstream https://github.com/activist-org/activist.git
# docker compose --env-file .env.dev down
```

5. You can then visit <http://localhost:3000> to see the development frontend build once the container is up and running.
6. You can then visit <http://localhost:3000> to see the development frontend build once the container is up and running.

> [!NOTE]
> Feel free to contact the team in the [Development room on Matrix](https://matrix.to/#/!CRgLpGeOBNwxYCtqmK:matrix.org?via=matrix.org&via=acter.global&via=chat.0x7cd.xyz) if you're having problems getting your environment setup! If you're having issues with Docker and just want to get the frontend or backend up and running, please see [the section on this in the contributing guide](https://github.com/activist-org/activist/blob/main/CONTRIBUTING.md#using-yarn-or-python).

6. Install [pre-commit](https://pre-commit.com/) to ensure that each of your commits is properly checked against our linter and formatters:
7. Install [pre-commit](https://pre-commit.com/) to ensure that each of your commits is properly checked against our linter and formatters:

```bash
# In the project root:
Expand Down
2 changes: 1 addition & 1 deletion STYLEGUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,7 @@ Please define all routes for images and icons in the respective [url registry ut

activist uses [nuxt-icon](https://github.com/nuxt-modules/icon) for all icons. Icons are defined via `<Icon :name="IconMap.ICON_REF"/>` components, with [Icônes](https://icones.js.org/) being a good place to look for [Iconify](https://iconify.design/) based files to import. The `<Icon/>` component also has a `size` argument that `em` based arguments can be passed to. There's also a `color` argument, but colors are handled with Tailwind CSS via the `text-COLOR` class argument.

Custom icons for activist can further be found in the [Icon directory of the frontend components](https://github.com/activist-org/activist/tree/main/frontend/components/Icon). These icons can also be referenced via the `<Icon>` component via their file name (ex: `<Icon name="IconSupport">` for the grasped hands we use). For Tailwind coloration note that we need to use `fill-COLOR` for the custom activist icons rather than `text-COLOR`.
Custom icons for activist can further be found in the [Icon directory of the frontend components](https://github.com/activist-org/activist/tree/main/frontend/components/icon). These icons can also be referenced via the `<Icon>` component via their file name (ex: `<Icon name="IconSupport">` for the grasped hands we use). For Tailwind coloration note that we need to use `fill-COLOR` for the custom activist icons rather than `text-COLOR`.

<a id="tab-size"></a>

Expand Down
29 changes: 18 additions & 11 deletions backend/authentication/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,21 @@
UserTopic,
)

# MARK: Main Tables

# Remove default Group.
admin.site.unregister(Group)
admin.site.register(Support)

# MARK: Bridge Tables

admin.site.register(UserResource)
admin.site.register(UserTask)
admin.site.register(UserTopic)
admin.site.register(SupportEntityType)

# MARK: Methods


class UserCreationForm(forms.ModelForm[UserModel]):
"""
Expand Down Expand Up @@ -81,10 +96,9 @@ class UserAdmin(BaseUserAdmin):
"fields": [
"username",
"description",
"private",
"high_risk",
"user_icon",
"social_accounts",
"is_private",
"is_high_risk",
"verfied",
]
},
),
Expand Down Expand Up @@ -115,12 +129,5 @@ class UserAdmin(BaseUserAdmin):
filter_horizontal = []


# Remove default Group
admin.site.unregister(Group)
admin.site.register(UserResource)
admin.site.register(UserTask)
admin.site.register(UserTopic)
admin.site.register(SupportEntityType)
admin.site.register(Support)
# Now register the new UserAdmin...
admin.site.register(UserModel, UserAdmin)
20 changes: 20 additions & 0 deletions backend/authentication/enums.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
"""
Enums for the authentication app.
More details about Enums can be found in schema section on Figma.
"""

from enum import Enum


class StatusTypes(Enum):
PENDING = 1
ACTIVE = 2
SUSPENDED = 3
BANNED = 4


class SupportEntityTypes(Enum):
ORGANIZATION = 1
GROUP = 2
EVENT = 3
USER = 4
7 changes: 6 additions & 1 deletion backend/authentication/factories.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
UserTopic,
)

# MARK: Main Tables


class SupportEntityTypeFactory(factory.django.DjangoModelFactory):
class Meta:
Expand Down Expand Up @@ -39,12 +41,12 @@ class Meta:
description = factory.Faker("text", max_nb_chars=500)
verified = factory.Faker("boolean")
verification_method = factory.Faker("word")
verifictaion_code = factory.Faker("uuid4")
email = factory.Faker("email")
social_links = factory.List([factory.Faker("user_name") for _ in range(3)])
is_private = factory.Faker("boolean")
is_high_risk = factory.Faker("boolean")
creation_date = factory.Faker("date_time_this_decade", before_now=True)
deletion_date = factory.Faker("date_time_this_decade", before_now=False)
plaintext_password = factory.PostGenerationMethodCall("set_password", "password")

# Workaround for the build method
Expand All @@ -61,6 +63,9 @@ def verification_partner(
pass


# MARK: Bridge Tables


class UserResourceFactory(factory.django.DjangoModelFactory):
class Meta:
model = UserResource
Expand Down
Loading

0 comments on commit b93be56

Please sign in to comment.