kitgit

tirbofish/kitgit · commit

d03e8ac0517202e8b5ca61459a25474466c4ddb3

Improve repo UX with PR reviews, invite signup, and cleaner chrome. Add pull reviews and full-diff expand, let invite codes bypass locked signups, and rework the branch toolbar / latest-commit bar plus related settings UI polish.

Verified

Thribhu K <4tkbytes@pm.me> · 2026-07-29 01:51

view full diff

diff --git a/migrations/018_pull_reviews.sql b/migrations/018_pull_reviews.sql
new file mode 100644
index 0000000..bbc690f
--- /dev/null
+++ b/migrations/018_pull_reviews.sql
@@ -0,0 +1,9 @@
+CREATE TABLE IF NOT EXISTS pull_reviews (
+  id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
+  pull_id UUID NOT NULL REFERENCES pull_requests(id) ON DELETE CASCADE,
+  reviewer_id UUID NOT NULL REFERENCES users(id) ON DELETE CASCADE,
+  state TEXT NOT NULL CHECK (state IN ('approved','changes_requested','commented')),
+  body TEXT NOT NULL DEFAULT '',
+  created_at TIMESTAMPTZ NOT NULL DEFAULT now()
+);
+CREATE INDEX IF NOT EXISTS pull_reviews_pull_id_idx ON pull_reviews(pull_id);
diff --git a/src/db/models.rs b/src/db/models.rs
index c7bd51b..42d2653 100644
--- a/src/db/models.rs
+++ b/src/db/models.rs
@@ -288,6 +288,16 @@ pub struct Comment {
 }
 
 #[derive(Debug, Clone, FromRow)]
+pub struct PullReview {
+    pub id: Uuid,
+    pub pull_id: Uuid,
+    pub reviewer_id: Uuid,
+    pub state: String,
+    pub body: String,
+    pub created_at: DateTime<Utc>,
+}
+
+#[derive(Debug, Clone, FromRow)]
 pub struct Release {
     pub id: Uuid,
     pub repo_id: Uuid,
diff --git a/src/db/queries.rs b/src/db/queries.rs
index ce0cbc9..8df7cab 100644
--- a/src/db/queries.rs
+++ b/src/db/queries.rs
@@ -1326,6 +1326,29 @@ pub async fn user_owns_email(pool: &PgPool, user_id: Uuid, email: &str) -> Resul
     Ok(row.is_some())
 }
 
+/// Resolve a kitgit username from a commit author email (primary or secondary).
+pub async fn username_by_email(pool: &PgPool, email: &str) -> Result<Option<String>> {
+    let email = email.trim().to_ascii_lowercase();
+    if email.is_empty() {
+        return Ok(None);
+    }

Large diffs are not rendered by default. Showing the first 50 of 2161 lines. Show full diff