From 3e5c55c14ef0027f3f06ecdc8b015df2c3e0c1d8 Mon Sep 17 00:00:00 2001 From: taichan <40626578+taichanNE30@users.noreply.github.com> Date: Sat, 21 Oct 2023 07:45:47 +0900 Subject: [PATCH 1/6] =?UTF-8?q?chore:=20Pull=20Request=E6=99=82=E3=81=ABap?= =?UTF-8?q?i.json=E3=81=AE=E5=B7=AE=E5=88=86=E3=82=92=E8=A1=A8=E7=A4=BA?= =?UTF-8?q?=E3=81=99=E3=82=8BActions=20workflow=20(#12090)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: Pull Request時にapi.jsonのdiffを出力するworkflow * refactor: job names * fix: set repository to get api diff * chore: set permission to workflow * set sleep 30s (shorter) * chore: set label of diff * chore: more attempts to fetch misskey * chore: add full diff output of api.js * chore: save full-diff to Artifact * chore: add message to download diff Artifact --- .github/workflows/get-api-diff.yml | 225 +++++++++++++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 .github/workflows/get-api-diff.yml diff --git a/.github/workflows/get-api-diff.yml b/.github/workflows/get-api-diff.yml new file mode 100644 index 000000000..9bab4f658 --- /dev/null +++ b/.github/workflows/get-api-diff.yml @@ -0,0 +1,225 @@ +name: Report API Diff + +on: + pull_request: + branches: + - master + - develop + +jobs: + get-base: + runs-on: ubuntu-latest + permissions: + contents: read + + strategy: + matrix: + node-version: [20.5.1] + + services: + db: + image: postgres:13 + ports: + - 5432:5432 + env: + POSTGRES_DB: misskey + POSTGRES_HOST_AUTH_METHOD: trust + POSTGRES_USER: example-misskey-user + POSTGRESS_PASS: example-misskey-pass + redis: + image: redis:7 + ports: + - 6379:6379 + + steps: + - uses: actions/checkout@v4.1.1 + with: + repository: ${{ github.event.pull_request.base.repo.full_name }} + ref: ${{ github.base_ref }} + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3.8.1 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .config/example.yml .config/default.yml + - name: Build + run: pnpm build + - name : Migrate + run: pnpm migrate + - name: Launch misskey + run: | + screen -S misskey -dm pnpm run dev + sleep 30s + - name: Wait for Misskey to be ready + run: | + MAX_RETRIES=12 + RETRY_DELAY=5 + count=0 + until $(curl --output /dev/null --silent --head --fail http://localhost:3000) || [[ $count -eq $MAX_RETRIES ]]; do + printf '.' + sleep $RETRY_DELAY + count=$((count + 1)) + done + + if [[ $count -eq $MAX_RETRIES ]]; then + echo "Failed to connect to Misskey after $MAX_RETRIES attempts." + exit 1 + fi + - id: fetch + name: Get api.json from Misskey + run: | + RESULT=$(curl --retry 5 --retry-delay 5 --retry-max-time 60 http://localhost:3000/api.json) + echo $RESULT > api-base.json + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: api-artifact + path: api-base.json + - name: Kill Misskey Job + run: screen -S misskey -X quit + + get-head: + runs-on: ubuntu-latest + permissions: + contents: read + + strategy: + matrix: + node-version: [20.5.1] + + services: + db: + image: postgres:13 + ports: + - 5432:5432 + env: + POSTGRES_DB: misskey + POSTGRES_HOST_AUTH_METHOD: trust + POSTGRES_USER: example-misskey-user + POSTGRESS_PASS: example-misskey-pass + redis: + image: redis:7 + ports: + - 6379:6379 + + steps: + - uses: actions/checkout@v4.1.1 + with: + repository: ${{ github.event.pull_request.head.repo.full_name }} + ref: ${{ github.head_ref }} + submodules: true + - name: Install pnpm + uses: pnpm/action-setup@v2 + with: + version: 8 + run_install: false + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3.8.1 + with: + node-version: ${{ matrix.node-version }} + cache: 'pnpm' + - run: corepack enable + - run: pnpm i --frozen-lockfile + - name: Check pnpm-lock.yaml + run: git diff --exit-code pnpm-lock.yaml + - name: Copy Configure + run: cp .config/example.yml .config/default.yml + - name: Build + run: pnpm build + - name : Migrate + run: pnpm migrate + - name: Launch misskey + run: | + screen -S misskey -dm pnpm run dev + sleep 30s + - name: Wait for Misskey to be ready + run: | + MAX_RETRIES=12 + RETRY_DELAY=5 + count=0 + until $(curl --output /dev/null --silent --head --fail http://localhost:3000) || [[ $count -eq $MAX_RETRIES ]]; do + printf '.' + sleep $RETRY_DELAY + count=$((count + 1)) + done + + if [[ $count -eq $MAX_RETRIES ]]; then + echo "Failed to connect to Misskey after $MAX_RETRIES attempts." + exit 1 + fi + - id: fetch + name: Get api.json from Misskey + run: | + RESULT=$(curl --retry 5 --retry-delay 5 --retry-max-time 60 http://localhost:3000/api.json) + echo $RESULT > api-head.json + - name: Upload Artifact + uses: actions/upload-artifact@v3 + with: + name: api-artifact + path: api-head.json + - name: Kill Misskey Job + run: screen -S misskey -X quit + + compare-diff: + runs-on: ubuntu-latest + if: success() + needs: [get-base, get-head] + permissions: + pull-requests: write + + steps: + - name: Download Artifact + uses: actions/download-artifact@v3 + with: + name: api-artifact + path: ./artifacts + - name: Output base + run: cat ./artifacts/api-base.json + - name: Output head + run: cat ./artifacts/api-head.json + - name: Arrange json files + run: | + jq '.' ./artifacts/api-base.json > ./api-base.json + jq '.' ./artifacts/api-head.json > ./api-head.json + - name: Get diff of 2 files + run: diff -u --label=base --label=head ./api-base.json ./api-head.json | cat > api.json.diff + - name: Get full diff + run: diff --label=base --label=head --new-line-format='+%L' --old-line-format='-%L' --unchanged-line-format=' %L' ./api-base.json ./api-head.json | cat > api-full.json.diff + - name: Echo full diff + run: cat ./api-full.json.diff + - name: Upload full diff to Artifact + uses: actions/upload-artifact@v3 + with: + name: api-artifact + path: api-full.json.diff + - id: out-diff + name: Build diff Comment + run: | + cat <<- EOF > ./output.md + このPRによるapi.jsonの差分 +
+ 差分はこちら + + \`\`\`diff + $(cat ./api.json.diff) + \`\`\` +
+ + [Get diff files from Workflow Page](https://github.com/${GITHUB_REPOSITORY}/actions/runs/${GITHUB_RUN_ID}) + EOF + - name: Write diff comment + uses: thollander/actions-comment-pull-request@v2 + with: + comment_tag: show_diff + filePath: ./output.md From 6d6ddbc35e6b933d5401291dc8b5bca9dc20477e Mon Sep 17 00:00:00 2001 From: shiosyakeyakini Date: Sat, 21 Oct 2023 07:53:57 +0900 Subject: [PATCH 2/6] =?UTF-8?q?fix(backend)=20api/i=E3=81=AE=E6=9C=AA?= =?UTF-8?q?=E8=AA=AD=E3=81=AE=E3=81=8A=E7=9F=A5=E3=82=89=E3=81=9B=E3=81=AB?= =?UTF-8?q?createdAt=E3=82=92=E8=BF=BD=E5=8A=A0=E3=81=99=E3=82=8B=E3=82=88?= =?UTF-8?q?=E3=81=86=E3=81=AB=E4=BF=AE=E6=AD=A3=20(#12092)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: sorairo --- packages/backend/src/core/entities/UserEntityService.ts | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/core/entities/UserEntityService.ts b/packages/backend/src/core/entities/UserEntityService.ts index 4a3ca0084..b0577fc1a 100644 --- a/packages/backend/src/core/entities/UserEntityService.ts +++ b/packages/backend/src/core/entities/UserEntityService.ts @@ -322,7 +322,11 @@ export class UserEntityService implements OnModuleInit { const isModerator = isMe && opts.detail ? this.roleService.isModerator(user) : null; const isAdmin = isMe && opts.detail ? this.roleService.isAdministrator(user) : null; - const unreadAnnouncements = isMe && opts.detail ? await this.announcementService.getUnreadAnnouncements(user) : null; + const unreadAnnouncements = isMe && opts.detail ? + (await this.announcementService.getUnreadAnnouncements(user)).map((announcement) => ({ + createdAt: this.idService.parse(announcement.id).date.toISOString(), + ...announcement, + })) : null; const falsy = opts.detail ? false : undefined; From f4970c7d2f6b81a1773588d0c53bbdf7e3c53684 Mon Sep 17 00:00:00 2001 From: Natsuki Ikeguchi Date: Sat, 21 Oct 2023 07:54:28 +0900 Subject: [PATCH 3/6] fix(frontend): Use opening quote in notifications (#12082) Signed-off-by: Natsuki Ikeguchi --- packages/frontend/src/components/MkNotification.vue | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/frontend/src/components/MkNotification.vue b/packages/frontend/src/components/MkNotification.vue index 7ba102fd9..c50723621 100644 --- a/packages/frontend/src/components/MkNotification.vue +++ b/packages/frontend/src/components/MkNotification.vue @@ -283,6 +283,12 @@ useTooltip(reactionRef, (showing) => { .quote:first-child { margin-right: 4px; + position: relative; + + &:before { + position: absolute; + transform: rotate(180deg); + } } .quote:last-child { From e6873fb259985493dbdf113935f48f399a2b7317 Mon Sep 17 00:00:00 2001 From: woxtu Date: Sat, 21 Oct 2023 13:31:16 +0900 Subject: [PATCH 4/6] Switch avatar images that depend on the animation setting (#12097) --- packages/frontend/src/components/MkMention.vue | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/frontend/src/components/MkMention.vue b/packages/frontend/src/components/MkMention.vue index ffc9ca3f4..80426157e 100644 --- a/packages/frontend/src/components/MkMention.vue +++ b/packages/frontend/src/components/MkMention.vue @@ -5,7 +5,7 @@ SPDX-License-Identifier: AGPL-3.0-only