diff --git a/.changeset/add_button_to_add_a_sticker_you_see_in_a_message_to_your_own_user_sticker_pack.md b/.changeset/add_button_to_add_a_sticker_you_see_in_a_message_to_your_own_user_sticker_pack.md new file mode 100644 index 000000000..e416559ac --- /dev/null +++ b/.changeset/add_button_to_add_a_sticker_you_see_in_a_message_to_your_own_user_sticker_pack.md @@ -0,0 +1,5 @@ +--- +sable: minor +--- + +add button to save a sticker you see in the message timeline to your personal account sticker pack diff --git a/.changeset/added_message_history.md b/.changeset/added_message_history.md deleted file mode 100644 index 1bfd3f112..000000000 --- a/.changeset/added_message_history.md +++ /dev/null @@ -1,5 +0,0 @@ ---- -sable: minor ---- - -Added a pop-up for showing a message's edit history diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index be6c9424d..000000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @7w1 \ No newline at end of file diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 8a18f400f..a2ad3cd92 100644 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -6,7 +6,7 @@ body: attributes: value: | ## First of all - 1. Please search for [existing issues](https://github.com/7w1/sable/issues?q=is%3Aissue) about this problem first. + 1. Please search for [existing issues](https://github.com/SableClient/Sable/issues?q=is%3Aissue) about this problem first. 2. Make sure Sable is up to date. 3. Make sure it's an issue with Sable and not something else you are using. 4. Remember to be friendly. diff --git a/.github/dependabot.yml b/.github/dependabot.yml index d4055675d..e6ba80eef 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -7,11 +7,12 @@ updates: default-days: 7 directory: / schedule: - interval: weekly - day: 'tuesday' - time: '01:00' - timezone: 'Asia/Kolkata' + interval: daily open-pull-requests-limit: 5 + labels: + - internal + commit-message: + prefix: chore groups: github-actions: patterns: @@ -22,12 +23,32 @@ updates: default-days: 7 directory: / schedule: - interval: weekly - day: 'tuesday' - time: '01:00' - timezone: 'Asia/Kolkata' + interval: daily open-pull-requests-limit: 5 + labels: + - internal + commit-message: + prefix: chore groups: docker: patterns: - '*' + + - package-ecosystem: npm + cooldown: + default-days: 1 + directory: / + schedule: + interval: daily + open-pull-requests-limit: 10 + labels: + - internal + commit-message: + prefix: chore + groups: + # Group all non-major updates together to reduce noise + npm-minor-patch: + update-types: + - minor + - patch + # Major updates are ungrouped so they get individual review diff --git a/.github/renovate.json b/.github/renovate.json deleted file mode 100644 index 62b0cf2a9..000000000 --- a/.github/renovate.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "$schema": "https://docs.renovatebot.com/renovate-schema.json", - "extends": ["config:recommended", ":dependencyDashboardApproval"], - "labels": ["Dependencies"], - "packageRules": [ - { - "matchUpdateTypes": ["lockFileMaintenance"] - } - ], - "lockFileMaintenance": { - "enabled": true - }, - "dependencyDashboard": true -} diff --git a/.github/workflows/cloudflare-web-preview.yml b/.github/workflows/cloudflare-web-preview.yml new file mode 100644 index 000000000..855521c85 --- /dev/null +++ b/.github/workflows/cloudflare-web-preview.yml @@ -0,0 +1,141 @@ +name: Cloudflare Worker Preview Deploy + +on: + pull_request: + paths: + - 'src/**' + - 'index.html' + - 'package.json' + - 'package-lock.json' + - 'vite.config.ts' + - 'tsconfig.json' + - '.github/workflows/cloudflare-web-preview.yml' + - '.github/actions/setup/**' + +concurrency: + group: cloudflare-worker-preview-${{ github.event.pull_request.number }} + cancel-in-progress: true + +jobs: + deploy: + if: github.event.pull_request.head.repo.full_name == github.repository + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Checkout repository + uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + persist-credentials: false + + - name: Prepare preview metadata + id: metadata + shell: bash + run: | + preview_message="$(git log -1 --pretty=%s)" + preview_message="$(printf '%s' "$preview_message" | head -c 100)" + + { + echo 'preview_message<> "$GITHUB_OUTPUT" + + - name: Setup app and build + uses: ./.github/actions/setup + with: + build: 'true' + + - name: Upload Worker preview + id: deploy + uses: cloudflare/wrangler-action@da0e0dfe58b7a431659754fdf3f186c529afbe65 # v3.14.1 + env: + PREVIEW_MESSAGE: ${{ steps.metadata.outputs.preview_message }} + with: + apiToken: ${{ secrets.TF_CLOUDFLARE_API_TOKEN }} + accountId: ${{ secrets.TF_VAR_ACCOUNT_ID }} + command: > + versions upload + -c dist/wrangler.json + --preview-alias pr-${{ github.event.pull_request.number }} + --message "$PREVIEW_MESSAGE" + + - name: Resolve preview URL + id: preview + env: + DEPLOYMENT_URL: ${{ steps.deploy.outputs.deployment-url }} + COMMAND_OUTPUT: ${{ steps.deploy.outputs.command-output }} + PR_NUMBER: ${{ github.event.pull_request.number }} + shell: bash + run: | + alias="pr-${PR_NUMBER}" + preview_url="" + alias_url_pattern="^https?://${alias}-[^[:space:]]+$" + + if printf '%s\n' "$DEPLOYMENT_URL" | grep -Eq "$alias_url_pattern"; then + preview_url="$DEPLOYMENT_URL" + else + preview_url="$(printf '%s\n' "$COMMAND_OUTPUT" | grep -Eo "https?://${alias}-[^[:space:]\"'<>)]+" | head -n 1 || true)" + fi + + if ! printf '%s\n' "$preview_url" | grep -Eq "$alias_url_pattern"; then + echo "Failed to resolve aliased Worker preview URL." >&2 + exit 1 + fi + + { + echo "preview_alias=${alias}" + echo "preview_url=${preview_url}" + } >> "$GITHUB_OUTPUT" + + - name: Publish preview URL and write summary + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + MARKER: '' + PREVIEW_URL: ${{ steps.preview.outputs.preview_url }} + PREVIEW_ALIAS: ${{ steps.preview.outputs.preview_alias }} + SHORT_SHA: ${{ github.event.pull_request.head.sha }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const marker = process.env.MARKER; + const previewUrl = process.env.PREVIEW_URL; + const previewAlias = process.env.PREVIEW_ALIAS; + const shortSha = process.env.SHORT_SHA?.slice(0, 7); + const now = new Date().toUTCString().replace(':00 GMT', ' UTC'); + + if (!previewUrl) { + core.setFailed("Missing preview URL from Cloudflare deploy step."); + return; + } + + const tableRow = "| ✅ Deployment successful! | " + previewUrl + " | " + shortSha + " | `" + previewAlias + "` | " + now + " |"; + const comment = [ + marker, + `## Deploying with  Cloudflare Workers  Cloudflare Workers`, + ``, + `| Status | Preview URL | Commit | Alias | Updated (UTC) |`, + `| - | - | - | - | - |`, + tableRow, + ].join("\n"); + + // Write to step summary (marker stripped — not needed there) + await core.summary.addRaw(comment.replace(marker + "\n", "")).write(); + + // Always delete and recreate so the comment appears fresh after each push + const { owner, repo } = context.repo; + const issue_number = context.issue.number; + const comments = await github.paginate(github.rest.issues.listComments, { + owner, repo, issue_number, + }); + const existing = comments.find( + (c) => c.user.type === "Bot" && c.body.includes(marker), + ); + if (existing) { + await github.rest.issues.deleteComment({ + owner, repo, comment_id: existing.id, + }); + } + + await github.rest.issues.createComment({ owner, repo, issue_number, body: comment }); diff --git a/.github/workflows/docker-publish.yml b/.github/workflows/docker-publish.yml index ea43d4be4..44aad2672 100644 --- a/.github/workflows/docker-publish.yml +++ b/.github/workflows/docker-publish.yml @@ -66,18 +66,16 @@ jobs: id: vars run: echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT - - name: Set up Node.js - uses: actions/setup-node@53b83947a5a98c8d113130e565377fae1a50d02f # v6.3.0 + - name: Setup app + uses: ./.github/actions/setup with: - node-version: '24' - cache: 'npm' + install-command: npm ci --ignore-scripts - name: Build site env: VITE_BUILD_HASH: ${{ steps.vars.outputs.short_sha }} VITE_IS_RELEASE_TAG: ${{ steps.release_tag.outputs.is_release }} run: | - npm ci --ignore-scripts NODE_OPTIONS=--max_old_space_size=4096 npm run build - name: Set up QEMU @@ -105,4 +103,4 @@ jobs: with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true + push-to-registry: false diff --git a/.github/workflows/prepare-release.yml b/.github/workflows/prepare-release.yml new file mode 100644 index 000000000..ec6f56eb7 --- /dev/null +++ b/.github/workflows/prepare-release.yml @@ -0,0 +1,90 @@ +name: Create Release PR + +on: + push: + branches: [dev] + +permissions: {} + +jobs: + prepare-release: + if: "!contains(github.event.head_commit.message, 'chore: prepare release')" + runs-on: ubuntu-latest + permissions: + contents: write + pull-requests: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: true + + - uses: fregante/setup-git-user@024bc0b8e177d7e77203b48dab6fb45666854b35 # v2.0.2 + + - uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 # v2.1.0 + with: + version: 0.22.1 + + - name: Prepare Release + run: knope prepare-release --verbose + continue-on-error: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + - name: Enrich changelog with PR attribution + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const fs = require("fs"); + const changelog = "CHANGELOG.md"; + + if (!fs.existsSync(changelog)) return; + + let content = fs.readFileSync(changelog, "utf8"); + const marker = //g; + const hashes = [...new Set([...content.matchAll(marker)].map(m => m[1]))]; + + if (hashes.length === 0) return; + + const { owner, repo } = context.repo; + + for (const hash of hashes) { + let replacement = ""; + try { + // Find PRs associated with this commit. Knope uses the commit that + // first introduced the changeset file, so this reliably points to + // the original PR regardless of later edits on the branch. + const prs = await github.rest.repos.listPullRequestsAssociatedWithCommit({ + owner, repo, commit_sha: hash, + }); + const pr = prs.data[0]; + if (pr) { + replacement = `([#${pr.number}](${pr.html_url}) by @${pr.user.login})`; + } else { + // Commit exists but has no associated PR (e.g. direct push to dev) + replacement = `(\`${hash}\`)`; + } + } catch { + replacement = `(\`${hash}\`)`; + } + content = content.replaceAll(``, replacement); + } + + fs.writeFileSync(changelog, content); + + - name: Amend release commit with enriched changelog + shell: bash + run: | + # Only amend if the changelog was actually staged by knope + if git diff --cached --name-only | grep -q "CHANGELOG.md"; then + git add CHANGELOG.md + git commit --amend --no-edit + elif git diff --name-only HEAD | grep -q "CHANGELOG.md"; then + git add CHANGELOG.md + git commit --amend --no-edit + fi + + - name: Push release branch + shell: bash + run: git push --force --set-upstream origin release diff --git a/.github/workflows/quality-checks.yml b/.github/workflows/quality-checks.yml index 9a37398e6..dc534338b 100644 --- a/.github/workflows/quality-checks.yml +++ b/.github/workflows/quality-checks.yml @@ -3,6 +3,7 @@ name: Quality checks on: pull_request: push: + branches: [dev] jobs: format: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..a5bc57fbf --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,29 @@ +name: Release + +on: + pull_request: + types: [closed] + branches: [dev] + +permissions: {} + +jobs: + release: + if: github.head_ref == 'release' && github.event.pull_request.merged == true + runs-on: ubuntu-latest + permissions: + contents: write + steps: + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: knope-dev/action@407e9ef7c272d2dd53a4e71e39a7839e29933c48 # v2.1.0 + with: + version: 0.22.1 + + - name: Create Release + run: knope release --verbose + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/require-changeset.yml b/.github/workflows/require-changeset.yml new file mode 100644 index 000000000..fad5d9fef --- /dev/null +++ b/.github/workflows/require-changeset.yml @@ -0,0 +1,112 @@ +name: Require Changeset + +on: + pull_request: + types: [opened, synchronize, reopened, labeled, unlabeled] + branches: [dev] + +permissions: {} + +jobs: + require-changeset: + runs-on: ubuntu-latest + permissions: + contents: read + pull-requests: write + steps: + - name: Check for internal label + id: labels + shell: bash + env: + LABELS: ${{ toJSON(github.event.pull_request.labels.*.name) }} + run: | + if echo "$LABELS" | grep -q '"internal"'; then + echo "skip=true" >> "$GITHUB_OUTPUT" + else + echo "skip=false" >> "$GITHUB_OUTPUT" + fi + + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + if: steps.labels.outputs.skip == 'false' + with: + fetch-depth: 0 + persist-credentials: false + + - name: Check for changeset added by this PR + if: steps.labels.outputs.skip == 'false' + id: check + shell: bash + env: + BASE_REF: ${{ github.event.pull_request.base.ref }} + run: | + # Only count changeset files this PR added, ignoring pre-existing ones on the base branch. + count=$(git diff --name-only --diff-filter=A "origin/${BASE_REF}...HEAD" | grep -E '^\.changeset/.+\.md$' | grep -cv README.md || true) + if [[ "$count" -eq 0 ]]; then + echo "found=false" >> "$GITHUB_OUTPUT" + else + echo "found=true" >> "$GITHUB_OUTPUT" + echo "Found $count new changeset file(s)." + fi + + - name: Manage changeset comment + uses: actions/github-script@ed597411d8f924073f98dfc5c65a23a2325f34cd # v8 + env: + SKIP: ${{ steps.labels.outputs.skip }} + CHANGESET_FOUND: ${{ steps.check.outputs.found }} + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + const marker = ''; + const skip = process.env.SKIP === 'true'; + const found = process.env.CHANGESET_FOUND === 'true'; + const { owner, repo } = context.repo; + const issue_number = context.issue.number; + + const comments = await github.paginate(github.rest.issues.listComments, { + owner, repo, issue_number, + }); + const existing = comments.find( + (c) => c.user.type === 'Bot' && c.body.includes(marker), + ); + + if (skip || found) { + // Clean up the warning comment — changeset added or PR marked internal + if (existing) { + await github.rest.issues.deleteComment({ + owner, repo, comment_id: existing.id, + }); + } + return; + } + + const body = `${marker} + ## ⚠️ Missing changeset + + This pull request does not include a changeset. Please add one before requesting review so the change is properly documented and included in the release notes. + + **How to add a changeset:** + + 1. Run \`npm run document-change\` (interactive) and commit the generated file, or + 2. Manually create \`.changeset/.md\`: + + \`\`\`md + --- + sable: patch + --- + + Short user-facing summary of the change. + \`\`\` + + Replace \`patch\` with \`major\`, \`minor\`, \`patch\`, \`docs\`, or \`note\` as appropriate. + + 📖 Read more in [CONTRIBUTING.md](https://github.com/SableClient/Sable/blob/dev/CONTRIBUTING.md#release-notes-and-versioning-knope). + + > If this PR is internal/maintenance with no user-facing impact, a maintainer can add the \`internal\` label to skip this check.`; + + if (existing) { + await github.rest.issues.deleteComment({ + owner, repo, comment_id: existing.id, + }); + } + await github.rest.issues.createComment({ owner, repo, issue_number, body }); + core.setFailed('No changeset found. Add a changeset file or apply the "internal" label to skip.'); diff --git a/.npmrc b/.npmrc index 567dd1f3d..e4e8189be 100644 --- a/.npmrc +++ b/.npmrc @@ -1,3 +1,3 @@ legacy-peer-deps=true -save-exact=true engine-strict=true +min-release-age=1440 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index f5481d8ac..108b70b36 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,26 @@ # Sable Client Changelog +## 1.6.0 (2026-03-10) + +### Features + +* GitHub repo moved to [SableClient/Sable](https://github.com/SableClient/Sable) go star it! +* Added a pop-up for showing a message's edit history +* In-app bug report and feature request modal. +* Mentions now receive a full-width background highlight in the room timeline. + +* Adds a **Presence Status** toggle under Settings → General. + +* Rewrites the sliding sync implementation to match the Element Web approach (MSC4186). + +### Fixes + +* Enhance UnsupportedContent and BrokenContent to display message body. +* Notification settings page improvements. +* In-app notification banner placement fixes. +* Notification delivery bug fixes. +* Prevent multiple forwards of a message if sending is slow. + ## 1.5.3 (2026-03-08) ### Fixes diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index d18fd73cb..3b0b3cee3 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -13,7 +13,7 @@ All types of contributions are encouraged and valued. Please make sure to read t ## Bug reports -Bug reports and feature suggestions must use descriptive and concise titles and be submitted to [GitHub Issues](https://github.com/7w1/sable/issues). Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected. +Bug reports and feature suggestions must use descriptive and concise titles and be submitted to [GitHub Issues](https://github.com/SableClient/Sable/issues). Please use the search function to make sure that you are not submitting duplicates, and that a similar report or request has not already been resolved or rejected. ## Pull requests @@ -44,6 +44,18 @@ Also, we use [ESLint](https://eslint.org/) for clean and stylistically consisten - `npm run typecheck` - `npm run knip` +## Restrictions on Generative AI Usage + +We expect and appreciate authentic engagement in our community. + +Do not post output from Large Language Models or similar generative AI as comments on GitHub, as such comments tend to be formulaic and low content. + +If you use generative AI tools as an aid in developing code, ensure that you fully understand the proposed changes and can explain why they are the correct approach. + +Make sure you have added value based on your personal competency to your contributions. Just taking some input, feeding it to an AI and posting the result is not of value to the project. We reserve the right to rigorously reject seemingly AI generated low-value contributions. + +Maintainers may close issues and PRs that are not useful or productive, including those that are fully generated by AI. If a contributor repeatedly opens unproductive issues or PRs, they may be blocked. + ## Release notes and versioning (Knope) We use [Knope](https://knope.tech/) with the Knope GitHub Bot to manage change documentation and releases. The workflow configuration lives in [`knope.toml`](./knope.toml). diff --git a/README.md b/README.md index 606258a12..50cd094be 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Sable -A Matrix client built to enhance the user experience with quality-of-life features, cosmetics, utilities, and sheer usability. See the [changelog](https://github.com/7w1/sable/blob/dev/CHANGELOG.md). +A Matrix client built to enhance the user experience with quality-of-life features, cosmetics, utilities, and sheer usability. See the [changelog](https://github.com/SableClient/Sable/blob/dev/CHANGELOG.md). Join our matrix space [here](https://matrix.to/#/#sable:sable.moe) to discuss features, issues, or meowing. @@ -9,7 +9,7 @@ Forked from [Cinny](https://github.com/cinnyapp/cinny/). ## Getting started The web app is available at [app.sable.moe](https://app.sable.moe/) and gets updated on frequently, as soon as a feature is deemed stable. -You can also download our desktop app for windows and linux from [releases](https://github.com/7w1/sable/releases/latest). +You can also download our desktop app for windows and linux from [releases](https://github.com/SableClient/Sable/releases/latest). ## Self-hosting You have a few options for self hosting, you can: @@ -19,7 +19,7 @@ You have a few options for self hosting, you can: ### Docker -Prebuilt images are published to `ghcr.io/7w1/sable`. +Prebuilt images are published to `ghcr.io/sableclient/sable`. - `latest` tracks the current `dev` branch image. - `X.Y.Z` tags are versioned releases. @@ -29,7 +29,7 @@ Prebuilt images are published to `ghcr.io/7w1/sable`. Run the latest image with: ```sh -docker run --rm -p 8080:8080 ghcr.io/7w1/sable:latest +docker run --rm -p 8080:8080 ghcr.io/sableclient/sable:latest ``` Then open `http://localhost:8080`. @@ -40,7 +40,7 @@ file at `/app/config.json`: ```yaml services: sable: - image: ghcr.io/7w1/sable:latest + image: ghcr.io/sableclient/sable:latest ports: - '8080:8080' volumes: diff --git a/knope.toml b/knope.toml index cc19b1dc5..14e6c20a7 100644 --- a/knope.toml +++ b/knope.toml @@ -1,30 +1,51 @@ - -[packages.sable] +[package] versioned_files = ["package.json", "package-lock.json"] changelog = "CHANGELOG.md" extra_changelog_sections = [ { name = "Documentation", types = ["docs"] }, { name = "Notes", types = ["note"] }, ] -# assets = "marker for GitHub bot" // TODO: add this later once we have assets +# assets = "marker" // TODO: add this later once we have assets [changes] ignore_conventional_commits = true [[workflows]] -name = "release" -help_text = "Prepare and create a new release (update changelog, bump version, create release)" +name = "prepare-release" +help_text = "Prepare a release PR" + +[[workflows.steps]] +type = "Command" +command = "git switch -c release" [[workflows.steps]] type = "PrepareRelease" [[workflows.steps]] type = "Command" -command = 'git commit -m "chore: prepare release $version"' +command = "git commit -m \"chore: prepare release\"" [[workflows.steps]] type = "Command" -command = "git push" +command = "git push --force --set-upstream origin release" + +[[workflows.steps]] +type = "CreatePullRequest" +base = "dev" + +[workflows.steps.title] +template = "chore: prepare release $version" + +[workflows.steps.body] +template = """ +> [!IMPORTANT] +> Merging this PR will create a new release. + +$changelog""" + +[[workflows]] +name = "release" +help_text = "Create a GitHub release" [[workflows.steps]] type = "Release" @@ -37,17 +58,12 @@ help_text = "Create a new change file to be included in the next release" type = "CreateChangeFile" [github] -owner = "7w1" -repo = "sable" - -[bot.releases] -enabled = true -pull_request.title = "$version changelog" - -[bot.checks] -skip_labels = ["internal"] +owner = "SableClient" +repo = "Sable" [release_notes] +# The marker is used by prepare-release.yml change_templates = [ - "* $summary", + "### $summary \n\n$details", + "* $summary ", ] \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 5683a6d19..3c3f248ca 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "sable", - "version": "1.5.3", + "version": "1.6.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "sable", - "version": "1.5.3", + "version": "1.6.0", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/package.json b/package.json index 2667d1481..3ca4beea9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "sable", - "version": "1.5.3", + "version": "1.6.0", "description": "Yet another matrix client fork", "type": "module", "packageManager": "npm@11.11.0", diff --git a/src/app/components/RenderMessageContent.tsx b/src/app/components/RenderMessageContent.tsx index 3c2ded077..93a697c6f 100644 --- a/src/app/components/RenderMessageContent.tsx +++ b/src/app/components/RenderMessageContent.tsx @@ -366,7 +366,7 @@ function RenderMessageContentInternal({ mentionedUserIds={content?.['m.mentions']?.user_ids} /> ); - return ; + return ; } export const RenderMessageContent = memo(RenderMessageContentInternal); diff --git a/src/app/components/RoomNotificationSwitcher.tsx b/src/app/components/RoomNotificationSwitcher.tsx index f62c41a4a..268758500 100644 --- a/src/app/components/RoomNotificationSwitcher.tsx +++ b/src/app/components/RoomNotificationSwitcher.tsx @@ -104,9 +104,16 @@ export function RoomNotificationModeSwitcher({ /> } > - - {mode === value ? {modeToStr[mode]} : modeToStr[mode]} - + + + {mode === value ? {modeToStr[mode]} : modeToStr[mode]} + + {mode === RoomNotificationMode.Unset && ( + + Follows your global notification rules + + )} + ))} diff --git a/src/app/components/message/MsgTypeRenderers.tsx b/src/app/components/message/MsgTypeRenderers.tsx index 44b4b83c2..edd1af26c 100644 --- a/src/app/components/message/MsgTypeRenderers.tsx +++ b/src/app/components/message/MsgTypeRenderers.tsx @@ -52,18 +52,22 @@ export function RedactedContent({ reason }: RedactedContentProps) { ); } -export function UnsupportedContent() { +type BrokenContentProps = { + body?: string; +}; + +export function UnsupportedContent({ body }: BrokenContentProps) { return ( - + ); } -export function BrokenContent() { +export function BrokenContent({ body }: BrokenContentProps) { return ( - + ); } @@ -117,7 +121,7 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }: return true; }, [trimmedBody, safeCustomBody]); - if (!body) return ; + if (!body) return ; const urlsMatch = renderUrlsPreview && trimmedBody.match(URL_REG); const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined; @@ -170,7 +174,9 @@ export function MEmote({ const { body, formatted_body: customBody } = content; const [jumboEmojiSize] = useSetting(settingsAtom, 'jumboEmojiSize'); - if (typeof body !== 'string') return ; + if (typeof body !== 'string') { + return ; + } const trimmedBody = trimReplyFromBody(body); const urlsMatch = renderUrlsPreview && trimmedBody.match(URL_REG); const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined; @@ -205,7 +211,9 @@ export function MNotice({ edited, content, renderBody, renderUrlsPreview }: MNot const { body, formatted_body: customBody } = content; const [jumboEmojiSize] = useSetting(settingsAtom, 'jumboEmojiSize'); - if (typeof body !== 'string') return ; + if (typeof body !== 'string') { + return ; + } const trimmedBody = trimReplyFromBody(body); const urlsMatch = renderUrlsPreview && trimmedBody.match(URL_REG); const urls = urlsMatch ? [...new Set(urlsMatch)] : undefined; @@ -248,7 +256,7 @@ export function MImage({ content, renderImageContent, outlined }: MImageProps) { const imgInfo = content?.info; const mxcUrl = content.file?.url ?? content.url; if (typeof mxcUrl !== 'string') { - return ; + return ; } const MAX_SIZE = 400; const imgW = imgInfo?.w ?? MAX_SIZE; @@ -310,7 +318,7 @@ export function MVideo({ content, renderAsFile, renderVideoContent, outlined }: if (mxcUrl) { return renderAsFile(); } - return ; + return ; } const height = Math.min(scaleYDimension(videoInfo.w || 400, 400, videoInfo.h || 400), 400); @@ -379,7 +387,7 @@ export function MAudio({ content, renderAsFile, renderAudioContent, outlined }: if (mxcUrl) { return renderAsFile(); } - return ; + return ; } const filename = content.filename ?? content.body ?? 'Audio'; @@ -430,7 +438,7 @@ export function MFile({ content, renderFileContent, outlined }: MFileProps) { const mxcUrl = content.file?.url ?? content.url; if (typeof mxcUrl !== 'string') { - return ; + return ; } return ( @@ -461,8 +469,9 @@ type MLocationProps = { }; export function MLocation({ content }: MLocationProps) { const geoUri = content.geo_uri; - if (typeof geoUri !== 'string') return ; - + if (typeof geoUri !== 'string') { + return ; + } const location = parseGeoUri(geoUri); if (!location) return ; @@ -493,7 +502,7 @@ export function MSticker({ content, renderImageContent }: MStickerProps) { const imgInfo = content?.info; const mxcUrl = content.file?.url ?? content.url; if (typeof mxcUrl !== 'string') { - return ; + return ; } const height = scaleYDimension(imgInfo?.w || 152, 152, imgInfo?.h || 152); diff --git a/src/app/components/message/content/FallbackContent.tsx b/src/app/components/message/content/FallbackContent.tsx index 8156a5d0c..9bd012a13 100644 --- a/src/app/components/message/content/FallbackContent.tsx +++ b/src/app/components/message/content/FallbackContent.tsx @@ -16,12 +16,16 @@ export const MessageDeletedContent = as<'div', { children?: never; reason?: stri ) ); -export const MessageUnsupportedContent = as<'div', { children?: never }>(({ ...props }, ref) => ( - - - Unsupported message - -)); +export const MessageUnsupportedContent = as<'div', { children?: never; body?: string }>( + ({ body, ...props }, ref) => ( + + + Unsupported message + {body && `: ${body}`} + {!body && ' (no body)'} + + ) +); export const MessageFailedContent = as<'div', { children?: never }>(({ ...props }, ref) => ( @@ -44,12 +48,17 @@ export const MessageNotDecryptedContent = as<'div', { children?: never }>(({ ... )); -export const MessageBrokenContent = as<'div', { children?: never }>(({ ...props }, ref) => ( - - - Broken message - -)); +// display body of the message if it is available, as it may give some clue about why the message is broken +export const MessageBrokenContent = as<'div', { children?: never; body?: string }>( + ({ body, ...props }, ref) => ( + + + Broken message + {body && `: ${body}`} + {!body && ' (no body)'} + + ) +); export const MessageEmptyContent = as<'div', { children?: never }>(({ ...props }, ref) => ( diff --git a/src/app/components/message/layout/Base.tsx b/src/app/components/message/layout/Base.tsx index 008c9e416..47e7b9372 100644 --- a/src/app/components/message/layout/Base.tsx +++ b/src/app/components/message/layout/Base.tsx @@ -3,10 +3,13 @@ import classNames from 'classnames'; import * as css from './layout.css'; export const MessageBase = as<'div', css.MessageBaseVariants>( - ({ className, highlight, selected, collapse, autoCollapse, space, ...props }, ref) => ( + ( + { className, highlight, notifyHighlight, selected, collapse, autoCollapse, space, ...props }, + ref + ) => (
(null); @@ -143,11 +144,18 @@ export function MessageForwardInternal({ room, mEvent, onClose }: MessageForward // actually forward the message to the selected room const handleForwardClick = () => { - if (!targetRoomId) return; + setIsForwarding(true); + if (!targetRoomId) { + setIsForwarding(false); + return; + } const targetRoom = getRoom(targetRoomId); const eventId = mEvent.getId(); - if (!targetRoom || !eventId) return; + if (!targetRoom || !eventId) { + setIsForwarding(false); + return; + } type SendEventType = Parameters[2]; type SendEventContent = Parameters[3]; @@ -234,10 +242,15 @@ export function MessageForwardInternal({ room, mEvent, onClose }: MessageForward } try { - mx.sendEvent(targetRoom.roomId, null, eventType, content as unknown as SendEventContent).then( - () => setIsForwardSuccess(true) - ); + mx.sendEvent(targetRoom.roomId, null, eventType, content as unknown as SendEventContent) + .then(() => setIsForwardSuccess(true)) + .catch(() => { + setIsForwarding(false); + setIsForwardSuccess(false); + setIsForwardError(true); + }); } catch { + setIsForwarding(false); setIsForwardSuccess(false); setIsForwardError(true); } @@ -286,7 +299,11 @@ export function MessageForwardInternal({ room, mEvent, onClose }: MessageForward {isTargetSelected && targetRoomId && ( - )} diff --git a/src/app/components/notification-banner/NotificationBanner.css.ts b/src/app/components/notification-banner/NotificationBanner.css.ts index 1ddfacda3..4a29d24d7 100644 --- a/src/app/components/notification-banner/NotificationBanner.css.ts +++ b/src/app/components/notification-banner/NotificationBanner.css.ts @@ -23,12 +23,11 @@ const slideOut = keyframes({ }, }); -// Floats at the top of the chat area, starting after the icon sidebar. +// Floats at the top of the viewport, spanning full width on all platforms. export const BannerContainer = style({ position: 'fixed', top: 0, - // 66px = sidebar icon strip width — overridden to 0 on mobile below - left: toRem(66), + left: 0, right: 0, zIndex: 9999, display: 'flex', @@ -37,13 +36,6 @@ export const BannerContainer = style({ padding: config.space.S400, pointerEvents: 'none', alignItems: 'stretch', - - '@media': { - // On narrow screens the sidebar collapses, so span the full width. - '(max-width: 768px)': { - left: 0, - }, - }, }); export const Banner = style({ diff --git a/src/app/features/bug-report/BugReportModal.tsx b/src/app/features/bug-report/BugReportModal.tsx new file mode 100644 index 000000000..1ee788f05 --- /dev/null +++ b/src/app/features/bug-report/BugReportModal.tsx @@ -0,0 +1,382 @@ +import { useState, useEffect } from 'react'; +import FocusTrap from 'focus-trap-react'; +import { + Box, + Button, + Chip, + config, + Header, + Icon, + IconButton, + Icons, + Input, + Modal, + Overlay, + OverlayBackdrop, + OverlayCenter, + Scroll, + Spinner, + Text, + TextArea, +} from 'folds'; +import { useCloseBugReportModal, useBugReportModalOpen } from '$state/hooks/bugReportModal'; +import { stopPropagation } from '$utils/keyboard'; + +type ReportType = 'bug' | 'feature'; + +type SimilarIssue = { + number: number; + title: string; + html_url: string; +}; + +const GITHUB_REPO = 'SableClient/Sable'; + +async function searchSimilarIssues(query: string, signal: AbortSignal): Promise { + // Split into individual words, drop very short ones, and join with OR so that + // partial / stemmed titles (e.g. "reporting" still matches "report") surface results. + const words = query + .split(/[\s\-_/]+/) + .map((w) => w.replace(/[^\w]/g, '')) + .filter((w) => w.length >= 3); + + if (words.length === 0) return []; + + const q = `${words.join(' OR ')} repo:${GITHUB_REPO} is:issue is:open`; + const params = new URLSearchParams({ q, per_page: '5' }); + const res = await fetch(`https://api.github.com/search/issues?${params}`, { signal }); + if (!res.ok) return []; + const data = (await res.json()) as { items?: SimilarIssue[] }; + return data.items ?? []; +} + +// Field IDs match the ids defined in .github/ISSUE_TEMPLATE/bug_report.yml +// and feature_request.yml so GitHub pre-fills each form field directly. +function buildGitHubUrl(type: ReportType, title: string, fields: Record): string { + const devLabel = IS_RELEASE_TAG ? '' : '-dev'; + const buildLabel = BUILD_HASH ? ` (${BUILD_HASH})` : ''; + const version = `v${APP_VERSION}${devLabel}${buildLabel}`; + + const params: Record = { title }; + + if (type === 'bug') { + params.template = 'bug_report.yml'; + if (fields.description) params.description = fields.description; + if (fields.reproduction) params.reproduction = fields.reproduction; + if (fields['expected-behavior']) params['expected-behavior'] = fields['expected-behavior']; + // Auto-populate the platform/versions field + params.info = `- OS: ${navigator.platform || 'unknown'}\n- Browser: ${navigator.userAgent}\n- Sable: ${version}`; + if (fields.context) params.context = fields.context; + } else { + params.template = 'feature_request.yml'; + if (fields.problem) params.problem = fields.problem; + if (fields.solution) params.solution = fields.solution; + if (fields.alternatives) params.alternatives = fields.alternatives; + if (fields.context) params.context = fields.context; + } + + return `https://github.com/${GITHUB_REPO}/issues/new?${new URLSearchParams(params)}`; +} + +function BugReportModal() { + const close = useCloseBugReportModal(); + const [type, setType] = useState('bug'); + const [title, setTitle] = useState(''); + + // Bug fields (match bug_report.yml ids) + const [description, setDescription] = useState(''); + const [reproduction, setReproduction] = useState(''); + const [expectedBehavior, setExpectedBehavior] = useState(''); + + // Feature fields (match feature_request.yml ids) + const [problem, setProblem] = useState(''); + const [solution, setSolution] = useState(''); + const [alternatives, setAlternatives] = useState(''); + + // Shared optional field + const [context, setContext] = useState(''); + + const [similarIssues, setSimilarIssues] = useState([]); + const [searching, setSearching] = useState(false); + + useEffect(() => { + const trimmed = title.trim(); + const controller = new AbortController(); + let cancelled = false; + let timer: ReturnType | undefined; + + if (trimmed.length >= 3) { + timer = setTimeout(async () => { + setSearching(true); + try { + const issues = await searchSimilarIssues(trimmed, controller.signal); + if (!cancelled) setSimilarIssues(issues); + } catch { + // silently ignore network errors / rate limits + } finally { + if (!cancelled) setSearching(false); + } + }, 600); + } else { + setSimilarIssues([]); + setSearching(false); + } + + return () => { + cancelled = true; + if (timer !== undefined) clearTimeout(timer); + controller.abort(); + }; + }, [title]); + + const canSubmit = + title.trim().length > 0 && + (type === 'bug' + ? description.trim().length > 0 + : problem.trim().length > 0 && solution.trim().length > 0); + + const handleSubmit = () => { + if (!canSubmit) return; + const fields: Record = + type === 'bug' + ? { description, reproduction, 'expected-behavior': expectedBehavior, context } + : { problem, solution, alternatives, context }; + const url = buildGitHubUrl(type, title.trim(), fields); + window.open(url, '_blank', 'noopener,noreferrer'); + close(); + }; + + return ( + }> + + + + +
+ + Report an Issue + + + + +
+ + + {/* Type */} + + Type + + setType('bug')} + > + Bug Report + + setType('feature')} + > + Feature Request + + + + + {/* Title + duplicate check */} + + Title * + setTitle((e.target as HTMLInputElement).value)} + /> + {searching && ( + + + Searching for similar issues… + + )} + {!searching && similarIssues.length > 0 && ( + + + Similar open issues — please check before submitting: + + {similarIssues.map((issue) => ( + + {'→ '} + + #{issue.number}: {issue.title} + + + ))} + + )} + + + {/* Description */} + + + {type === 'bug' ? 'Describe the bug *' : 'Describe the problem *'} + +