Financial steering committee page member images (#1613)

This commit is contained in:
daveoconnor
2025-01-27 10:18:23 -08:00
committed by GitHub
parent 0a1d35d917
commit c4e6302360
14 changed files with 120 additions and 13 deletions

View File

@@ -99,6 +99,7 @@ services:
networks:
- backend
environment:
LOCAL_DEVELOPMENT: "true"
DEBUG_TOOLBAR: "false"
env_file:
- .env

View File

@@ -307,6 +307,8 @@ If both the `--release` and the `--library-name` are passed, the command will lo
**Purpose**: Execute a chain of commands which are necessary to run during a release. Imports new versions, beta versions, slack messages, github issues, commits, authors, maintainers, etc... Inspect the management command to see exactly which commands are being run.
For this to work `SLACK_BOT_API` must be set in the `.env` file.
**Example**
```bash

View File

@@ -79,3 +79,6 @@ This project uses environment variables to configure certain aspects of the appl
### `MAX_CELERY_CONNECTIONS`
- If set, will set the maximum number of connections to the Celery in `settings.py`. Defaults to 60.
### `SLACK_BOT_TOKEN`
- Used to authenticate with the Slack API for pulling data for release reports.

View File

@@ -54,7 +54,8 @@ GITHUB_OAUTH_CLIENT_SECRET=
GOOGLE_OAUTH_CLIENT_ID=
GOOGLE_OAUTH_CLIENT_SECRET=
SLACK_BOT_TOKEN=changeme
# optional, needed to run reports
SLACK_BOT_TOKEN=
DEBUG_TOOLBAR=True
# uncomment whichever is appropriate for your editor
# currently only pycharm is supported, vscode kept for example of alternative options

View File

@@ -779,7 +779,9 @@ class CreateReportForm(CreateReportFullForm):
).aggregate(lines=Sum("deletions"))["lines"]
# we want 2 channels per pdf page, use batched to get groups of 2
slack_stats = batched(self._get_slack_stats(prior_version, version), 2)
committee_members = version.financial_committee_members.all()
return {
"committee_members": committee_members,
"lines_added": lines_added,
"lines_removed": lines_removed,
"wordcloud_base64": self._generate_hyperkitty_word_cloud(version),

View File

@@ -32,6 +32,8 @@ def progress_message(message: str):
@locked(1138692)
def run_commands(progress: list[str]):
if not settings.SLACK_BOT_TOKEN:
raise ValueError("SLACK_BOT_TOKEN is not set.")
handled_commits = {}
progress.append(progress_message("Importing versions..."))
call_command("import_versions", "--new")

View File

@@ -30,14 +30,14 @@
<div class="pdf-page grid grid-cols-2 gap-x-4 items-center justify-items-center {{ bg_color }}">
<div class="flex flex-col h-full gap-y-6">
<div class="flex flex-col gap-y-2">
<h1 class="flex mb-0">
<h1 class="flex mb-0 font-bold">
<img
class="mt-[3px]"
style="width:3.3rem; margin-right:.5rem;" src="{% static 'img/Boost_Symbol_Transparent.svg' %}"
>
Boost
</h1>
<div class="flex gap-x-12 link-icons my-4">
<div class="flex gap-x-12 link-icons my-4 text-2xl justify-between">
{% include "includes/_social_icon_links.html" %}
</div>
<div>{{ commit_count|intcomma }} commit{{ commit_count|pluralize }} up through {{ version.display_name }}</div>
@@ -59,12 +59,9 @@
<tbody>
<tr>
<th scope="col"
class="p-3 h-8 text-base border border-r-0 border-b-0 border-gray-400 text-center">
Platform
</th>
<th scope="col"
class="p-3 text-base border border-b-0 border-gray-400">
File
colspan="2"
class="p-3 h-8 text-base border border-b-0 border-gray-400 text-center">
Download Now!
</th>
</tr>
{% for os, download_files in downloads.items %}
@@ -142,8 +139,20 @@
<div class="pdf-page !p-16 {{ bg_color }}">
{% include "admin/_release_report_top_left_logo.html" %}
<h2>From the Fiscal Sponsorship Committee</h2>
<div class="w-full h-[80%] dynamic-text sponsor-message">
{{ version.sponsor_message|safe }}
<div class="flex flex-col w-full h-[80%] dynamic-text sponsor-message justify-between">
<div class="">{{ version.sponsor_message|safe }}</div>
<div class="committee_members border-t-1 flex flex-wrap mt-2 text-sm text-center">
{% for user in committee_members|dictsort:"first_name" %}
<figure class="w-32 m-2">
{% if user.hq_image %}
<img src="{{ user.hq_image_render.url }}" alt="{{ user.first_name }} {{ user.last_name }}" />
{% else %}
<img src="{% static 'img/Boost_Symbol_Transparent.svg' %}" alt="" />
{% endif %}
<figcaption class="p-1">{{user.first_name}} {{user.last_name}}</figcaption>
</figure>
{% endfor %}
</div>
</div>
</div>
{% endif %}
@@ -158,6 +167,7 @@
>
Boost {{ version.display_name }}
</h1>
<h2>Git activity for this release</h2>
<div class="mx-auto mb-4">{{ version_commit_count|intcomma }} Commit{{ version_commit_count|pluralize }} Across {{ library_count }} Repositories</div>
</div>

View File

@@ -3,3 +3,4 @@
<a href="https://mastodon.social/@boostlibs" target="_blank" title="Mastodon"><i class="fa-brands fa-mastodon"></i></a>
<a href="https://www.reddit.com/user/boostlibs/" target="_blank" title="Reddit"><i class="fa-brands fa-reddit"></i></a>
<a href="https://github.com/boostorg" target="_blank" title="Github"><i class="fa-brands fa-github"></i></a>
<a href="https://www.linkedin.com/company/cppalliance/" target="_blank" title="LinkedIn"><i class="fa-brands fa-linkedin"></i></a>

View File

@@ -43,6 +43,10 @@ class EmailUserAdmin(UserAdmin):
)
},
),
(
_("High Quality Image"),
{"fields": ("hq_image",)},
),
)
add_fieldsets = (
(None, {"classes": ("wide",), "fields": ("email", "password1", "password2")}),

View File

@@ -0,0 +1,31 @@
# Generated by Django 4.2.16 on 2025-01-22 22:39
import core.validators
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
("users", "0015_user_delete_permanently_at"),
]
operations = [
migrations.AddField(
model_name="user",
name="hq_image",
field=models.FileField(
blank=True,
help_text="A high-quality image of the user - used in profiles/reports.",
null=True,
upload_to="hiqh-quality-user-images",
validators=[
core.validators.FileTypeValidator(
extensions=[".jpg", ".jpeg", ".png"]
),
core.validators.MaxFileSizeValidator(max_size=52428800),
],
verbose_name="High Quality Image",
),
),
]

View File

@@ -20,7 +20,11 @@ from django.utils.translation import gettext_lazy as _
from imagekit.models import ImageSpecField
from imagekit.processors import ResizeToFill
from core.validators import image_validator, max_file_size_validator
from core.validators import (
image_validator,
max_file_size_validator,
large_file_max_size_validator,
)
logger = logging.getLogger(__name__)
@@ -221,6 +225,20 @@ class User(BaseUser):
format="JPEG",
options={"quality": 90},
)
hq_image = models.FileField(
upload_to="hiqh-quality-user-images",
help_text="A high-quality image of the user - used in profiles/reports.",
null=True,
blank=True,
validators=[image_validator, large_file_max_size_validator],
verbose_name="High Quality Image",
)
hq_image_render = ImageSpecField(
source="hq_image",
processors=[ResizeToFill(4096, 4096)],
format="JPEG",
options={"quality": 90},
)
claimed = models.BooleanField(
_("claimed"),
default=True,
@@ -318,6 +336,9 @@ class User(BaseUser):
self.delete_permanently_at = None
self.save()
def __str__(self):
return f"{self.first_name} {self.last_name} <{self.email}>"
class LastSeen(models.Model):
"""

View File

@@ -30,6 +30,7 @@ class VersionAdmin(admin.ModelAdmin):
search_fields = ["name", "description"]
date_hierarchy = "release_date"
inlines = [VersionFileInline]
filter_horizontal = ["financial_committee_members"]
change_list_template = "admin/version_change_list.html"
def get_urls(self):

View File

@@ -0,0 +1,24 @@
# Generated by Django 4.2.16 on 2025-01-21 01:15
from django.conf import settings
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
("versions", "0017_alter_review_review_manager_alter_review_submitters"),
]
operations = [
migrations.AddField(
model_name="version",
name="financial_committee_members",
field=models.ManyToManyField(
blank=True,
help_text="Financial Committee members who are responsible for this release.",
to=settings.AUTH_USER_MODEL,
),
),
]

View File

@@ -47,7 +47,11 @@ class Version(models.Model):
blank=True,
help_text='Message to show in release reports on the "Fiscal Sponsorship Committee" page.', # noqa: E501
)
financial_committee_members = models.ManyToManyField(
User,
blank=True,
help_text="Financial Committee members who are responsible for this release.",
)
objects = VersionManager()
def __str__(self):