Skip to content

Commit 9ac4054

Browse files
authored
Merge branch 'staging' into dev-luckspt-company-tasks
2 parents cd6d2aa + bc849d5 commit 9ac4054

39 files changed

+2116
-1619
lines changed

backend/src/mongodb/company.go

Lines changed: 50 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -911,10 +911,10 @@ func (c *CompaniesType) UpdateCompanyParticipationStatus(companyID primitive.Obj
911911

912912
// UpdateCompanyData is the data used to update a company, using the method UpdateCompany.
913913
type UpdateCompanyData struct {
914-
Name *string `json:"name"`
915-
Description *string `json:"description"`
916-
Site *string `json:"site"`
917-
LinkedIn *string `json:"linkedin"`
914+
Name *string `json:"name"`
915+
Description *string `json:"description"`
916+
Site *string `json:"site"`
917+
LinkedIn *string `json:"linkedin"`
918918
BillingInfo *models.CompanyBillingInfo `json:"billingInfo"`
919919
}
920920

@@ -1434,6 +1434,52 @@ func (c *CompaniesType) DeleteCompanyParticipation(companyID primitive.ObjectID,
14341434
return &updatedCompany, nil
14351435
}
14361436

1437+
// AnnounceAcceptedCompanies changes all companies with ACCEPTED status on the
1438+
// current event to ANNOUNCED. Returns the number of companies updated.
1439+
func (c *CompaniesType) AnnounceAcceptedCompanies() (int64, error) {
1440+
ctx := context.Background()
1441+
1442+
currentEvent, err := Events.GetCurrentEvent()
1443+
if err != nil {
1444+
return 0, err
1445+
}
1446+
1447+
filter := bson.M{
1448+
"participations": bson.M{
1449+
"$elemMatch": bson.M{
1450+
"event": currentEvent.ID,
1451+
"status": models.Accepted,
1452+
},
1453+
},
1454+
}
1455+
1456+
update := bson.M{
1457+
"$set": bson.M{
1458+
"participations.$[elem].status": models.Announced,
1459+
},
1460+
}
1461+
1462+
arrayFilters := options.ArrayFilters{
1463+
Filters: []interface{}{
1464+
bson.M{
1465+
"elem.event": currentEvent.ID,
1466+
"elem.status": models.Accepted,
1467+
},
1468+
},
1469+
}
1470+
1471+
opts := options.Update().SetArrayFilters(arrayFilters)
1472+
1473+
result, err := c.Collection.UpdateMany(ctx, filter, update, opts)
1474+
if err != nil {
1475+
return 0, err
1476+
}
1477+
1478+
ResetCurrentPublicCompanies()
1479+
1480+
return result.ModifiedCount, nil
1481+
}
1482+
14371483
// FindThread finds a thread in a company
14381484
func (c *CompaniesType) FindThread(threadID primitive.ObjectID) (*models.Company, error) {
14391485

backend/src/router/company.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1454,3 +1454,17 @@ func syncCompanyGmailMessages(w http.ResponseWriter, r *http.Request) {
14541454
"total": len(data.Messages),
14551455
})
14561456
}
1457+
1458+
// announceAcceptedCompanies changes all companies with ACCEPTED participation
1459+
// on the current event to ANNOUNCED. Coordinator-only.
1460+
func announceAcceptedCompanies(w http.ResponseWriter, r *http.Request) {
1461+
count, err := mongodb.Companies.AnnounceAcceptedCompanies()
1462+
if err != nil {
1463+
http.Error(w, "Could not announce accepted companies: "+err.Error(), http.StatusExpectationFailed)
1464+
return
1465+
}
1466+
1467+
json.NewEncoder(w).Encode(map[string]interface{}{
1468+
"announced": count,
1469+
})
1470+
}

backend/src/router/init.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,7 @@ func InitializeRouter() {
158158
companyRouter.HandleFunc("/{id}", authCoordinator(deleteCompany)).Methods("DELETE")
159159
// query companies by multiple member IDs
160160
companyRouter.HandleFunc("/byMembers", authMember(getCompaniesByMembers)).Methods("POST")
161+
companyRouter.HandleFunc("/announce", authCoordinator(announceAcceptedCompanies)).Methods("POST")
161162
companyRouter.HandleFunc("/{id}/subscribe", authMember(subscribeToCompany)).Methods("PUT")
162163
companyRouter.HandleFunc("/{id}/unsubscribe", authMember(unsubscribeToCompany)).Methods("PUT")
163164
companyRouter.HandleFunc("/{id}/image/internal", authMember(setCompanyPrivateImage)).Methods("POST")

frontend/.husky/commit-msg

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
2-
npx --yes commitlint --config frontend/commitlint.config.js --edit "$1"
1+
cd "$(dirname "$0")/.." # goes to frontend/
2+
npx --yes commitlint --config ./commitlint.config.js --edit "$1"

frontend/package-lock.json

Lines changed: 68 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,14 +21,14 @@
2121
"@pinia/colada": "^0.17.1",
2222
"@tailwindcss/vite": "^4.1.11",
2323
"@vee-validate/zod": "^4.15.1",
24-
"@vueuse/core": "^13.6.0",
24+
"@vueuse/core": "^13.9.0",
2525
"@vueuse/integrations": "^13.6.0",
2626
"axios": "^1.11.0",
2727
"class-variance-authority": "^0.7.1",
2828
"clsx": "^2.1.1",
2929
"lucide-vue-next": "^0.536.0",
3030
"pinia": "^3.0.3",
31-
"reka-ui": "^2.7.0",
31+
"reka-ui": "^2.8.0",
3232
"tailwind-merge": "^3.3.1",
3333
"tailwindcss": "^4.1.11",
3434
"tw-animate-css": "^1.3.6",

frontend/src/App.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
<!-- <AuthLoader v-if="authStore.isInitializing" /> -->
77
<router-view />
88

9+
<GlobalConfetti />
910
<ToastContainer />
1011
<PiniaColadaDevtools />
1112
</template>
@@ -14,6 +15,7 @@
1415
import { PiniaColadaDevtools } from "@pinia/colada-devtools";
1516
import { useAuthStore } from "@/stores/auth";
1617
import ToastContainer from "@/components/ui/toast/ToastContainer.vue";
18+
import GlobalConfetti from "@/components/GlobalConfetti.vue";
1719
1820
const authStore = useAuthStore();
1921

frontend/src/api/companies.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,3 +151,6 @@ export const generateCompanyContract = (
151151

152152
export const updateCompanyTasks = (id: string, tasks: CompanyTasks) =>
153153
instance.put<Company>(`/companies/${id}/participation/tasks`, { tasks });
154+
155+
export const announceAcceptedCompanies = () =>
156+
instance.post<{ announced: number }>("/companies/announce");

frontend/src/components/Communications.vue

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -156,11 +156,8 @@
156156
: 'justify-start',
157157
]"
158158
>
159-
<!-- Author avatar for messages (on the left side) -->
160-
<div
161-
v-if="thread.kind !== ThreadKind.ThreadKindPhoneCall"
162-
class="flex flex-col items-center gap-1"
163-
>
159+
<!-- Author avatar for messages (including phone calls) -->
160+
<div class="flex flex-col items-center gap-1">
164161
<Image
165162
v-if="getAuthorAvatar(getMessageAuthor(thread))"
166163
:src="getAuthorAvatar(getMessageAuthor(thread))"
@@ -958,14 +955,20 @@ watch(
958955
959956
const getMessageDirection = (kind: ThreadKind): "incoming" | "outgoing" => {
960957
return kind === ThreadKind.ThreadKindTo ||
961-
kind === ThreadKind.ThreadKindTemplate
958+
kind === ThreadKind.ThreadKindTemplate ||
959+
kind === ThreadKind.ThreadKindPhoneCall
962960
? "outgoing"
963961
: "incoming";
964962
};
965963
966964
const getMessageAuthor = (thread: ThreadWithEntry): Author | null => {
967965
const direction = getMessageDirection(thread.kind);
968966
967+
// For phone calls, always show the member who made the call
968+
if (thread.kind === ThreadKind.ThreadKindPhoneCall && thread.entry?.member) {
969+
return getMemberById(thread.entry.member);
970+
}
971+
969972
if (direction === "outgoing" && thread.entry?.member) {
970973
return getMemberById(thread.entry?.member);
971974
} else if (direction === "incoming") {

0 commit comments

Comments
 (0)