Skip to content

Commit 70507a4

Browse files
🐛 (buape) hide the personal default team from the dashboard
Clean-room fork change, OSS-only: - team switcher no longer lists or buckets the personal default team (sorters, teams column, organizations index); enterprise organization-scoped default teams are untouched - post-login resolution falls back to the first IdP-synced team when the personal team was the previous landing target Adds build-buape.yml: frontend bundle via upstream devenv image, published to ghcr as penpot-frontend.
1 parent afc40a3 commit 70507a4

4 files changed

Lines changed: 141 additions & 24 deletions

File tree

‎.github/workflows/build-buape.yml‎

Lines changed: 104 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
name: BUAPE-frontend
2+
3+
run-name: >-
4+
BUAPE-frontend (develop @ ${{ github.sha }})
5+
6+
# Buape fork build pipeline: frontend bundle only. Runs the upstream
7+
# devenv-contained build (penpotapp/devenv) so the toolchain (JDK, node,
8+
# wasm toolchain, shadow-cljs) matches the release images, then packages
9+
# the bundle with Dockerfile.frontend and publishes to GHCR.
10+
on:
11+
push:
12+
branches: [develop]
13+
paths:
14+
- 'frontend/**'
15+
- 'common/**'
16+
- 'render-wasm/**'
17+
- 'plugins/**'
18+
- 'mcp/**'
19+
- 'docker/images/Dockerfile.frontend'
20+
- 'manage.sh'
21+
- '.github/workflows/build-buape.yml'
22+
workflow_dispatch:
23+
inputs:
24+
force:
25+
description: 'Rebuild even if the image tag already exists'
26+
type: boolean
27+
required: false
28+
default: false
29+
30+
concurrency:
31+
group: ${{ github.workflow }}
32+
cancel-in-progress: true
33+
34+
permissions:
35+
contents: read
36+
37+
jobs:
38+
build-frontend:
39+
name: Buape frontend image
40+
runs-on: ubuntu-latest
41+
timeout-minutes: 90
42+
permissions:
43+
contents: read
44+
packages: write
45+
steps:
46+
- uses: actions/checkout@08eba0b27e820071cde6df949e0beb9ba4906955 # v4
47+
with:
48+
# manage.sh stamps versions with `git describe --tags`; needs
49+
# full history and annotated tags.
50+
fetch-depth: 0
51+
persist-credentials: false
52+
53+
- name: Version info
54+
id: vars
55+
run: |
56+
echo "short_sha=$(git rev-parse --short=7 HEAD)" >> $GITHUB_OUTPUT
57+
echo "sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT
58+
59+
- name: Pull upstream devenv image
60+
run: docker pull penpotapp/devenv:latest
61+
62+
- name: Build frontend bundle (devenv container)
63+
env:
64+
# shadow-cljs release build is memory hungry
65+
JAVA_OPTS: "-Xms2G -Xmx10G"
66+
run: |
67+
./manage.sh build-frontend-bundle 2>&1 | tee /tmp/bundle.log
68+
test -f bundles/frontend/version.txt
69+
70+
- name: Set up QEMU (multi-arch image build)
71+
run: docker run --privileged --rm tonistiigi/binfmt --install all
72+
73+
- name: Log in to GHCR
74+
uses: docker/login-action@74a5d142397b4f367a81961eb4e6a43486834a80 # v3
75+
with:
76+
registry: ghcr.io
77+
username: ${{ github.actor }}
78+
password: ${{ secrets.GITHUB_TOKEN }}
79+
80+
- name: Build and push frontend image
81+
run: |
82+
TAG="ghcr.io/${{ github.repository }}/penpot-frontend"
83+
docker buildx create --name penpot --driver docker-container --use >/dev/null 2>&1 || true
84+
docker buildx build \
85+
--platform linux/amd64 \
86+
--build-arg BUNDLE_PATH="bundles/frontend/" \
87+
-f docker/images/Dockerfile.frontend \
88+
--tag "${TAG}:${{ steps.vars.outputs.short_sha }}" \
89+
--tag "${TAG}:develop" \
90+
--push \
91+
.
92+
env:
93+
SOURCE_DATE_EPOCH: 0
94+
95+
- name: Summary
96+
run: |
97+
{
98+
echo "### Frontend image pushed"
99+
echo ""
100+
echo '- `ghcr.io/${{ github.repository }}/penpot-frontend:${{ steps.vars.outputs.short_sha }}`'
101+
echo '- `ghcr.io/${{ github.repository }}/penpot-frontend:develop`'
102+
echo ""
103+
echo "Commit: ${{ steps.vars.outputs.sha }}"
104+
} >> "$GITHUB_STEP_SUMMARY"

‎frontend/src/app/main/data/auth.cljs‎

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,17 @@
5252
team-id (dtm/get-last-team-id)
5353
team-id (if (and team-id (contains? team-ids team-id))
5454
team-id
55-
default-team-id)]
55+
default-team-id)
56+
;; BUAPE: the personal default team is hidden; fall
57+
;; back to the first team synced from the IdP.
58+
other-team-id (->> teams
59+
(seq)
60+
(map :id)
61+
(remove #(= % default-team-id))
62+
(first))
63+
team-id (if (and (= team-id default-team-id) other-team-id)
64+
other-team-id
65+
team-id)]
5666
(->> (dtm/resolve-login-team-id {:team-id team-id
5767
:default-team-id default-team-id})
5868
(rx/mapcat (fn [team-id]

‎frontend/src/app/main/ui/dashboard/organization_team_switch.cljs‎

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,14 @@
4444
;; have no organization (`:organization` is `nil`).
4545
(def ^:private personal-bucket-id :personal)
4646

47+
(defn- personal-team?
48+
"The user's own default team (OSS \"Personal projects\"). The
49+
organization-scoped default teams found on enterprise deployments
50+
are not affected: only a default team without an organization is
51+
the personal one."
52+
[{:keys [is-default organization-id]}]
53+
(and is-default (not organization-id)))
54+
4755
(defn organization-bucket-id
4856
[organization]
4957
(or (:id organization) personal-bucket-id))
@@ -87,9 +95,10 @@
8795
(\"Personal projects\") always last. `boolean` collapses a missing
8896
`:is-default` and an explicit `false` into one comparator value."
8997
[teams]
90-
(sort-by (juxt (fn [team] (boolean (:is-default team)))
91-
(fn [team] (name-sort-key (:name team ""))))
92-
teams))
98+
(->> teams
99+
(remove personal-team?)
100+
(sort-by (juxt (fn [team] (boolean (:is-default team)))
101+
(fn [team] (name-sort-key (:name team "")))))))
93102

94103
(defn sort-all-teams
95104
"Orders every team for the simplified single-column dropdown:
@@ -100,9 +109,10 @@
100109
([teams]
101110
(sort-all-teams teams team-display-name))
102111
([teams display-name]
103-
(sort-by (juxt (fn [team] (boolean (:is-default team)))
104-
(comp name-sort-key display-name))
105-
teams)))
112+
(->> teams
113+
(remove personal-team?)
114+
(sort-by (juxt (fn [team] (boolean (:is-default team)))
115+
(comp name-sort-key display-name))))))
106116

107117
(defn teams-for-organization
108118
"Teams to preview in the dropdown's second column for
@@ -350,8 +360,7 @@
350360
;; `sort-organization-teams`/`sort-all-teams`). It stays out of
351361
;; the scroll area so it sits right under a short list and
352362
;; sticks above the actions under a long one.
353-
listed (remove :is-default teams)
354-
personal (d/seek :is-default teams)
363+
listed (remove personal-team? teams)
355364

356365
{:keys [ref on-scroll fade?]} (use-scroll-fade teams)]
357366

@@ -371,18 +380,6 @@
371380
:on-select on-select
372381
:on-context-menu on-context-menu}])]]
373382

374-
(when personal
375-
[:ul {:class (stl/css :column-bucket)}
376-
;; Skipped when it's the only team: there's nothing above it
377-
;; to set it apart from.
378-
(when (seq listed)
379-
[:li {:role "separator" :class (stl/css :column-separator)}])
380-
[:> team-item* {:team personal
381-
:href (team-href router personal)
382-
:selected-team-id selected-team-id
383-
:on-select on-select
384-
:on-context-menu on-context-menu}]])
385-
386383
[:ul {:class (stl/css :column-actions)}
387384
[:li {:role "separator" :class (stl/css :column-separator)}]
388385

@@ -440,8 +437,8 @@
440437
(mf/with-memo [teams current-organization]
441438
(cond-> (->> teams
442439
vals
443-
(filter :is-default)
444-
(map dtm/team->organization)
440+
(remove personal-team?)
441+
(keep dtm/team->organization)
445442
(d/index-by organization-bucket-id))
446443
(:id current-organization)
447444
(assoc (:id current-organization) current-organization)))

‎frontend/src/app/main/ui/routes.cljs‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,13 @@
296296
last-team-id (dtm/get-last-team-id)
297297
team-id (if (contains? teams last-team-id)
298298
last-team-id
299-
default-team-id)]
299+
default-team-id)
300+
;; BUAPE: the personal default team is hidden;
301+
;; fall back to the first team synced from the IdP.
302+
other-team-id (first (remove #(= % default-team-id) teams))
303+
team-id (if (and (= team-id default-team-id) other-team-id)
304+
other-team-id
305+
team-id)]
300306
(->> (dtm/resolve-login-team-id {:team-id team-id
301307
:default-team-id default-team-id})
302308
(rx/subs!

0 commit comments

Comments
 (0)