Skip to content

fix: 3 issues at once#552

Open
JoaoVitorLobo wants to merge 5 commits intostagingfrom
joao/deck2-templates
Open

fix: 3 issues at once#552
JoaoVitorLobo wants to merge 5 commits intostagingfrom
joao/deck2-templates

Conversation

@JoaoVitorLobo
Copy link

  1. Create speaker with contact:
    - ContactForm.vue
    - CreateSpeakerForm.vue
    - speaker.go
  2. Remove pending status from communications:
    - Communications.vue
  3. Gender on templates:
    - 33-pt.html
    - BulkEmailDialogTrigger.vue
    - SpeakerCommunications.vue
    - useBulkEmails.ts
    - useDirectEmail.ts
    - speakers.ts
    - templates.ts
    - ResponsibilitiesView.vue

@Francisca105 Francisca105 changed the base branch from master to staging January 25, 2026 14:33
Copy link
Member

@Francisca105 Francisca105 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of thoughts on good practices: try to keep changes focused on a single issue, with one PR per issue, and mention the related issue in the PR description so reviewers have full context.

</div>

<div class="flex items-center gap-1">
<!-- Pending Status -->
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid leaving commented-out code, if it’s not needed, please remove it.

};

const getStatusLabel = (status: ThreadStatus): string => {
/*const getStatusLabel = (status: ThreadStatus): string => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avoid leaving commented-out code, if it’s not needed, please remove it.

<!-- Gender Field -->
<div class="space-y-2">
<Label class="text-sm font-medium">Gender</Label>
<Label class="text-sm font-medium">Gender *</Label>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The asterisk in the label 'Gender *' indicates this field should be required, but there is no validation or enforcement in the code to support that.

</Button>
<div class="flex gap-2">
<Button :disabled="isLoading" @click="createSpeakerAndFinish">
<Button
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Step 3 relies on ContactForm, adding the required validation there makes the step 3 validation redundant. These changes in this file can be removed.

const memberGender = authStore.member!.contactObject.gender;
const speakerGender = props.speaker.contactObject.gender;

// Use contactObject which contains the full Contact (including gender)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Use contactObject which contains the full Contact (including gender)

These comments are unnecessary and can be removed.

const speakerGender = props.speaker.contactObject.gender;

// Use contactObject which contains the full Contact (including gender)
// Fallback to empty string when gender is unavailable to avoid runtime errors
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// Fallback to empty string when gender is unavailable to avoid runtime errors

These comments are unnecessary and can be removed.

export const templatePaths: Record<EmailTemplate, string> = {
[EmailTemplate.COMPANIES_EN]: "/companies/33-en.html",
[EmailTemplate.COMPANIES_PT]: "/companies/33-pt.html",
[EmailTemplate.COMPANIES_EN]: "/companies/32-en.html",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The templates were reverted to the previous edition, please undo it.

case "OTHER":
return { article: "e", suffix: "e" };
default:
return { article: "o/a/e", suffix: "(a)" };
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be better if the default case was equal to the "OTHER" case.

Copy link
Member

@Francisca105 Francisca105 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion for #552 (comment)

@@ -363,4 +363,4 @@
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const hasGender = !!formData.contact.gender;
const hasLanguage = !!formData.contact.language;
return hasName && hasEmail && hasGender && hasLanguage;

});

const validationMessage = computed(() => {
if (!props.withoutName && !formData.name?.trim()) return "Name is required";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (!props.withoutName && !formData.name?.trim()) return "Name is required";
if (!formData.contact.gender) return "Gender is required";
if (!formData.contact.language) return "Language is required";

@JoaoVitorLobo
Copy link
Author

Before, there was no validation nor validation message in the Create Speaker – Step 3:

  • watch was emitting every change from ContactForm to CreateSpeakersForm, so the validation was never being executed as supposed inside ContactForm
  • the validation code available in ContactForm only supported the edit contact feature, not create contact
  • if CreateSpeakersForm received an invalid newData, the validation would be supposed to be executed in the CreateSpeakersForm, so it became necessary to emit newData only when it is valid, executing the validation on ContactFOrm
  • Added hasGender and hasLanguage to both validation and validationMessage
  • Even though validation and validation message are now handled in ContactForm, it was still necessary to disable the Create Speaker button in CreateSpeakersForm when Step 3 is invalid. Otherwise, if ContactForm first emmited a valid data and later emmited invalid data, the Create Speaker button would remain enabled for invalid data

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants