fix(git_server): make sure onPushEvent accepts fetch/pull too
+ 14
- 8
app/services/gitServer/onPushEvent.ts
@@ -42,28 +42,34 @@ const makeOnPushEvent: ServiceMethodFactory<
           return updatedRepo;
         });
 
-      const baseUrl =
-        env === "development"
-          ? `${Env.DEPLOYMENT_SCHEME}://${Env.DEPLOYMENT_DOMAIN}:${Env.PORT}/${orgSlug}/${repoSlug}`
-          : `${Env.DEPLOYMENT_SCHEME}://${Env.DEPLOYMENT_DOMAIN}/${orgSlug}/${repoSlug}`;
+      const repoUrlPrefix = `${Env.DEPLOYMENT_SCHEME}://${Env.DEPLOYMENT_DOMAIN}`;
+      const repoUrlSuffix = `${orgSlug}/${repoSlug}`;
+      const repoUrlBase =
+        env === "production"
+          ? `${repoUrlPrefix}/${repoUrlSuffix}`
+          : `${repoUrlPrefix}:${Env.PORT}/${repoUrlSuffix}`;
 
       if (data.payload != null) {
-        message.write("🖖 See the details of your push at:\n");
+        message.write(
+          `Hey ${data.username}, welcome back 🖖. See the details of your push at:\n`
+        );
         if (data.payload.refType === "head") {
-          message.write(`🧲 ${baseUrl}/show/${data.payload.commitId}\n`);
+          message.write(`🔗 ${repoUrlBase}/show/${data.payload.commitId}\n`);
         } else if (data.payload.refType === "tag") {
-          message.write(`➡️ ${baseUrl}/tags/${data.payload.refName}\n`);
+          message.write(`🏷 ${repoUrlBase}/tags/${data.payload.refName}\n`);
         }
       }
 
       message.write("\n");
-      message.accept();
     } else if (data.packType === GitServer.PackType.UPLOAD) {
       // client has done something like "git clone" or "git fetch" or "git pull",
       // it is receiving, server is uploading
       console.log("upload-pack");
       // message.write(`🖖 Welcome at GitFOSS ${data.username}!\n`);
     }
+
+    // Finally, accept the payload from client
+    message.accept();
   };
 };