Skip to content

Commit 7b76cd9

Browse files
authored
Merge pull request #46 from rebase-network/dev
docs(repo): forbid local main merges
2 parents 9816b4a + f836d3a commit 7b76cd9

8 files changed

Lines changed: 427 additions & 18 deletions

File tree

‎AGENTS.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ Examples:
2828
- After a coherent batch is committed locally, push it to `origin/dev`.
2929
- Open a pull request from `dev` to `main` for review and release tracking.
3030
- Merge the pull request into `main` only after the release candidate is ready.
31+
- If pull request merge permission is unavailable, stop at the PR step and hand the PR back to a maintainer.
32+
- Do not merge `dev` into `main` locally as a substitute for the GitHub pull request flow.
3133
- Do not push release changes directly to `origin/main`.
3234

3335
## Documentation Map

‎apps/api/src/lib/contributors.ts‎

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { asc, count, desc, eq, inArray } from 'drizzle-orm';
1+
import { asc, count, desc, eq, inArray, sql } from 'drizzle-orm';
22

33
import { contributorRoleBindings, contributorRoles, contributors } from '@rebase/db';
44
import type {
@@ -341,3 +341,30 @@ export const listPublicContributorGroups = async () => {
341341
contributors: contributorsByRole.get(role.id) ?? [],
342342
}));
343343
};
344+
345+
export const listRandomPublicContributors = async (limit = 10) => {
346+
const db = getDb();
347+
const contributorRows =
348+
limit > 0
349+
? await db
350+
.select({
351+
slug: contributors.slug,
352+
name: contributors.name,
353+
avatarAssetId: contributors.avatarAssetId,
354+
avatarSeed: contributors.avatarSeed,
355+
})
356+
.from(contributors)
357+
.where(eq(contributors.status, 'published'))
358+
.orderBy(sql`random()`)
359+
.limit(limit)
360+
: [];
361+
362+
const avatarUrls = await listPublicAssetUrlsById(contributorRows.map((contributor) => contributor.avatarAssetId));
363+
364+
return contributorRows.map((contributor) => ({
365+
slug: contributor.slug,
366+
name: contributor.name,
367+
avatarUrl: contributor.avatarAssetId ? avatarUrls.get(contributor.avatarAssetId) : undefined,
368+
avatarSeed: contributor.avatarSeed,
369+
}));
370+
};

‎apps/api/src/routes/public.ts‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Hono } from 'hono';
22

33
import { ok } from '../lib/http.js';
44
import { getPublicArticleBySlug, listPublicArticles } from '../lib/articles.js';
5-
import { listPublicContributorGroups } from '../lib/contributors.js';
5+
import { listPublicContributorGroups, listRandomPublicContributors } from '../lib/contributors.js';
66
import { getPublicEventBySlug, listPublicEvents } from '../lib/events.js';
77
import {
88
getGeekDailySearchDocuments,
@@ -34,13 +34,14 @@ publicRoutes.get('/site-config', async (c) => c.json(ok(await getPublicSiteConfi
3434
publicRoutes.get('/about', async (c) => c.json(ok(await getPublicAboutPage())));
3535

3636
publicRoutes.get('/home', async (c) => {
37-
const [site, about, articles, jobs, events, geekdaily] = await Promise.all([
37+
const [site, about, articles, jobs, events, geekdaily, featuredContributors] = await Promise.all([
3838
getPublicSiteConfig(),
3939
getPublicAboutPage(),
4040
listPublicArticles(),
4141
listPublicJobs(),
4242
listPublicEvents(),
4343
listPublicGeekDailyEpisodes(3),
44+
listRandomPublicContributors(10),
4445
]);
4546

4647
const recentArticles = sortByPublishedAtDesc(articles).slice(0, 3);
@@ -90,6 +91,7 @@ publicRoutes.get('/home', async (c) => {
9091
recentJobs,
9192
upcomingEvents,
9293
recentGeekDaily: geekdaily,
94+
featuredContributors,
9395
dynamicFeed,
9496
}),
9597
);

‎apps/web/src/lib/content.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,13 @@ interface ContributorGroupPayload {
3838
contributors: Contributor[];
3939
}
4040

41+
interface HomeContributorPreviewPayload {
42+
slug: string;
43+
name: string;
44+
avatarUrl?: string;
45+
avatarSeed: string;
46+
}
47+
4148
interface PublicGeekDailyItemPayload {
4249
title: string;
4350
authorName: string;
@@ -67,6 +74,7 @@ interface HomeFeedPayload {
6774
recentJobs: Job[];
6875
upcomingEvents: Event[];
6976
recentGeekDaily: PublicGeekDailyEpisodePayload[];
77+
featuredContributors: HomeContributorPreviewPayload[];
7078
dynamicFeed: Array<{
7179
type: 'article' | 'job' | 'event' | 'geekdaily';
7280
title: string;
@@ -245,6 +253,7 @@ export async function getHomeFeed() {
245253
latestEvents: payload.upcomingEvents,
246254
latestGeekDaily: payload.latestGeekDaily ? mapGeekDailyEpisode(payload.latestGeekDaily) : undefined,
247255
recentGeekDaily: payload.recentGeekDaily.map(mapGeekDailyEpisode),
256+
featuredContributors: payload.featuredContributors,
248257
dynamicFeed: payload.dynamicFeed.map((item) => {
249258
if (item.type !== 'event' || !item.publishedAt || !item.href.startsWith('/events/')) {
250259
return item;

0 commit comments

Comments
 (0)