mirror of
https://github.com/SableClient/Sable.git
synced 2026-11-21 09:31:17 -08:00
Merge remote-tracking branch 'newupstream/dev' into sable-edit-history
updated to latest upstream version
This commit is contained in:
commit
4163cd78a7
58 files changed
+1987
-429
No files matched your search
+5
@@ -0,0 +1,5 @@
|
||||
---
|
||||
sable: minor
|
||||
---
|
||||
|
||||
add button to save a sticker you see in the message timeline to your personal account sticker pack
|
||||
@@ -1,5 +0,0 @@
|
||||
---
|
||||
sable: minor
|
||||
---
|
||||
|
||||
Added a pop-up for showing a message's edit history
|
||||
@@ -1 +0,0 @@
|
||||
* @7w1
|
||||
@@ -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.
|
||||
|
||||
+29
-8
@@ -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
|
||||
@@ -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
|
||||
}
|
||||
@@ -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<<EOF'
|
||||
echo "$preview_message"
|
||||
echo EOF
|
||||
} >> "$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: '<!-- cloudflare-worker-preview -->'
|
||||
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! | <a href='" + previewUrl + "'>" + previewUrl + "</a> | " + shortSha + " | `" + previewAlias + "` | " + now + " |";
|
||||
const comment = [
|
||||
marker,
|
||||
`## Deploying with <a href="https://workers.dev"><img alt="Cloudflare Workers" src="https://workers.cloudflare.com/logo.svg" width="16"></a> 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 });
|
||||
@@ -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
|
||||
@@ -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 = /<!-- commit:([0-9a-f]+) -->/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(`<!-- commit:${hash} -->`, 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
|
||||
@@ -3,6 +3,7 @@ name: Quality checks
|
||||
on:
|
||||
pull_request:
|
||||
push:
|
||||
branches: [dev]
|
||||
|
||||
jobs:
|
||||
format:
|
||||
|
||||
@@ -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 }}
|
||||
@@ -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 = '<!-- require-changeset -->';
|
||||
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/<descriptive-name>.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.');
|
||||
@@ -1,3 +1,3 @@
|
||||
legacy-peer-deps=true
|
||||
save-exact=true
|
||||
engine-strict=true
|
||||
min-release-age=1440
|
||||
@@ -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
|
||||
|
||||
+13
-1
@@ -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).
|
||||
|
||||
@@ -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:
|
||||
|
||||
+33
-17
@@ -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 <!-- commit:$commit_hash --> marker is used by prepare-release.yml
|
||||
change_templates = [
|
||||
"* $summary",
|
||||
"### $summary <!-- commit:$commit_hash -->\n\n$details",
|
||||
"* $summary <!-- commit:$commit_hash -->",
|
||||
]
|
||||
Generated
+2
-2
@@ -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": {
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "sable",
|
||||
"version": "1.5.3",
|
||||
"version": "1.6.0",
|
||||
"description": "Yet another matrix client fork",
|
||||
"type": "module",
|
||||
"packageManager": "[email protected]",
|
||||
|
||||
@@ -366,7 +366,7 @@ function RenderMessageContentInternal({
|
||||
mentionedUserIds={content?.['m.mentions']?.user_ids}
|
||||
/>
|
||||
);
|
||||
return <UnsupportedContent />;
|
||||
return <UnsupportedContent body={content?.body} />;
|
||||
}
|
||||
|
||||
export const RenderMessageContent = memo(RenderMessageContentInternal);
|
||||
@@ -104,9 +104,16 @@ export function RoomNotificationModeSwitcher({
|
||||
/>
|
||||
}
|
||||
>
|
||||
<Text size="T300">
|
||||
{mode === value ? <b>{modeToStr[mode]}</b> : modeToStr[mode]}
|
||||
</Text>
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="T300">
|
||||
{mode === value ? <b>{modeToStr[mode]}</b> : modeToStr[mode]}
|
||||
</Text>
|
||||
{mode === RoomNotificationMode.Unset && (
|
||||
<Text size="T200" priority="300">
|
||||
Follows your global notification rules
|
||||
</Text>
|
||||
)}
|
||||
</Box>
|
||||
</MenuItem>
|
||||
))}
|
||||
</Box>
|
||||
|
||||
@@ -52,18 +52,22 @@ export function RedactedContent({ reason }: RedactedContentProps) {
|
||||
);
|
||||
}
|
||||
|
||||
export function UnsupportedContent() {
|
||||
type BrokenContentProps = {
|
||||
body?: string;
|
||||
};
|
||||
|
||||
export function UnsupportedContent({ body }: BrokenContentProps) {
|
||||
return (
|
||||
<Text>
|
||||
<MessageUnsupportedContent />
|
||||
<MessageUnsupportedContent body={body} />
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
|
||||
export function BrokenContent() {
|
||||
export function BrokenContent({ body }: BrokenContentProps) {
|
||||
return (
|
||||
<Text>
|
||||
<MessageBrokenContent />
|
||||
<MessageBrokenContent body={body} />
|
||||
</Text>
|
||||
);
|
||||
}
|
||||
@@ -117,7 +121,7 @@ export function MText({ edited, content, renderBody, renderUrlsPreview, style }:
|
||||
return true;
|
||||
}, [trimmedBody, safeCustomBody]);
|
||||
|
||||
if (!body) return <BrokenContent />;
|
||||
if (!body) return <BrokenContent body={customBody ?? body} />;
|
||||
|
||||
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 <BrokenContent />;
|
||||
if (typeof body !== 'string') {
|
||||
return <BrokenContent body={typeof customBody === 'string' ? customBody : undefined} />;
|
||||
}
|
||||
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 <BrokenContent />;
|
||||
if (typeof body !== 'string') {
|
||||
return <BrokenContent body={typeof customBody === 'string' ? customBody : undefined} />;
|
||||
}
|
||||
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 <BrokenContent />;
|
||||
return <BrokenContent body={content.body ?? content.filename} />;
|
||||
}
|
||||
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 <BrokenContent />;
|
||||
return <BrokenContent body={content.body ?? content.filename} />;
|
||||
}
|
||||
|
||||
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 <BrokenContent />;
|
||||
return <BrokenContent body={content.body ?? content.filename} />;
|
||||
}
|
||||
|
||||
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 <BrokenContent />;
|
||||
return <BrokenContent body={content.body ?? content.filename} />;
|
||||
}
|
||||
|
||||
return (
|
||||
@@ -461,8 +469,9 @@ type MLocationProps = {
|
||||
};
|
||||
export function MLocation({ content }: MLocationProps) {
|
||||
const geoUri = content.geo_uri;
|
||||
if (typeof geoUri !== 'string') return <BrokenContent />;
|
||||
|
||||
if (typeof geoUri !== 'string') {
|
||||
return <BrokenContent body={typeof content.body === 'string' ? content.body : undefined} />;
|
||||
}
|
||||
const location = parseGeoUri(geoUri);
|
||||
if (!location) return <BrokenContent />;
|
||||
|
||||
@@ -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 <MessageBrokenContent />;
|
||||
return <MessageBrokenContent body={content.body} />;
|
||||
}
|
||||
const height = scaleYDimension(imgInfo?.w || 152, 152, imgInfo?.h || 152);
|
||||
|
||||
|
||||
@@ -16,12 +16,16 @@ export const MessageDeletedContent = as<'div', { children?: never; reason?: stri
|
||||
)
|
||||
);
|
||||
|
||||
export const MessageUnsupportedContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
<i>Unsupported message</i>
|
||||
</Box>
|
||||
));
|
||||
export const MessageUnsupportedContent = as<'div', { children?: never; body?: string }>(
|
||||
({ body, ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
<i>Unsupported message</i>
|
||||
{body && `: ${body}`}
|
||||
{!body && ' (no body)'}
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
|
||||
export const MessageFailedContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
@@ -44,12 +48,17 @@ export const MessageNotDecryptedContent = as<'div', { children?: never }>(({ ...
|
||||
</Box>
|
||||
));
|
||||
|
||||
export const MessageBrokenContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
<i>Broken message</i>
|
||||
</Box>
|
||||
));
|
||||
// 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) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
<Icon size="50" src={Icons.Warning} />
|
||||
<i>Broken message</i>
|
||||
{body && `: ${body}`}
|
||||
{!body && ' (no body)'}
|
||||
</Box>
|
||||
)
|
||||
);
|
||||
|
||||
export const MessageEmptyContent = as<'div', { children?: never }>(({ ...props }, ref) => (
|
||||
<Box as="span" alignItems="Center" gap="100" style={criticalStyle} {...props} ref={ref}>
|
||||
|
||||
@@ -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
|
||||
) => (
|
||||
<div
|
||||
className={classNames(
|
||||
css.MessageBase({ highlight, selected, collapse, autoCollapse, space }),
|
||||
css.MessageBase({ highlight, notifyHighlight, selected, collapse, autoCollapse, space }),
|
||||
className
|
||||
)}
|
||||
{...props}
|
||||
|
||||
@@ -65,6 +65,17 @@ const HighlightVariant = styleVariants({
|
||||
},
|
||||
});
|
||||
|
||||
const NotifyHighlightVariant = styleVariants({
|
||||
silent: {
|
||||
backgroundColor: color.Secondary.Container,
|
||||
boxShadow: `inset ${config.borderWidth.B700} 0 0 ${color.Secondary.ContainerLine}`,
|
||||
},
|
||||
loud: {
|
||||
backgroundColor: color.Warning.Container,
|
||||
boxShadow: `inset ${config.borderWidth.B700} 0 0 ${color.Warning.ContainerLine}`,
|
||||
},
|
||||
});
|
||||
|
||||
const SelectedVariant = styleVariants({
|
||||
true: {
|
||||
backgroundColor: color.Surface.ContainerActive,
|
||||
@@ -101,6 +112,7 @@ export const MessageBase = recipe({
|
||||
true: AutoCollapse,
|
||||
},
|
||||
highlight: HighlightVariant,
|
||||
notifyHighlight: NotifyHighlightVariant,
|
||||
selected: SelectedVariant,
|
||||
},
|
||||
defaultVariants: {
|
||||
|
||||
@@ -92,6 +92,7 @@ export function MessageForwardInternal({ room, mEvent, onClose }: MessageForward
|
||||
|
||||
const [isTargetSelected, setIsTargetSelected] = useState(false);
|
||||
const [isForwardSuccess, setIsForwardSuccess] = useState(false);
|
||||
const [isForwarding, setIsForwarding] = useState(false);
|
||||
const [isForwardError, setIsForwardError] = useState(false);
|
||||
const [targetRoomId, setTargetRoomId] = useState<string | null>(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<typeof mx.sendEvent>[2];
|
||||
type SendEventContent = Parameters<typeof mx.sendEvent>[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
|
||||
</Box>
|
||||
</Scroll>
|
||||
{isTargetSelected && targetRoomId && (
|
||||
<Button style={{ margin: config.space.S300 }} onClick={handleForwardClick}>
|
||||
<Button
|
||||
style={{ margin: config.space.S300 }}
|
||||
onClick={handleForwardClick}
|
||||
disabled={isForwarding}
|
||||
>
|
||||
<Text>Forward to {getRoom(targetRoomId)?.name}</Text>
|
||||
</Button>
|
||||
)}
|
||||
|
||||
@@ -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({
|
||||
|
||||
@@ -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<SimilarIssue[]> {
|
||||
// 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, string>): string {
|
||||
const devLabel = IS_RELEASE_TAG ? '' : '-dev';
|
||||
const buildLabel = BUILD_HASH ? ` (${BUILD_HASH})` : '';
|
||||
const version = `v${APP_VERSION}${devLabel}${buildLabel}`;
|
||||
|
||||
const params: Record<string, string> = { 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<ReportType>('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<SimilarIssue[]>([]);
|
||||
const [searching, setSearching] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
const trimmed = title.trim();
|
||||
const controller = new AbortController();
|
||||
let cancelled = false;
|
||||
let timer: ReturnType<typeof setTimeout> | 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<string, string> =
|
||||
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 (
|
||||
<Overlay open backdrop={<OverlayBackdrop />}>
|
||||
<OverlayCenter>
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
clickOutsideDeactivates: true,
|
||||
onDeactivate: close,
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Modal size="500" flexHeight variant="Surface">
|
||||
<Box direction="Column">
|
||||
<Header
|
||||
size="500"
|
||||
style={{ padding: config.space.S200, paddingLeft: config.space.S400 }}
|
||||
>
|
||||
<Box grow="Yes">
|
||||
<Text size="H4">Report an Issue</Text>
|
||||
</Box>
|
||||
<IconButton size="300" radii="300" onClick={close}>
|
||||
<Icon src={Icons.Cross} />
|
||||
</IconButton>
|
||||
</Header>
|
||||
<Scroll size="300" hideTrack>
|
||||
<Box
|
||||
style={{ padding: config.space.S400, paddingRight: config.space.S200 }}
|
||||
direction="Column"
|
||||
gap="500"
|
||||
>
|
||||
{/* Type */}
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Type</Text>
|
||||
<Box gap="200">
|
||||
<Chip
|
||||
radii="Pill"
|
||||
variant={type === 'bug' ? 'Primary' : 'SurfaceVariant'}
|
||||
aria-pressed={type === 'bug'}
|
||||
onClick={() => setType('bug')}
|
||||
>
|
||||
<Text size="T300">Bug Report</Text>
|
||||
</Chip>
|
||||
<Chip
|
||||
radii="Pill"
|
||||
variant={type === 'feature' ? 'Primary' : 'SurfaceVariant'}
|
||||
aria-pressed={type === 'feature'}
|
||||
onClick={() => setType('feature')}
|
||||
>
|
||||
<Text size="T300">Feature Request</Text>
|
||||
</Chip>
|
||||
</Box>
|
||||
</Box>
|
||||
|
||||
{/* Title + duplicate check */}
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Title *</Text>
|
||||
<Input
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
autoFocus
|
||||
placeholder="Brief description"
|
||||
value={title}
|
||||
onChange={(e) => setTitle((e.target as HTMLInputElement).value)}
|
||||
/>
|
||||
{searching && (
|
||||
<Box gap="200" alignItems="Center">
|
||||
<Spinner size="100" variant="Secondary" />
|
||||
<Text size="T200">Searching for similar issues…</Text>
|
||||
</Box>
|
||||
)}
|
||||
{!searching && similarIssues.length > 0 && (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="T200">
|
||||
Similar open issues — please check before submitting:
|
||||
</Text>
|
||||
{similarIssues.map((issue) => (
|
||||
<Text key={issue.number} size="T200">
|
||||
{'→ '}
|
||||
<a href={issue.html_url} target="_blank" rel="noopener noreferrer">
|
||||
#{issue.number}: {issue.title}
|
||||
</a>
|
||||
</Text>
|
||||
))}
|
||||
</Box>
|
||||
)}
|
||||
</Box>
|
||||
|
||||
{/* Description */}
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">
|
||||
{type === 'bug' ? 'Describe the bug *' : 'Describe the problem *'}
|
||||
</Text>
|
||||
<TextArea
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
rows={4}
|
||||
placeholder={
|
||||
type === 'bug'
|
||||
? 'A clear description of what the bug is.'
|
||||
: 'A clear description of the problem this feature would solve.'
|
||||
}
|
||||
value={type === 'bug' ? description : problem}
|
||||
onChange={(e) =>
|
||||
type === 'bug'
|
||||
? setDescription((e.target as HTMLTextAreaElement).value)
|
||||
: setProblem((e.target as HTMLTextAreaElement).value)
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Bug: steps to reproduce */}
|
||||
{type === 'bug' && (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Steps to reproduce (optional)</Text>
|
||||
<TextArea
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
rows={3}
|
||||
placeholder={'1. Go to…\n2. Click on…\n3. See error'}
|
||||
value={reproduction}
|
||||
onChange={(e) => setReproduction((e.target as HTMLTextAreaElement).value)}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Bug: expected behavior */}
|
||||
{type === 'bug' && (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Expected behavior (optional)</Text>
|
||||
<TextArea
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
rows={2}
|
||||
placeholder="A clear description of what you expected to happen."
|
||||
value={expectedBehavior}
|
||||
onChange={(e) =>
|
||||
setExpectedBehavior((e.target as HTMLTextAreaElement).value)
|
||||
}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Feature: solution */}
|
||||
{type === 'feature' && (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Describe the solution you'd like *</Text>
|
||||
<TextArea
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
rows={3}
|
||||
placeholder="I would like to…"
|
||||
value={solution}
|
||||
onChange={(e) => setSolution((e.target as HTMLTextAreaElement).value)}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Feature: alternatives */}
|
||||
{type === 'feature' && (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Alternatives considered (optional)</Text>
|
||||
<TextArea
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
rows={2}
|
||||
placeholder="Any alternative solutions or features you've considered."
|
||||
value={alternatives}
|
||||
onChange={(e) => setAlternatives((e.target as HTMLTextAreaElement).value)}
|
||||
/>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Platform info for bugs */}
|
||||
{type === 'bug' && (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Platform info (auto-included)</Text>
|
||||
<Text size="T200" style={{ opacity: 0.7, wordBreak: 'break-all' }}>
|
||||
{`Sable v${APP_VERSION}${IS_RELEASE_TAG ? '' : '-dev'} • ${navigator.userAgent}`}
|
||||
</Text>
|
||||
</Box>
|
||||
)}
|
||||
|
||||
{/* Additional context — shared */}
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Additional context (optional)</Text>
|
||||
<TextArea
|
||||
size="500"
|
||||
variant="SurfaceVariant"
|
||||
radii="400"
|
||||
rows={2}
|
||||
placeholder="Any other context or screenshots."
|
||||
value={context}
|
||||
onChange={(e) => setContext((e.target as HTMLTextAreaElement).value)}
|
||||
/>
|
||||
</Box>
|
||||
|
||||
{/* Actions */}
|
||||
<Box gap="300" justifyContent="End">
|
||||
<Button size="400" variant="Secondary" fill="None" radii="400" onClick={close}>
|
||||
<Text size="B400">Cancel</Text>
|
||||
</Button>
|
||||
<Button
|
||||
size="400"
|
||||
variant="Primary"
|
||||
radii="400"
|
||||
disabled={!canSubmit}
|
||||
onClick={handleSubmit}
|
||||
after={<Icon src={Icons.ArrowRight} size="100" />}
|
||||
>
|
||||
<Text size="B400">Open on GitHub</Text>
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
</Scroll>
|
||||
</Box>
|
||||
</Modal>
|
||||
</FocusTrap>
|
||||
</OverlayCenter>
|
||||
</Overlay>
|
||||
);
|
||||
}
|
||||
|
||||
export function BugReportModalRenderer() {
|
||||
const open = useBugReportModalOpen();
|
||||
|
||||
if (!open) return null;
|
||||
return <BugReportModal />;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
export { BugReportModalRenderer } from './BugReportModal';
|
||||
@@ -445,9 +445,11 @@ export function DeveloperTools({ requestClose }: DeveloperToolsProps) {
|
||||
Proxy: {syncDiagnostics.sliding.proxyBaseUrl}
|
||||
</Text>
|
||||
<Text size="T200">
|
||||
Timeline limit: {syncDiagnostics.sliding.timelineLimit} | page
|
||||
size: {syncDiagnostics.sliding.listPageSize} | adaptive:{' '}
|
||||
{syncDiagnostics.sliding.adaptiveTimeline ? 'yes' : 'no'}
|
||||
Room timeline: {syncDiagnostics.sliding.timelineLimit}
|
||||
{syncDiagnostics.sliding.adaptiveTimeline
|
||||
? ' (adaptive)'
|
||||
: ''}{' '}
|
||||
| page size: {syncDiagnostics.sliding.listPageSize}
|
||||
</Text>
|
||||
</>
|
||||
) : (
|
||||
|
||||
@@ -2,6 +2,7 @@ import { useCallback } from 'react';
|
||||
import { Box, Line } from 'folds';
|
||||
import { useParams } from 'react-router-dom';
|
||||
import { isKeyHotkey } from 'is-hotkey';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { ScreenSize, useScreenSizeContext } from '$hooks/useScreenSize';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
@@ -13,7 +14,6 @@ import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { useRoomMembers } from '$hooks/useRoomMembers';
|
||||
import { CallView } from '$features/call/CallView';
|
||||
import { WidgetsDrawer } from '$features/widgets/WidgetsDrawer';
|
||||
import { useAtomValue } from 'jotai';
|
||||
import { callChatAtom } from '$state/callEmbed';
|
||||
import { RoomViewHeader } from './RoomViewHeader';
|
||||
import { MembersDrawer } from './MembersDrawer';
|
||||
|
||||
@@ -23,6 +23,7 @@ import {
|
||||
IRoomTimelineData,
|
||||
MatrixClient,
|
||||
MatrixEvent,
|
||||
PushProcessor,
|
||||
RelationType,
|
||||
Room,
|
||||
RoomEvent,
|
||||
@@ -561,6 +562,7 @@ export function RoomTimeline({
|
||||
}: RoomTimelineProps) {
|
||||
const mx = useMatrixClient();
|
||||
const useAuthentication = useMediaAuthentication();
|
||||
const pushProcessor = useMemo(() => new PushProcessor(mx), [mx]);
|
||||
const [hideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const [messageLayout] = useSetting(settingsAtom, 'messageLayout');
|
||||
const [messageSpacing] = useSetting(settingsAtom, 'messageSpacing');
|
||||
@@ -856,10 +858,33 @@ export function RoomTimeline({
|
||||
useLiveTimelineRefresh(
|
||||
room,
|
||||
useCallback(() => {
|
||||
if (liveTimelineLinked || timeline.linkedTimelines.length === 0) {
|
||||
setTimeline(getInitialTimeline(room));
|
||||
}
|
||||
}, [room, liveTimelineLinked, timeline.linkedTimelines.length])
|
||||
// Always reinitialize on TimelineRefresh. With sliding sync, a limited
|
||||
// response replaces the room's live EventTimeline with a brand-new object,
|
||||
// firing TimelineRefresh. At that moment liveTimelineLinked is stale-false
|
||||
// (the stored linkedTimelines still reference the old detached object),
|
||||
// so the previous guard `if (liveTimelineLinked || ...)` would silently
|
||||
// skip reinit. Back-pagination then calls paginateEventTimeline against
|
||||
// the dead old timeline, which no-ops, and the IntersectionObserver never
|
||||
// re-fires because intersection state didn't change — causing a permanent
|
||||
// hang at the top of the timeline with no spinner and no history loaded.
|
||||
// Unconditionally reinitializing is correct: TimelineRefresh signals that
|
||||
// the SDK has replaced the timeline chain, so any stored range/indices
|
||||
// against the old chain are invalid anyway.
|
||||
//
|
||||
// Also force atBottom=true and queue a scroll-to-bottom. The SDK fires
|
||||
// TimelineRefresh before adding new events to the fresh live timeline, so
|
||||
// getInitialTimeline captures range.end=0. Once events arrive the
|
||||
// rangeAtEnd self-heal useEffect needs atBottom=true to run; the
|
||||
// IntersectionObserver may have transiently fired isIntersecting=false
|
||||
// during the render transition, leaving atBottom=false and causing the
|
||||
// "Jump to Latest" button to stick permanently. Forcing atBottom here is
|
||||
// correct: TimelineRefresh always reinits to the live end, so the user
|
||||
// should be repositioned to the bottom regardless.
|
||||
setTimeline(getInitialTimeline(room));
|
||||
setAtBottom(true);
|
||||
scrollToBottomRef.current.count += 1;
|
||||
scrollToBottomRef.current.smooth = false;
|
||||
}, [room, setAtBottom])
|
||||
);
|
||||
|
||||
// Re-render when non-live Replace relations arrive (bundled/historical edits
|
||||
@@ -880,6 +905,21 @@ export function RoomTimeline({
|
||||
setTimeline(getInitialTimeline(room));
|
||||
}, [eventId, room, timeline.linkedTimelines.length]);
|
||||
|
||||
// Fix stale rangeAtEnd after a sliding sync TimelineRefresh. The SDK fires
|
||||
// TimelineRefresh before adding new events to the freshly-created live
|
||||
// EventTimeline, so getInitialTimeline captures range.end=0. New events then
|
||||
// arrive via useLiveEventArrive, but its atLiveEndRef guard is stale-false
|
||||
// (hasn't re-rendered yet), bypassing the range-advance path. The next render
|
||||
// ends up with liveTimelineLinked=true but rangeAtEnd=false, making the
|
||||
// "Jump to Latest" button appear while the user is already at the bottom.
|
||||
// Re-running getInitialTimeline post-render (after events were added to the
|
||||
// live EventTimeline object) snaps range.end to the correct event count.
|
||||
useEffect(() => {
|
||||
if (liveTimelineLinked && !rangeAtEnd && atBottom) {
|
||||
setTimeline(getInitialTimeline(room));
|
||||
}
|
||||
}, [liveTimelineLinked, rangeAtEnd, atBottom, room]);
|
||||
|
||||
// Stay at bottom when room editor resize
|
||||
useResizeObserver(
|
||||
useMemo(() => {
|
||||
@@ -1313,6 +1353,12 @@ export function RoomTimeline({
|
||||
const { replyEventId, threadRootId } = mEvent;
|
||||
const highlighted = focusItem?.index === item && focusItem.highlight;
|
||||
|
||||
const pushActions = pushProcessor.actionsForEvent(mEvent);
|
||||
let notifyHighlight: 'silent' | 'loud' | undefined;
|
||||
if (pushActions?.notify && pushActions.tweaks?.highlight) {
|
||||
notifyHighlight = pushActions.tweaks?.sound ? 'loud' : 'silent';
|
||||
}
|
||||
|
||||
const editedEvent = getEditedEvent(mEventId, mEvent, timelineSet);
|
||||
const editedNewContent = editedEvent?.getContent()['m.new_content'];
|
||||
// If makeReplaced was called with a stripped edit (no m.new_content),
|
||||
@@ -1361,6 +1407,7 @@ export function RoomTimeline({
|
||||
messageLayout={messageLayout}
|
||||
collapse={collapse}
|
||||
highlight={highlighted}
|
||||
notifyHighlight={notifyHighlight}
|
||||
edit={editId === mEventId}
|
||||
canDelete={canRedact || (canDeleteOwn && mEvent.getSender() === mx.getUserId())}
|
||||
canSendReaction={canSendReaction}
|
||||
@@ -1438,6 +1485,12 @@ export function RoomTimeline({
|
||||
const senderDisplayName =
|
||||
getMemberDisplayName(room, senderId, nicknames) ?? getMxIdLocalPart(senderId) ?? senderId;
|
||||
|
||||
const pushActions = pushProcessor.actionsForEvent(mEvent);
|
||||
let notifyHighlight: 'silent' | 'loud' | undefined;
|
||||
if (pushActions?.notify && pushActions.tweaks?.highlight) {
|
||||
notifyHighlight = pushActions.tweaks?.sound ? 'loud' : 'silent';
|
||||
}
|
||||
|
||||
return (
|
||||
<Message
|
||||
key={mEvent.getId()}
|
||||
@@ -1449,6 +1502,7 @@ export function RoomTimeline({
|
||||
messageLayout={messageLayout}
|
||||
collapse={collapse}
|
||||
highlight={highlighted}
|
||||
notifyHighlight={notifyHighlight}
|
||||
edit={editId === mEventId}
|
||||
canDelete={canRedact || (canDeleteOwn && mEvent.getSender() === mx.getUserId())}
|
||||
canSendReaction={canSendReaction}
|
||||
@@ -2111,6 +2165,19 @@ export function RoomTimeline({
|
||||
</Box>
|
||||
);
|
||||
} else if (timelineItems.length === 0) {
|
||||
// When eventsLength===0 AND liveTimelineLinked the live EventTimeline was
|
||||
// just reset by a sliding sync TimelineRefresh and new events haven't
|
||||
// arrived yet. Attaching the IntersectionObserver anchor here would
|
||||
// immediately fire a server-side /messages request before current events
|
||||
// land — potentially causing a "/messages hangs → spinner stuck" scenario.
|
||||
// Suppressing the anchor for this transient state is safe: the rangeAtEnd
|
||||
// self-heal useEffect will call getInitialTimeline once events arrive, and
|
||||
// at that point the correct anchor (below) will be re-observed.
|
||||
// eventsLength>0 covers the range={K,K} case from recalibratePagination
|
||||
// where items=0 but events exist — that needs the anchor for local range
|
||||
// extension (no server call since start>0).
|
||||
const placeholderBackAnchor =
|
||||
eventsLength > 0 || !liveTimelineLinked ? observeBackAnchor : undefined;
|
||||
backPaginationJSX =
|
||||
messageLayout === MessageLayout.Compact ? (
|
||||
<>
|
||||
@@ -2126,7 +2193,7 @@ export function RoomTimeline({
|
||||
<MessageBase>
|
||||
<CompactPlaceholder />
|
||||
</MessageBase>
|
||||
<MessageBase ref={observeBackAnchor}>
|
||||
<MessageBase ref={placeholderBackAnchor}>
|
||||
<CompactPlaceholder />
|
||||
</MessageBase>
|
||||
</>
|
||||
@@ -2138,7 +2205,7 @@ export function RoomTimeline({
|
||||
<MessageBase>
|
||||
<DefaultPlaceholder />
|
||||
</MessageBase>
|
||||
<MessageBase ref={observeBackAnchor}>
|
||||
<MessageBase ref={placeholderBackAnchor}>
|
||||
<DefaultPlaceholder />
|
||||
</MessageBase>
|
||||
</>
|
||||
|
||||
@@ -81,6 +81,10 @@ import { MessageDeleteItem } from '$components/message/modals/MessageDelete';
|
||||
import { MessageReportItem } from '$components/message/modals/MessageReport';
|
||||
import { filterPronounsByLanguage } from '$utils/pronouns';
|
||||
import { useMentionClickHandler } from '$hooks/useMentionClickHandler';
|
||||
import {
|
||||
addStickerToDefaultPack,
|
||||
doesStickerExistInDefaultPack,
|
||||
} from '$utils/addStickerToDefaultStickerPack';
|
||||
import { MessageEditor } from './MessageEditor';
|
||||
import * as css from './styles.css';
|
||||
|
||||
@@ -212,6 +216,7 @@ export type MessageProps = {
|
||||
mEvent: MatrixEvent;
|
||||
collapse: boolean;
|
||||
highlight: boolean;
|
||||
notifyHighlight?: 'silent' | 'loud';
|
||||
edit?: boolean;
|
||||
canDelete?: boolean;
|
||||
canSendReaction?: boolean;
|
||||
@@ -315,6 +320,7 @@ function MessageInternal(
|
||||
mEvent,
|
||||
collapse,
|
||||
highlight,
|
||||
notifyHighlight,
|
||||
edit,
|
||||
canDelete,
|
||||
canSendReaction,
|
||||
@@ -667,6 +673,7 @@ function MessageInternal(
|
||||
});
|
||||
|
||||
const isThreadedMessage = mEvent.threadRootId !== undefined;
|
||||
const isStickerMessage = mEvent.getType() === 'm.sticker';
|
||||
|
||||
const evtId = mEvent.getId()!;
|
||||
const evtTimeline = room.getTimelineForEvent(evtId);
|
||||
@@ -684,6 +691,7 @@ function MessageInternal(
|
||||
space={messageSpacing}
|
||||
collapse={collapse}
|
||||
highlight={highlight}
|
||||
notifyHighlight={notifyHighlight}
|
||||
selected={!!menuAnchor || !!emojiBoardAnchor}
|
||||
{...props}
|
||||
{...hoverProps}
|
||||
@@ -817,6 +825,33 @@ function MessageInternal(
|
||||
</Text>
|
||||
</MenuItem>
|
||||
)}
|
||||
{isStickerMessage &&
|
||||
!doesStickerExistInDefaultPack(mx, mEvent.getContent().url) && (
|
||||
<MenuItem
|
||||
size="300"
|
||||
after={<Icon size="100" src={Icons.Star} />}
|
||||
radii="300"
|
||||
onClick={() => {
|
||||
addStickerToDefaultPack(
|
||||
mx,
|
||||
`sticker-${mEvent.getId()}`,
|
||||
mEvent.getContent().url,
|
||||
mEvent.getContent().body,
|
||||
mEvent.getContent().info
|
||||
);
|
||||
closeMenu();
|
||||
}}
|
||||
>
|
||||
<Text
|
||||
className={css.MessageMenuItemText}
|
||||
as="span"
|
||||
size="T300"
|
||||
truncate
|
||||
>
|
||||
Add to User Sticker Pack
|
||||
</Text>
|
||||
</MenuItem>
|
||||
)}
|
||||
{relations && <MessageAllReactionItem room={room} relations={relations} />}
|
||||
<MenuItem
|
||||
size="300"
|
||||
@@ -1046,6 +1081,7 @@ export type EventProps = {
|
||||
room: Room;
|
||||
mEvent: MatrixEvent;
|
||||
highlight: boolean;
|
||||
notifyHighlight?: 'silent' | 'loud';
|
||||
canDelete?: boolean;
|
||||
onReplyClick: (
|
||||
ev: Parameters<MouseEventHandler<HTMLButtonElement>>[0],
|
||||
@@ -1062,6 +1098,7 @@ export const Event = as<'div', EventProps>(
|
||||
room,
|
||||
mEvent,
|
||||
highlight,
|
||||
notifyHighlight,
|
||||
canDelete,
|
||||
onReplyClick,
|
||||
messageSpacing,
|
||||
@@ -1153,6 +1190,7 @@ export const Event = as<'div', EventProps>(
|
||||
space={messageSpacing}
|
||||
autoCollapse
|
||||
highlight={highlight}
|
||||
notifyHighlight={notifyHighlight}
|
||||
selected={!!menuAnchor}
|
||||
{...props}
|
||||
{...hoverProps}
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { SequenceCardStyle } from '$features/settings/styles.css';
|
||||
import { Method } from '$types/matrix-sdk';
|
||||
import { useState } from 'react';
|
||||
import { useOpenBugReportModal } from '$state/hooks/bugReportModal';
|
||||
|
||||
export function HomeserverInfo() {
|
||||
const mx = useMatrixClient();
|
||||
@@ -149,6 +150,7 @@ export function About({ requestClose }: AboutProps) {
|
||||
const mx = useMatrixClient();
|
||||
const devLabel = IS_RELEASE_TAG ? '' : '-dev';
|
||||
const buildLabel = BUILD_HASH ? ` (${BUILD_HASH})` : '';
|
||||
const openBugReport = useOpenBugReportModal();
|
||||
|
||||
return (
|
||||
<Page>
|
||||
@@ -190,7 +192,7 @@ export function About({ requestClose }: AboutProps) {
|
||||
<Box gap="200" wrap="Wrap">
|
||||
<Button
|
||||
as="a"
|
||||
href="https://github.com/7w1/sable"
|
||||
href="https://github.com/SableClient/Sable"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
variant="Secondary"
|
||||
@@ -203,7 +205,7 @@ export function About({ requestClose }: AboutProps) {
|
||||
</Button>
|
||||
<Button
|
||||
as="a"
|
||||
href="https://github.com/7w1/sable/pulls"
|
||||
href="https://github.com/SableClient/Sable/pulls"
|
||||
rel="noreferrer noopener"
|
||||
target="_blank"
|
||||
variant="Critical"
|
||||
@@ -242,6 +244,29 @@ export function About({ requestClose }: AboutProps) {
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Report an Issue"
|
||||
description="Report a bug or request a feature on GitHub."
|
||||
after={
|
||||
<Button
|
||||
onClick={openBugReport}
|
||||
variant="Secondary"
|
||||
fill="Soft"
|
||||
size="300"
|
||||
radii="300"
|
||||
outlined
|
||||
>
|
||||
<Text size="B300">Report</Text>
|
||||
</Button>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
<HomeserverInfo />
|
||||
<Box direction="Column" gap="100">
|
||||
|
||||
@@ -388,9 +388,6 @@ function PageZoomInput() {
|
||||
}
|
||||
export function Appearance() {
|
||||
const [twitterEmoji, setTwitterEmoji] = useSetting(settingsAtom, 'twitterEmoji');
|
||||
const [showUnreadCounts, setShowUnreadCounts] = useSetting(settingsAtom, 'showUnreadCounts');
|
||||
const [badgeCountDMsOnly, setBadgeCountDMsOnly] = useSetting(settingsAtom, 'badgeCountDMsOnly');
|
||||
const [showPingCounts, setShowPingCounts] = useSetting(settingsAtom, 'showPingCounts');
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="700">
|
||||
@@ -410,31 +407,6 @@ export function Appearance() {
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile title="Page Zoom" after={<PageZoomInput />} />
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Show Unread Counts"
|
||||
description="Display the number of unread messages on room and sidebar badges."
|
||||
after={
|
||||
<Switch variant="Primary" value={showUnreadCounts} onChange={setShowUnreadCounts} />
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Badge Counts for DMs Only"
|
||||
description="Only show unread counts on Direct Message badges. Non-DM rooms and spaces show a plain dot instead."
|
||||
after={
|
||||
<Switch variant="Primary" value={badgeCountDMsOnly} onChange={setBadgeCountDMsOnly} />
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Show Unread Ping Counts"
|
||||
description="When enabled overrides Show Unread Counts to still display counts."
|
||||
after={<Switch variant="Primary" value={showPingCounts} onChange={setShowPingCounts} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
||||
@@ -199,18 +199,9 @@ export function SyncDiagnostics() {
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="T300">Sliding proxy: {diagnostics.sliding.proxyBaseUrl}</Text>
|
||||
<Text size="T300">
|
||||
Timeline limit: {diagnostics.sliding.timelineLimit} (page size:{' '}
|
||||
{diagnostics.sliding.listPageSize})
|
||||
</Text>
|
||||
<Text size="T300">
|
||||
Adaptive timeline: {diagnostics.sliding.adaptiveTimeline ? 'yes' : 'no'}
|
||||
</Text>
|
||||
<Text size="T300">
|
||||
Device/network: saveData {diagnostics.sliding.device.saveData ? 'on' : 'off'} |
|
||||
effectiveType {diagnostics.sliding.device.effectiveType ?? 'unknown'} | memory{' '}
|
||||
{diagnostics.sliding.device.deviceMemoryGb ?? 'unknown'} GB | mobile{' '}
|
||||
{diagnostics.sliding.device.mobile ? 'yes' : 'no'} | missing signals{' '}
|
||||
{diagnostics.sliding.device.missingSignals}
|
||||
Room timeline limit: {diagnostics.sliding.timelineLimit} (adaptive:{' '}
|
||||
{diagnostics.sliding.adaptiveTimeline ? 'yes' : 'no'}) | page size:{' '}
|
||||
{diagnostics.sliding.listPageSize}
|
||||
</Text>
|
||||
{diagnostics.sliding.lists.map((list) => (
|
||||
<Text size="T300" key={list.key}>
|
||||
|
||||
@@ -410,6 +410,7 @@ function Editor({ isMobile }: { isMobile: boolean }) {
|
||||
const [isMarkdown, setIsMarkdown] = useSetting(settingsAtom, 'isMarkdown');
|
||||
const [hideActivity, setHideActivity] = useSetting(settingsAtom, 'hideActivity');
|
||||
const [hideReads, setHideReads] = useSetting(settingsAtom, 'hideReads');
|
||||
const [sendPresence, setSendPresence] = useSetting(settingsAtom, 'sendPresence');
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
@@ -453,6 +454,13 @@ function Editor({ isMobile }: { isMobile: boolean }) {
|
||||
after={<Switch variant="Primary" value={hideReads} onChange={setHideReads} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard className={SequenceCardStyle} variant="SurfaceVariant" direction="Column">
|
||||
<SettingTile
|
||||
title="Presence Status"
|
||||
description="Show and receive online status from other users."
|
||||
after={<Switch variant="Primary" value={sendPresence} onChange={setSendPresence} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import {
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { SequenceCardStyle } from '$features/settings/styles.css';
|
||||
import { NotificationModeSwitcher } from './NotificationModeSwitcher';
|
||||
import { NotificationLevelsHint } from './NotificationLevelsHint';
|
||||
|
||||
const getAllMessageDefaultRule = (
|
||||
ruleId: RuleId,
|
||||
@@ -89,13 +90,17 @@ export function AllMessagesNotifications() {
|
||||
<Box direction="Column" gap="100">
|
||||
<Box alignItems="Center" justifyContent="SpaceBetween" gap="200">
|
||||
<Text size="L400">All Messages</Text>
|
||||
<Box gap="100">
|
||||
<Box gap="100" alignItems="Center">
|
||||
<NotificationLevelsHint />
|
||||
<Text size="T200">Badge: </Text>
|
||||
<Badge radii="300" variant="Secondary" fill="Solid">
|
||||
<Text size="L400">1</Text>
|
||||
</Badge>
|
||||
</Box>
|
||||
</Box>
|
||||
<Text size="T300" priority="300">
|
||||
Default notification level for all messages in rooms where no per-room override is set.
|
||||
</Text>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
|
||||
@@ -15,6 +15,7 @@ import {
|
||||
import { AsyncStatus, useAsyncCallback } from '$hooks/useAsyncCallback';
|
||||
import { SequenceCardStyle } from '$features/settings/styles.css';
|
||||
import { NotificationModeSwitcher } from './NotificationModeSwitcher';
|
||||
import { NotificationLevelsHint } from './NotificationLevelsHint';
|
||||
|
||||
const NOTIFY_MODE_OPS: NotificationModeOptions = {
|
||||
highlight: true,
|
||||
@@ -163,13 +164,17 @@ export function KeywordMessagesNotifications() {
|
||||
<Box direction="Column" gap="100">
|
||||
<Box alignItems="Center" justifyContent="SpaceBetween" gap="200">
|
||||
<Text size="L400">Keyword Messages</Text>
|
||||
<Box gap="100">
|
||||
<Box gap="100" alignItems="Center">
|
||||
<NotificationLevelsHint />
|
||||
<Text size="T200">Badge: </Text>
|
||||
<Badge radii="300" variant="Success" fill="Solid">
|
||||
<Text size="L400">1</Text>
|
||||
</Badge>
|
||||
</Box>
|
||||
</Box>
|
||||
<Text size="T300" priority="300">
|
||||
Custom keywords that trigger notifications when matched in a message body.
|
||||
</Text>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
import { MouseEventHandler, useState } from 'react';
|
||||
import { Box, config, Header, Icon, IconButton, Icons, Menu, PopOut, RectCords, Text } from 'folds';
|
||||
import FocusTrap from 'focus-trap-react';
|
||||
import { stopPropagation } from '$utils/keyboard';
|
||||
|
||||
export function NotificationLevelsHint() {
|
||||
const [anchor, setAnchor] = useState<RectCords>();
|
||||
|
||||
const handleOpen: MouseEventHandler<HTMLElement> = (evt) => {
|
||||
setAnchor(evt.currentTarget.getBoundingClientRect());
|
||||
};
|
||||
|
||||
const itemPadding = { padding: config.space.S200, paddingTop: 0 };
|
||||
|
||||
return (
|
||||
<PopOut
|
||||
anchor={anchor}
|
||||
position="Bottom"
|
||||
align="End"
|
||||
content={
|
||||
<FocusTrap
|
||||
focusTrapOptions={{
|
||||
initialFocus: false,
|
||||
onDeactivate: () => setAnchor(undefined),
|
||||
clickOutsideDeactivates: true,
|
||||
escapeDeactivates: stopPropagation,
|
||||
}}
|
||||
>
|
||||
<Menu style={{ maxWidth: '280px' }}>
|
||||
<Header size="300" style={{ padding: `0 ${config.space.S200}` }}>
|
||||
<Text size="L400">Notification Levels</Text>
|
||||
</Header>
|
||||
<Box direction="Column" style={itemPadding} gap="300" tabIndex={0}>
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Disable</Text>
|
||||
<Text size="T300" priority="300">
|
||||
The rule is muted. No notifications of any kind.
|
||||
</Text>
|
||||
</Box>
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Notify Silent</Text>
|
||||
<Text size="T300" priority="300">
|
||||
Visual notification (badge and banner) when a relevant message arrives. No sound.
|
||||
</Text>
|
||||
</Box>
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">Notify Loud</Text>
|
||||
<Text size="T300" priority="300">
|
||||
Visual highlight plus sound. Respects the Notification Sound setting above, and
|
||||
triggers sound and vibration on mobile push.
|
||||
</Text>
|
||||
</Box>
|
||||
</Box>
|
||||
</Menu>
|
||||
</FocusTrap>
|
||||
}
|
||||
>
|
||||
<IconButton
|
||||
onClick={handleOpen}
|
||||
type="button"
|
||||
variant="Secondary"
|
||||
size="300"
|
||||
radii="300"
|
||||
aria-pressed={!!anchor}
|
||||
>
|
||||
<Icon style={{ opacity: config.opacity.P300 }} size="100" src={Icons.Info} />
|
||||
</IconButton>
|
||||
</PopOut>
|
||||
);
|
||||
}
|
||||
@@ -17,6 +17,7 @@ import {
|
||||
} from '$hooks/useNotificationMode';
|
||||
import { SequenceCardStyle } from '$features/settings/styles.css';
|
||||
import { NotificationModeSwitcher } from './NotificationModeSwitcher';
|
||||
import { NotificationLevelsHint } from './NotificationLevelsHint';
|
||||
|
||||
const NOTIFY_MODE_OPS: NotificationModeOptions = {
|
||||
highlight: true,
|
||||
@@ -120,18 +121,23 @@ export function SpecialMessagesNotifications() {
|
||||
() => pushRulesEvt?.getContent<IPushRules>() ?? { global: {} },
|
||||
[pushRulesEvt]
|
||||
);
|
||||
const intentionalMentions = mx.supportsIntentionalMentions();
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<Box alignItems="Center" justifyContent="SpaceBetween" gap="200">
|
||||
<Text size="L400">Special Messages</Text>
|
||||
<Box gap="100">
|
||||
<Box gap="100" alignItems="Center">
|
||||
<NotificationLevelsHint />
|
||||
<Text size="T200">Badge: </Text>
|
||||
<Badge radii="300" variant="Success" fill="Solid">
|
||||
<Text size="L400">1</Text>
|
||||
</Badge>
|
||||
</Box>
|
||||
</Box>
|
||||
<Text size="T300" priority="300">
|
||||
Overrides the All Messages level for messages that mention you or match a keyword.
|
||||
</Text>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
@@ -191,29 +197,21 @@ export function SpecialMessagesNotifications() {
|
||||
>
|
||||
<SettingTile
|
||||
title="Mention @room"
|
||||
description="Only triggers if the sender has permission to notify the whole room."
|
||||
after={
|
||||
<MentionModeSwitcher
|
||||
pushRules={pushRules}
|
||||
ruleId={RuleId.IsRoomMention}
|
||||
defaultPushRuleData={DefaultIsRoomMention}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Contains @room"
|
||||
after={
|
||||
<MentionModeSwitcher
|
||||
pushRules={pushRules}
|
||||
ruleId={RuleId.AtRoomNotification}
|
||||
defaultPushRuleData={DefaultAtRoomNotification}
|
||||
/>
|
||||
intentionalMentions ? (
|
||||
<MentionModeSwitcher
|
||||
pushRules={pushRules}
|
||||
ruleId={RuleId.IsRoomMention}
|
||||
defaultPushRuleData={DefaultIsRoomMention}
|
||||
/>
|
||||
) : (
|
||||
<MentionModeSwitcher
|
||||
pushRules={pushRules}
|
||||
ruleId={RuleId.AtRoomNotification}
|
||||
defaultPushRuleData={DefaultAtRoomNotification}
|
||||
/>
|
||||
)
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable no-nested-ternary */
|
||||
import { useCallback, useEffect, useState } from 'react';
|
||||
import { Box, Text, Switch, Button, color, Spinner } from 'folds';
|
||||
import { Box, Text, Switch, Button, color, Spinner, config } from 'folds';
|
||||
import { IPusherRequest } from '$types/matrix-sdk';
|
||||
import { useAtom } from 'jotai';
|
||||
import { SequenceCard } from '$components/sequence-card';
|
||||
@@ -186,24 +186,39 @@ export function SystemNotification() {
|
||||
settingsAtom,
|
||||
'clearNotificationsOnRead'
|
||||
);
|
||||
const [showUnreadCounts, setShowUnreadCounts] = useSetting(settingsAtom, 'showUnreadCounts');
|
||||
const [badgeCountDMsOnly, setBadgeCountDMsOnly] = useSetting(settingsAtom, 'badgeCountDMsOnly');
|
||||
const [showPingCounts, setShowPingCounts] = useSetting(settingsAtom, 'showPingCounts');
|
||||
|
||||
// Describe what the current badge combo actually does so users aren't left guessing.
|
||||
const badgeBehaviourSummary = (): string => {
|
||||
if (!showUnreadCounts && !showPingCounts) {
|
||||
return 'Badges show a plain dot for any unread activity — no numbers displayed.';
|
||||
}
|
||||
if (!showUnreadCounts && showPingCounts) {
|
||||
return 'Badges show a number only when you are directly mentioned; all other unread activity shows a plain dot.';
|
||||
}
|
||||
if (showUnreadCounts && badgeCountDMsOnly) {
|
||||
return 'Only Direct Message badges show a number count. Rooms and spaces show a plain dot instead.';
|
||||
}
|
||||
return 'All rooms and DMs show a number count for every unread message.';
|
||||
};
|
||||
|
||||
return (
|
||||
<Box direction="Column" gap="100">
|
||||
<Text size="L400">System & Notifications</Text>
|
||||
{mobileOrTablet() && (
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Mobile In-App Notifications"
|
||||
description="Show a notification banner inside the app when a message arrives."
|
||||
after={<Switch value={showInAppNotifs} onChange={setShowInAppNotifs} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
)}
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="In-App Notifications"
|
||||
description="Show a notification banner inside the app when a message arrives."
|
||||
after={<Switch value={showInAppNotifs} onChange={setShowInAppNotifs} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
{mobileOrTablet() && (
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
@@ -223,11 +238,23 @@ export function SystemNotification() {
|
||||
>
|
||||
<SettingTile
|
||||
title="System Notifications"
|
||||
description="Show an OS-level notification banner when a message arrives while the app is open. On mobile, the in-app banner is used instead."
|
||||
description="Show an OS-level notification banner when a message arrives while the app is open."
|
||||
after={<Switch value={showSystemNotifs} onChange={setShowSystemNotifs} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
)}
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="In-App Notification Sound"
|
||||
description="Play a sound inside the app when a new message arrives."
|
||||
after={<Switch value={isNotificationSounds} onChange={setIsNotificationSounds} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
@@ -270,18 +297,6 @@ export function SystemNotification() {
|
||||
after={<Switch value={clearNotificationsOnRead} onChange={setClearNotificationsOnRead} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Notification Sound"
|
||||
description="Play sound when new message arrives and app is open."
|
||||
after={<Switch value={isNotificationSounds} onChange={setIsNotificationSounds} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
@@ -299,6 +314,58 @@ export function SystemNotification() {
|
||||
>
|
||||
<DeregisterAllPushersSetting />
|
||||
</SequenceCard>
|
||||
|
||||
<Text size="L400" style={{ paddingTop: config.space.S700 }}>
|
||||
Badges
|
||||
</Text>
|
||||
<Text size="T300" style={{ opacity: 0.7 }}>
|
||||
{badgeBehaviourSummary()}
|
||||
</Text>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Show Message Counts"
|
||||
description="Show a number on room, space, and DM badges for every unread message."
|
||||
after={
|
||||
<Switch variant="Primary" value={showUnreadCounts} onChange={setShowUnreadCounts} />
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Direct Messages Only"
|
||||
description="Only DM badges display a count. Room and space badges show a plain dot instead."
|
||||
after={
|
||||
<Switch
|
||||
variant="Primary"
|
||||
value={badgeCountDMsOnly}
|
||||
onChange={setBadgeCountDMsOnly}
|
||||
disabled={!showUnreadCounts}
|
||||
/>
|
||||
}
|
||||
/>
|
||||
</SequenceCard>
|
||||
<SequenceCard
|
||||
className={SequenceCardStyle}
|
||||
variant="SurfaceVariant"
|
||||
direction="Column"
|
||||
gap="400"
|
||||
>
|
||||
<SettingTile
|
||||
title="Always Count Mentions"
|
||||
description="Show a number on any badge where you were directly mentioned, even if message counts are turned off."
|
||||
after={<Switch variant="Primary" value={showPingCounts} onChange={setShowPingCounts} />}
|
||||
/>
|
||||
</SequenceCard>
|
||||
</Box>
|
||||
);
|
||||
}
|
||||
@@ -29,6 +29,7 @@ import { getStateEvent } from '$utils/room';
|
||||
import { splitWithSpace } from '$utils/common';
|
||||
import { useSetting } from '$state/hooks/settings';
|
||||
import { settingsAtom } from '$state/settings';
|
||||
import { useOpenBugReportModal } from '$state/hooks/bugReportModal';
|
||||
import { createRoomEncryptionState } from '$components/create-room';
|
||||
import { parsePronounsInput } from '$utils/pronouns';
|
||||
import { useRoomNavigate } from './useRoomNavigate';
|
||||
@@ -248,6 +249,8 @@ export enum Command {
|
||||
Wave = 'wave',
|
||||
Poke = 'poke',
|
||||
Headpat = 'headpat',
|
||||
// Meta
|
||||
Report = 'bugreport',
|
||||
}
|
||||
|
||||
export type CommandContent = {
|
||||
@@ -262,6 +265,7 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
const { navigateRoom } = useRoomNavigate();
|
||||
const [developerTools] = useSetting(settingsAtom, 'developerTools');
|
||||
const profile = useUserProfile(mx.getSafeUserId());
|
||||
const openBugReport = useOpenBugReportModal();
|
||||
|
||||
const commands: CommandRecord = useMemo(
|
||||
() => ({
|
||||
@@ -1379,8 +1383,16 @@ export const useCommands = (mx: MatrixClient, room: Room): CommandRecord => {
|
||||
} as any);
|
||||
},
|
||||
},
|
||||
// Meta commands
|
||||
[Command.Report]: {
|
||||
name: Command.Report,
|
||||
description: 'Report a bug or request a feature',
|
||||
exe: async () => {
|
||||
openBugReport();
|
||||
},
|
||||
},
|
||||
}),
|
||||
[mx, navigateRoom, room, profile.displayName, profile.avatarUrl, developerTools]
|
||||
[mx, navigateRoom, room, profile.displayName, profile.avatarUrl, developerTools, openBugReport]
|
||||
);
|
||||
|
||||
return commands;
|
||||
|
||||
@@ -8,6 +8,7 @@ import { useSyncState } from './useSyncState';
|
||||
import { useMatrixClient } from './useMatrixClient';
|
||||
import { getCanonicalAliasOrRoomId } from '../utils/matrix';
|
||||
import { getDirectRoomPath, getHomeRoomPath, getSpaceRoomPath } from '../pages/pathUtils';
|
||||
import { getOrphanParents, guessPerfectParent } from '../utils/room';
|
||||
import { roomToParentsAtom } from '../state/room/roomToParents';
|
||||
import { createLogger } from '../utils/debug';
|
||||
|
||||
@@ -62,12 +63,16 @@ export function NotificationJumper() {
|
||||
// If the room lives inside a space, route through the space path so
|
||||
// SpaceRouteRoomProvider can resolve it — HomeRouteRoomProvider only
|
||||
// knows orphan rooms and would show JoinBeforeNavigate otherwise.
|
||||
const parents = roomToParents.get(pending.roomId);
|
||||
const firstParentId = parents && [...parents][0];
|
||||
if (firstParentId) {
|
||||
// Use getOrphanParents + guessPerfectParent (same as useRoomNavigate) so
|
||||
// we always navigate to a root-level space, not a subspace — subspace
|
||||
// paths are not recognised by the router and land on JoinBeforeNavigate.
|
||||
const orphanParents = getOrphanParents(roomToParents, pending.roomId);
|
||||
if (orphanParents.length > 0) {
|
||||
const parentSpace =
|
||||
guessPerfectParent(mx, pending.roomId, orphanParents) ?? orphanParents[0];
|
||||
navigate(
|
||||
getSpaceRoomPath(
|
||||
getCanonicalAliasOrRoomId(mx, firstParentId),
|
||||
getCanonicalAliasOrRoomId(mx, parentSpace),
|
||||
roomIdOrAlias,
|
||||
pending.eventId
|
||||
)
|
||||
|
||||
@@ -0,0 +1,27 @@
|
||||
import { useEffect } from 'react';
|
||||
import { useMatrixClient } from '$hooks/useMatrixClient';
|
||||
import { getSlidingSyncManager } from '$client/initMatrix';
|
||||
import { useSelectedRoom } from '$hooks/router/useSelectedRoom';
|
||||
|
||||
/**
|
||||
* Subscribes the currently selected room to the sliding sync "active room"
|
||||
* custom subscription (higher timeline limit) for the duration the room is open.
|
||||
*
|
||||
* Safe to call unconditionally — it is a no-op when classic sync is in use
|
||||
* (i.e. when there is no SlidingSyncManager for the client).
|
||||
*/
|
||||
export const useSlidingSyncActiveRoom = (): void => {
|
||||
const mx = useMatrixClient();
|
||||
const roomId = useSelectedRoom();
|
||||
|
||||
useEffect(() => {
|
||||
if (!roomId) return undefined;
|
||||
const manager = getSlidingSyncManager(mx);
|
||||
if (!manager) return undefined;
|
||||
|
||||
manager.subscribeToRoom(roomId);
|
||||
return () => {
|
||||
manager.unsubscribeFromRoom(roomId);
|
||||
};
|
||||
}, [mx, roomId]);
|
||||
};
|
||||
@@ -19,6 +19,7 @@ import { SpaceSettingsRenderer } from '$features/space-settings';
|
||||
import { UserRoomProfileRenderer } from '$components/UserRoomProfileRenderer';
|
||||
import { CreateRoomModalRenderer } from '$features/create-room';
|
||||
import { CreateSpaceModalRenderer } from '$features/create-space';
|
||||
import { BugReportModalRenderer } from '$features/bug-report';
|
||||
import { getFallbackSession, MATRIX_SESSIONS_KEY, Sessions } from '$state/sessions';
|
||||
import { getLocalStorageItem } from '$state/utils/atomWithLocalStorage';
|
||||
import { NotificationJumper } from '$hooks/useNotificationJumper';
|
||||
@@ -168,6 +169,7 @@ export const createRouter = (clientConfig: ClientConfig, screenSize: ScreenSize)
|
||||
<UserRoomProfileRenderer />
|
||||
<CreateRoomModalRenderer />
|
||||
<CreateSpaceModalRenderer />
|
||||
<BugReportModalRenderer />
|
||||
<RoomSettingsRenderer />
|
||||
<SpaceSettingsRenderer />
|
||||
<GlobalKeyboardShortcuts />
|
||||
|
||||
@@ -10,7 +10,7 @@ export function AuthFooter() {
|
||||
<Text
|
||||
as="a"
|
||||
size="T300"
|
||||
href="https://github.com/7w1/sable/"
|
||||
href="https://github.com/SableClient/Sable"
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { ReactNode } from 'react';
|
||||
import { Box } from 'folds';
|
||||
import { NotificationBanner } from '$components/notification-banner';
|
||||
|
||||
type ClientLayoutProps = {
|
||||
nav: ReactNode;
|
||||
@@ -8,6 +9,7 @@ type ClientLayoutProps = {
|
||||
export function ClientLayout({ nav, children }: ClientLayoutProps) {
|
||||
return (
|
||||
<Box grow="Yes">
|
||||
<NotificationBanner />
|
||||
<Box shrink="No">{nav}</Box>
|
||||
<Box grow="Yes">{children}</Box>
|
||||
</Box>
|
||||
|
||||
@@ -1,13 +1,12 @@
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { ReactNode, useCallback, useEffect, useRef } from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { PushProcessor, RoomEvent, RoomEventHandlerMap } from '$types/matrix-sdk';
|
||||
import { PushProcessor, RoomEvent, RoomEventHandlerMap, SetPresence } from '$types/matrix-sdk';
|
||||
import parse from 'html-react-parser';
|
||||
import { getReactCustomHtmlParser, LINKIFY_OPTS } from '$plugins/react-custom-html-parser';
|
||||
import { sanitizeCustomHtml } from '$utils/sanitize';
|
||||
import { roomToUnreadAtom } from '$state/room/roomToUnread';
|
||||
import LogoSVG from '$public/res/svg/cinny.svg';
|
||||
import { NotificationBanner } from '$components/notification-banner';
|
||||
import LogoUnreadSVG from '$public/res/svg/cinny-unread.svg';
|
||||
import LogoHighlightSVG from '$public/res/svg/cinny-highlight.svg';
|
||||
import NotificationSound from '$public/sound/notification.ogg';
|
||||
@@ -38,9 +37,24 @@ import {
|
||||
resolveNotificationPreviewText,
|
||||
} from '$utils/notificationStyle';
|
||||
import { mobileOrTablet } from '$utils/user-agent';
|
||||
import { useSlidingSyncActiveRoom } from '$hooks/useSlidingSyncActiveRoom';
|
||||
import { getSlidingSyncManager } from '$client/initMatrix';
|
||||
import { getInboxInvitesPath } from '../pathUtils';
|
||||
import { BackgroundNotifications } from './BackgroundNotifications';
|
||||
|
||||
function clearMediaSessionQuickly(): void {
|
||||
if (!('mediaSession' in navigator)) return;
|
||||
// iOS registers the lock screen media player as a side-effect of
|
||||
// HTMLAudioElement.play(). We delay slightly so iOS has finished updating
|
||||
// the media session before we clear it — clearing too early is a no-op.
|
||||
// We only clear if no real in-app media (video/audio in a room) has since
|
||||
// registered meaningful metadata; if it has, leave it alone.
|
||||
setTimeout(() => {
|
||||
if (navigator.mediaSession.metadata !== null) return;
|
||||
navigator.mediaSession.playbackState = 'none';
|
||||
}, 500);
|
||||
}
|
||||
|
||||
function SystemEmojiFeature() {
|
||||
const [twitterEmoji] = useSetting(settingsAtom, 'twitterEmoji');
|
||||
|
||||
@@ -158,6 +172,7 @@ function InviteNotifications() {
|
||||
const playSound = useCallback(() => {
|
||||
const audioElement = audioRef.current;
|
||||
audioElement?.play();
|
||||
clearMediaSessionQuickly();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -230,6 +245,7 @@ function MessageNotifications() {
|
||||
const playSound = useCallback(() => {
|
||||
const audioElement = audioRef.current;
|
||||
audioElement?.play();
|
||||
clearMediaSessionQuickly();
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -292,8 +308,13 @@ function MessageNotifications() {
|
||||
// If neither a loud nor a highlight rule matches, and it's not a DM, nothing to show.
|
||||
if (!isHighlightByRule && !loudByRule && !isDM) return;
|
||||
|
||||
// Page hidden: SW (push) handles the OS notification. Nothing to do in-app.
|
||||
if (document.visibilityState !== 'visible') return;
|
||||
// With sliding sync we only load m.room.member/$ME in required_state, so
|
||||
// PushProcessor cannot evaluate the room_member_count == 2 condition on
|
||||
// .m.rule.room_one_to_one. That rule therefore fails to match, and DM
|
||||
// messages fall through to .m.rule.message which carries no sound tweak —
|
||||
// leaving loudByRule=false. Treat known DMs as inherently loud so that
|
||||
// the OS notification and badge are consistent with the DM context.
|
||||
const isLoud = loudByRule || isDM;
|
||||
|
||||
// Record as notified to prevent duplicate banners (e.g. re-emitted decrypted events).
|
||||
notifiedEventsRef.current.add(eventId);
|
||||
@@ -302,11 +323,55 @@ function MessageNotifications() {
|
||||
if (first) notifiedEventsRef.current.delete(first);
|
||||
}
|
||||
|
||||
// Page is visible — show the themed in-app notification banner for any
|
||||
// highlighted message (mention / keyword) or loud push rule.
|
||||
// okay fast patch because that showNotifications setting atom is not getting set correctly or something
|
||||
if (mobileOrTablet() && showNotifications && (isHighlightByRule || loudByRule || isDM)) {
|
||||
const isEncryptedRoom = !!getStateEvent(room, StateEvent.RoomEncryption);
|
||||
// On desktop: fire an OS notification whenever system notifications are
|
||||
// enabled and permission is granted — regardless of whether the window is
|
||||
// focused. When the window is also visible the in-app banner fires too,
|
||||
// mirroring the behaviour of apps like Discord.
|
||||
// The whole block is wrapped in try/catch: window.Notification() can throw
|
||||
// in sandboxed environments, browsers with DnD active, or Electron — and
|
||||
// an uncaught exception here would abort the handler before setInAppBanner
|
||||
// is reached, causing in-app notifications to silently vanish too.
|
||||
if (!mobileOrTablet() && showSystemNotifications && notificationPermission('granted')) {
|
||||
try {
|
||||
const isEncryptedRoom = !!getStateEvent(room, StateEvent.RoomEncryption);
|
||||
const avatarMxc =
|
||||
room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
|
||||
const osPayload = buildRoomMessageNotification({
|
||||
roomName: room.name ?? 'Unknown',
|
||||
roomAvatar: avatarMxc
|
||||
? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined)
|
||||
: undefined,
|
||||
username:
|
||||
getMemberDisplayName(room, sender, nicknamesRef.current) ??
|
||||
getMxIdLocalPart(sender) ??
|
||||
sender,
|
||||
previewText: resolveNotificationPreviewText({
|
||||
content: mEvent.getContent(),
|
||||
eventType: mEvent.getType(),
|
||||
isEncryptedRoom,
|
||||
showMessageContent,
|
||||
showEncryptedMessageContent,
|
||||
}),
|
||||
silent: !notificationSound || !isLoud,
|
||||
eventId,
|
||||
});
|
||||
const noti = new window.Notification(osPayload.title, osPayload.options);
|
||||
const { roomId } = room;
|
||||
noti.onclick = () => {
|
||||
window.focus();
|
||||
setPending({ roomId, eventId, targetSessionId: mx.getUserId() ?? undefined });
|
||||
noti.close();
|
||||
};
|
||||
} catch {
|
||||
// window.Notification unavailable or blocked (sandboxed context, DnD, etc.)
|
||||
}
|
||||
}
|
||||
|
||||
// Everything below requires the page to be visible (in-app UI + audio).
|
||||
if (document.visibilityState !== 'visible') return;
|
||||
|
||||
// Page is visible — show the themed in-app notification banner.
|
||||
if (showNotifications && (isHighlightByRule || isLoud)) {
|
||||
const avatarMxc =
|
||||
room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
|
||||
const roomAvatar = avatarMxc
|
||||
@@ -317,21 +382,22 @@ function MessageNotifications() {
|
||||
getMxIdLocalPart(sender) ??
|
||||
sender;
|
||||
const content = mEvent.getContent();
|
||||
// Events reaching here are already decrypted (m.room.encrypted is skipped
|
||||
// above). Pass isEncryptedRoom:false so the preview always shows the actual
|
||||
// message body when showMessageContent is enabled.
|
||||
const previewText = resolveNotificationPreviewText({
|
||||
content: mEvent.getContent(),
|
||||
eventType: mEvent.getType(),
|
||||
isEncryptedRoom,
|
||||
isEncryptedRoom: false,
|
||||
showMessageContent,
|
||||
showEncryptedMessageContent,
|
||||
});
|
||||
|
||||
// Build a rich ReactNode body using the same HTML parser as the room
|
||||
// timeline — this gives full mxc image transforms, mention pills,
|
||||
// linkify, spoilers, code blocks, etc.
|
||||
// timeline — mxc images, mention pills, linkify, spoilers, code blocks.
|
||||
let bodyNode: ReactNode;
|
||||
if (
|
||||
showMessageContent &&
|
||||
(!isEncryptedRoom || showEncryptedMessageContent) &&
|
||||
content.format === 'org.matrix.custom.html' &&
|
||||
content.formatted_body
|
||||
) {
|
||||
@@ -348,7 +414,7 @@ function MessageNotifications() {
|
||||
roomAvatar,
|
||||
username: resolvedSenderName,
|
||||
previewText,
|
||||
silent: !notificationSound,
|
||||
silent: !notificationSound || !isLoud,
|
||||
eventId,
|
||||
});
|
||||
const { roomId } = room;
|
||||
@@ -372,45 +438,8 @@ function MessageNotifications() {
|
||||
});
|
||||
}
|
||||
|
||||
// On desktop: also fire an OS notification so the user is alerted even
|
||||
// if the browser window is minimised (respects System Notifications toggle).
|
||||
if (!mobileOrTablet() && showSystemNotifications && notificationPermission('granted')) {
|
||||
const isEncryptedRoom = !!getStateEvent(room, StateEvent.RoomEncryption);
|
||||
const avatarMxc =
|
||||
room.getAvatarFallbackMember()?.getMxcAvatarUrl() ?? room.getMxcAvatarUrl();
|
||||
const osPayload = buildRoomMessageNotification({
|
||||
roomName: room.name ?? 'Unknown',
|
||||
roomAvatar: avatarMxc
|
||||
? (mxcUrlToHttp(mx, avatarMxc, useAuthentication, 96, 96, 'crop') ?? undefined)
|
||||
: undefined,
|
||||
username:
|
||||
getMemberDisplayName(room, sender, nicknamesRef.current) ??
|
||||
getMxIdLocalPart(sender) ??
|
||||
sender,
|
||||
previewText: resolveNotificationPreviewText({
|
||||
content: mEvent.getContent(),
|
||||
eventType: mEvent.getType(),
|
||||
isEncryptedRoom,
|
||||
showMessageContent,
|
||||
showEncryptedMessageContent,
|
||||
}),
|
||||
// Play sound only if the push rule requests it and the user has sounds enabled.
|
||||
silent: !notificationSound || !loudByRule,
|
||||
eventId,
|
||||
});
|
||||
const noti = new window.Notification(osPayload.title, osPayload.options);
|
||||
const { roomId } = room;
|
||||
noti.onclick = () => {
|
||||
window.focus();
|
||||
setPending({ roomId, eventId, targetSessionId: mx.getUserId() ?? undefined });
|
||||
noti.close();
|
||||
};
|
||||
}
|
||||
|
||||
// In-app audio: play whenever notification sounds are enabled.
|
||||
// Not gated on loudByRule — that only controls the OS-level silent flag.
|
||||
// Audio API requires a visible, focused document; skip when hidden.
|
||||
if (document.visibilityState === 'visible' && notificationSound) {
|
||||
if (notificationSound) {
|
||||
playSound();
|
||||
}
|
||||
};
|
||||
@@ -498,8 +527,6 @@ export function HandleNotificationClick() {
|
||||
}
|
||||
|
||||
function SyncNotificationSettingsWithServiceWorker() {
|
||||
const [notificationSound] = useSetting(settingsAtom, 'isNotificationSounds');
|
||||
const [usePushNotifications] = useSetting(settingsAtom, 'usePushNotifications');
|
||||
const [showMessageContent] = useSetting(settingsAtom, 'showMessageContentInNotifications');
|
||||
const [showEncryptedMessageContent] = useSetting(
|
||||
settingsAtom,
|
||||
@@ -525,9 +552,11 @@ function SyncNotificationSettingsWithServiceWorker() {
|
||||
|
||||
useEffect(() => {
|
||||
if (!('serviceWorker' in navigator)) return;
|
||||
// notificationSoundEnabled is intentionally excluded: push notification sound
|
||||
// is governed by the push rule's tweakSound alone (OS/Sygnal handles it).
|
||||
// The in-app sound setting only controls the in-page <audio> playback above.
|
||||
const payload = {
|
||||
type: 'setNotificationSettings' as const,
|
||||
notificationSoundEnabled: notificationSound,
|
||||
showMessageContent,
|
||||
showEncryptedMessageContent,
|
||||
clearNotificationsOnRead,
|
||||
@@ -537,13 +566,27 @@ function SyncNotificationSettingsWithServiceWorker() {
|
||||
navigator.serviceWorker.ready.then((registration) => {
|
||||
registration.active?.postMessage(payload);
|
||||
});
|
||||
}, [
|
||||
notificationSound,
|
||||
usePushNotifications,
|
||||
showMessageContent,
|
||||
showEncryptedMessageContent,
|
||||
clearNotificationsOnRead,
|
||||
]);
|
||||
}, [showMessageContent, showEncryptedMessageContent, clearNotificationsOnRead]);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
function SlidingSyncActiveRoomSubscriber() {
|
||||
useSlidingSyncActiveRoom();
|
||||
return null;
|
||||
}
|
||||
|
||||
function PresenceFeature() {
|
||||
const mx = useMatrixClient();
|
||||
const [sendPresence] = useSetting(settingsAtom, 'sendPresence');
|
||||
|
||||
useEffect(() => {
|
||||
// Classic sync: set_presence query param on every /sync poll.
|
||||
// Passing undefined restores the default (online); Offline suppresses broadcasting.
|
||||
mx.setSyncPresence(sendPresence ? undefined : SetPresence.Offline);
|
||||
// Sliding sync: enable/disable the presence extension on the next poll.
|
||||
getSlidingSyncManager(mx)?.setPresenceEnabled(sendPresence);
|
||||
}, [mx, sendPresence]);
|
||||
|
||||
return null;
|
||||
}
|
||||
@@ -559,7 +602,8 @@ export function ClientNonUIFeatures({ children }: ClientNonUIFeaturesProps) {
|
||||
<MessageNotifications />
|
||||
<BackgroundNotifications />
|
||||
<SyncNotificationSettingsWithServiceWorker />
|
||||
<NotificationBanner />
|
||||
<SlidingSyncActiveRoomSubscriber />
|
||||
<PresenceFeature />
|
||||
{children}
|
||||
</>
|
||||
);
|
||||
|
||||
@@ -18,7 +18,11 @@ export function WelcomePage() {
|
||||
subTitle={
|
||||
<span>
|
||||
Yet another matrix client fork.{' '}
|
||||
<a href="https://github.com/7w1/sable" target="_blank" rel="noreferrer noopener">
|
||||
<a
|
||||
href="https://github.com/SableClient/Sable"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
>
|
||||
{`v${APP_VERSION}${IS_RELEASE_TAG ? '' : `-dev${BUILD_HASH ? ` (${BUILD_HASH})` : ''}`}`}
|
||||
</a>
|
||||
</span>
|
||||
@@ -28,7 +32,7 @@ export function WelcomePage() {
|
||||
<Box grow="Yes" style={{ maxWidth: toRem(300) }} direction="Column" gap="300">
|
||||
<Button
|
||||
as="a"
|
||||
href="https://github.com/7w1/sable"
|
||||
href="https://github.com/SableClient/Sable"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
before={<Icon size="200" src={Icons.Code} />}
|
||||
@@ -40,7 +44,7 @@ export function WelcomePage() {
|
||||
{/*
|
||||
<Button
|
||||
as="a"
|
||||
href="https://github.com/7w1/sable"
|
||||
href="https://github.com/SableClient/Sable"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
fill="Soft"
|
||||
@@ -56,7 +60,7 @@ export function WelcomePage() {
|
||||
<Box direction="Column" gap="200" alignItems="Center">
|
||||
<Button
|
||||
as="a"
|
||||
href="https://github.com/7w1/sable/blob/dev/CHANGELOG.md"
|
||||
href="https://github.com/SableClient/Sable/blob/dev/CHANGELOG.md"
|
||||
target="_blank"
|
||||
rel="noreferrer noopener"
|
||||
before={<Icon size="200" src={Icons.Code} />}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
import { atom } from 'jotai';
|
||||
|
||||
export const bugReportOpenAtom = atom(false);
|
||||
@@ -0,0 +1,15 @@
|
||||
import { useCallback } from 'react';
|
||||
import { useAtomValue, useSetAtom } from 'jotai';
|
||||
import { bugReportOpenAtom } from '$state/bugReportModal';
|
||||
|
||||
export const useBugReportModalOpen = (): boolean => useAtomValue(bugReportOpenAtom);
|
||||
|
||||
export const useOpenBugReportModal = (): (() => void) => {
|
||||
const setOpen = useSetAtom(bugReportOpenAtom);
|
||||
return useCallback(() => setOpen(true), [setOpen]);
|
||||
};
|
||||
|
||||
export const useCloseBugReportModal = (): (() => void) => {
|
||||
const setOpen = useSetAtom(bugReportOpenAtom);
|
||||
return useCallback(() => setOpen(false), [setOpen]);
|
||||
};
|
||||
@@ -78,6 +78,7 @@ export interface Settings {
|
||||
captionPosition: CaptionPosition;
|
||||
|
||||
// Sable features!
|
||||
sendPresence: boolean;
|
||||
mobileGestures: boolean;
|
||||
rightSwipeAction: RightSwipeAction;
|
||||
hideMembershipInReadOnly: boolean;
|
||||
@@ -153,6 +154,7 @@ const defaultSettings: Settings = {
|
||||
captionPosition: CaptionPosition.Below,
|
||||
|
||||
// Sable features!
|
||||
sendPresence: true,
|
||||
mobileGestures: true,
|
||||
rightSwipeAction: RightSwipeAction.Reply,
|
||||
hideMembershipInReadOnly: true,
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
import { PackContent, ImageUsage } from '$plugins/custom-emoji';
|
||||
import { AccountDataEvent } from '$types/matrix/accountData';
|
||||
import { IImageInfo } from '$types/matrix/common';
|
||||
import { MatrixClient } from 'matrix-js-sdk';
|
||||
|
||||
// Utility function to add a sticker to the default sticker pack
|
||||
export async function addStickerToDefaultPack(
|
||||
mx: MatrixClient,
|
||||
shortcode: string,
|
||||
mxc: string,
|
||||
body?: string,
|
||||
info?: IImageInfo
|
||||
) {
|
||||
// current content of the default sticker pack, which is stored in account data under the key 'PoniesUserEmotes'
|
||||
const current =
|
||||
mx.getAccountData(AccountDataEvent.PoniesUserEmotes)?.getContent<PackContent>() ?? {};
|
||||
|
||||
// modified content with the new sticker added.
|
||||
// We add the new sticker under the "images" key, using the shortcode as the key for the sticker.
|
||||
// The sticker content includes the mxc URL, body, info, and usage (which we set to "sticker").
|
||||
const next: PackContent = {
|
||||
...current,
|
||||
images: {
|
||||
...(current.images ?? {}),
|
||||
[shortcode]: {
|
||||
...(current.images?.[shortcode] ?? {}),
|
||||
url: mxc,
|
||||
body,
|
||||
info,
|
||||
usage: [ImageUsage.Sticker],
|
||||
},
|
||||
},
|
||||
};
|
||||
|
||||
// update the account data with the modified content, which effectively adds the new sticker to the default sticker pack.
|
||||
await mx.setAccountData(AccountDataEvent.PoniesUserEmotes, next);
|
||||
}
|
||||
|
||||
// check if a sticker exists in the account sticker pack
|
||||
export function doesStickerExistInDefaultPack(mx: MatrixClient, mxc: string) {
|
||||
const imgs = mx
|
||||
.getAccountData(AccountDataEvent.PoniesUserEmotes)
|
||||
?.getContent<PackContent>().images;
|
||||
if (imgs === undefined) return false;
|
||||
return Object.values(imgs).some((image) => image.url === mxc) ?? false;
|
||||
}
|
||||
+17
-10
@@ -23,6 +23,7 @@ import { SlidingSyncConfig, SlidingSyncDiagnostics, SlidingSyncManager } from '.
|
||||
const log = createLogger('initMatrix');
|
||||
const slidingSyncByClient = new WeakMap<MatrixClient, SlidingSyncManager>();
|
||||
const FAST_SYNC_POLL_TIMEOUT_MS = 10000;
|
||||
const SLIDING_SYNC_POLL_TIMEOUT_MS = 20000;
|
||||
type SyncTransport = 'classic' | 'sliding';
|
||||
type SyncTransportReason =
|
||||
| 'sliding_active'
|
||||
@@ -340,6 +341,9 @@ export const stopClient = (mx: MatrixClient): void => {
|
||||
mx.stopClient();
|
||||
};
|
||||
|
||||
export const getSlidingSyncManager = (mx: MatrixClient): SlidingSyncManager | undefined =>
|
||||
slidingSyncByClient.get(mx);
|
||||
|
||||
export const startClient = async (mx: MatrixClient, config?: StartClientConfig) => {
|
||||
log.log('startClient', mx.getUserId());
|
||||
disposeSlidingSync(mx);
|
||||
@@ -419,16 +423,11 @@ export const startClient = async (mx: MatrixClient, config?: StartClientConfig)
|
||||
}
|
||||
|
||||
const resolvedProxyBaseUrl = proxyBaseUrl;
|
||||
const manager = new SlidingSyncManager(mx, resolvedProxyBaseUrl, {
|
||||
...(slidingConfig ?? {}),
|
||||
includeInviteList: true,
|
||||
pollTimeoutMs: slidingConfig?.pollTimeoutMs ?? FAST_SYNC_POLL_TIMEOUT_MS,
|
||||
});
|
||||
const supported = await SlidingSyncManager.probe(
|
||||
mx,
|
||||
resolvedProxyBaseUrl,
|
||||
manager.probeTimeoutMs
|
||||
);
|
||||
const probeTimeoutMs = (() => {
|
||||
const v = slidingConfig?.probeTimeoutMs;
|
||||
return typeof v === 'number' && !Number.isNaN(v) && v > 0 ? Math.round(v) : 5000;
|
||||
})();
|
||||
const supported = await SlidingSyncManager.probe(mx, resolvedProxyBaseUrl, probeTimeoutMs);
|
||||
log.log('startClient sliding probe result', {
|
||||
userId: mx.getUserId(),
|
||||
requestedEnabled: slidingRequested,
|
||||
@@ -442,7 +441,15 @@ export const startClient = async (mx: MatrixClient, config?: StartClientConfig)
|
||||
return;
|
||||
}
|
||||
|
||||
const manager = new SlidingSyncManager(mx, resolvedProxyBaseUrl, {
|
||||
...(slidingConfig ?? {}),
|
||||
includeInviteList: true,
|
||||
pollTimeoutMs: slidingConfig?.pollTimeoutMs ?? SLIDING_SYNC_POLL_TIMEOUT_MS,
|
||||
});
|
||||
manager.attach();
|
||||
// Begin background spidering so all rooms are eventually indexed.
|
||||
// Not awaited — this runs incrementally in the background.
|
||||
manager.startSpidering(100, 50);
|
||||
slidingSyncByClient.set(mx, manager);
|
||||
syncTransportByClient.set(mx, {
|
||||
transport: 'sliding',
|
||||
|
||||
+407
-119
@@ -1,29 +1,60 @@
|
||||
/* eslint-disable max-classes-per-file */
|
||||
import {
|
||||
ClientEvent,
|
||||
Extension,
|
||||
ExtensionState,
|
||||
MatrixClient,
|
||||
MSC3575List,
|
||||
MSC3575RoomSubscription,
|
||||
MSC3575_WILDCARD,
|
||||
SlidingSync,
|
||||
SlidingSyncEvent,
|
||||
SlidingSyncState,
|
||||
MSC3575_STATE_KEY_LAZY,
|
||||
MSC3575_STATE_KEY_ME,
|
||||
EventType,
|
||||
User,
|
||||
} from '$types/matrix-sdk';
|
||||
import { StateEvent } from '$types/matrix/room';
|
||||
import { createLogger } from '$utils/debug';
|
||||
|
||||
const log = createLogger('slidingSync');
|
||||
|
||||
const LIST_JOINED = 'joined';
|
||||
const LIST_INVITES = 'invites';
|
||||
export const LIST_JOINED = 'joined';
|
||||
export const LIST_INVITES = 'invites';
|
||||
export const LIST_DMS = 'dms';
|
||||
export const LIST_SEARCH = 'search';
|
||||
// Separate key for live room-name filtering; avoids conflicting with the spidering list.
|
||||
export const LIST_ROOM_SEARCH = 'room_search';
|
||||
// Dynamic list key used for space-scoped room views.
|
||||
export const LIST_SPACE = 'space';
|
||||
// One event of timeline per list room is enough to compute unread counts;
|
||||
// the full history is loaded when the user opens the room.
|
||||
const LIST_TIMELINE_LIMIT = 1;
|
||||
const DEFAULT_LIST_PAGE_SIZE = 250;
|
||||
const DEFAULT_TIMELINE_LIMIT = 30;
|
||||
const TIMELINE_LIMIT_LOW = 10;
|
||||
const TIMELINE_LIMIT_MEDIUM = 15;
|
||||
const TIMELINE_LIMIT_HIGH = 30;
|
||||
const DEFAULT_POLL_TIMEOUT_MS = 10000;
|
||||
const DEFAULT_POLL_TIMEOUT_MS = 20000;
|
||||
const DEFAULT_MAX_ROOMS = 5000;
|
||||
|
||||
// Sort order for MSC4186 (Simplified Sliding Sync): most recently active first,
|
||||
// then alphabetical as a tiebreaker. by_notification_level is MSC3575-only and
|
||||
// not supported by Synapse's native MSC4186 implementation.
|
||||
const LIST_SORT_ORDER = ['by_recency', 'by_name'];
|
||||
|
||||
// Subscription key for the room the user is actively viewing.
|
||||
// Encrypted rooms get [*,*] required_state; unencrypted rooms also request lazy members.
|
||||
const UNENCRYPTED_SUBSCRIPTION_KEY = 'unencrypted';
|
||||
// Adaptive timeline limits for the room the user is actively viewing.
|
||||
// Lower limits reduce initial bandwidth on constrained devices/connections;
|
||||
// the user can always paginate further once the room is open.
|
||||
const ACTIVE_ROOM_TIMELINE_LIMIT_LOW = 20;
|
||||
const ACTIVE_ROOM_TIMELINE_LIMIT_MEDIUM = 35;
|
||||
const ACTIVE_ROOM_TIMELINE_LIMIT_HIGH = 50;
|
||||
|
||||
export type PartialSlidingSyncRequest = {
|
||||
filters?: MSC3575List['filters'];
|
||||
sort?: string[];
|
||||
ranges?: [number, number][];
|
||||
};
|
||||
|
||||
export type SlidingSyncConfig = {
|
||||
enabled?: boolean;
|
||||
proxyBaseUrl?: string;
|
||||
@@ -42,20 +73,11 @@ export type SlidingSyncListDiagnostics = {
|
||||
rangeEnd: number;
|
||||
};
|
||||
|
||||
export type SlidingSyncDeviceDiagnostics = {
|
||||
saveData: boolean;
|
||||
effectiveType: string | null;
|
||||
deviceMemoryGb: number | null;
|
||||
mobile: boolean;
|
||||
missingSignals: number;
|
||||
};
|
||||
|
||||
export type SlidingSyncDiagnostics = {
|
||||
proxyBaseUrl: string;
|
||||
timelineLimit: number;
|
||||
listPageSize: number;
|
||||
adaptiveTimeline: boolean;
|
||||
device: SlidingSyncDeviceDiagnostics;
|
||||
listPageSize: number;
|
||||
lists: SlidingSyncListDiagnostics[];
|
||||
};
|
||||
|
||||
@@ -64,27 +86,30 @@ const clampPositive = (value: number | undefined, fallback: number): number => {
|
||||
return Math.round(value);
|
||||
};
|
||||
|
||||
type AdaptiveSignals = SlidingSyncDeviceDiagnostics;
|
||||
type AdaptiveSignals = {
|
||||
saveData: boolean;
|
||||
effectiveType: string | null;
|
||||
deviceMemoryGb: number | null;
|
||||
mobile: boolean;
|
||||
missingSignals: number;
|
||||
};
|
||||
|
||||
const readAdaptiveSignals = (): AdaptiveSignals => {
|
||||
const navigatorLike = typeof navigator !== 'undefined' ? navigator : undefined;
|
||||
const connection = (navigatorLike as any)?.connection;
|
||||
const effectiveType = connection?.effectiveType;
|
||||
const deviceMemory = (navigatorLike as any)?.deviceMemory;
|
||||
|
||||
const uaMobile = (navigatorLike as any)?.userAgentData?.mobile;
|
||||
const fallbackMobileUA = navigatorLike?.userAgent ?? '';
|
||||
const mobileByUA =
|
||||
typeof uaMobile === 'boolean'
|
||||
? uaMobile
|
||||
: /Mobi|Android|iPhone|iPad|iPod|IEMobile|Opera Mini/i.test(fallbackMobileUA);
|
||||
|
||||
const saveData = connection?.saveData === true;
|
||||
const normalizedEffectiveType = typeof effectiveType === 'string' ? effectiveType : null;
|
||||
const normalizedDeviceMemory = typeof deviceMemory === 'number' ? deviceMemory : null;
|
||||
const missingSignals =
|
||||
Number(normalizedEffectiveType === null) + Number(normalizedDeviceMemory === null);
|
||||
|
||||
return {
|
||||
saveData,
|
||||
effectiveType: normalizedEffectiveType,
|
||||
@@ -94,89 +119,117 @@ const readAdaptiveSignals = (): AdaptiveSignals => {
|
||||
};
|
||||
};
|
||||
|
||||
const resolveAdaptiveTimelineLimit = (
|
||||
// Resolve the timeline limit for the active-room subscription based on device/network.
|
||||
// The list subscription always uses LIST_TIMELINE_LIMIT=1 regardless of conditions.
|
||||
const resolveAdaptiveRoomTimelineLimit = (
|
||||
configuredLimit: number | undefined,
|
||||
pageSize: number,
|
||||
signals: AdaptiveSignals
|
||||
): number => {
|
||||
if (typeof configuredLimit === 'number' && configuredLimit > 0) {
|
||||
return clampPositive(configuredLimit, DEFAULT_TIMELINE_LIMIT);
|
||||
return clampPositive(configuredLimit, ACTIVE_ROOM_TIMELINE_LIMIT_HIGH);
|
||||
}
|
||||
|
||||
if (signals.saveData || signals.effectiveType === 'slow-2g' || signals.effectiveType === '2g') {
|
||||
return Math.min(pageSize, TIMELINE_LIMIT_LOW);
|
||||
return ACTIVE_ROOM_TIMELINE_LIMIT_LOW;
|
||||
}
|
||||
|
||||
if (
|
||||
signals.effectiveType === '3g' ||
|
||||
(signals.deviceMemoryGb !== null && signals.deviceMemoryGb <= 4)
|
||||
) {
|
||||
return Math.min(pageSize, TIMELINE_LIMIT_MEDIUM);
|
||||
return ACTIVE_ROOM_TIMELINE_LIMIT_MEDIUM;
|
||||
}
|
||||
|
||||
// Mobile PWAs/browsers often omit NetworkInformation and/or device memory APIs.
|
||||
// If any key adaptive signals are missing on mobile, pick a conservative medium limit.
|
||||
if (signals.mobile && signals.missingSignals > 0) {
|
||||
return Math.min(pageSize, TIMELINE_LIMIT_MEDIUM);
|
||||
return ACTIVE_ROOM_TIMELINE_LIMIT_MEDIUM;
|
||||
}
|
||||
|
||||
return Math.min(pageSize, TIMELINE_LIMIT_HIGH);
|
||||
return ACTIVE_ROOM_TIMELINE_LIMIT_HIGH;
|
||||
};
|
||||
|
||||
const buildDefaultSubscription = (timelineLimit: number): MSC3575RoomSubscription => ({
|
||||
// Minimal required_state for list entries; enough to render the room list sidebar,
|
||||
// compute unread state, and build the space hierarchy without fetching full room history.
|
||||
// Notes:
|
||||
// - RoomName/RoomCanonicalAlias are omitted: sliding sync returns the room name as a
|
||||
// top-level field in every list response, so fetching them as state events is redundant.
|
||||
// - MSC3575_STATE_KEY_LAZY is omitted: lazy-loading members is only needed when the
|
||||
// user is actively viewing a room; loading them for every list entry wastes bandwidth.
|
||||
// - SpaceChild with wildcard is required: the roomToParents atom reads m.space.child
|
||||
// state events (one per child, keyed by child room ID) to build the space hierarchy.
|
||||
// Without these events the SDK has no parent→child mapping, so all rooms appear as
|
||||
// orphans in the Home view and spaces appear empty.
|
||||
// - im.ponies.room_emotes with wildcard is required: custom emoji/sticker packs are
|
||||
// stored as im.ponies.room_emotes state events (one per pack, keyed by pack state key).
|
||||
// getGlobalImagePacks reads these from pack rooms listed in im.ponies.emote_rooms
|
||||
// account data; imagePackRooms also reads them from parent spaces. Without these
|
||||
// events all list-entry rooms would show no emoji or sticker packs.
|
||||
// - m.room.topic is required: topics are displayed for joined child rooms in space
|
||||
// lobby (RoomItem → LocalRoomSummaryLoader → useLocalRoomSummary) and in the
|
||||
// invite list. Without this event the topic always shows as blank for non-active
|
||||
// rooms.
|
||||
// - m.room.canonical_alias is required: getCanonicalAlias() is used in several places
|
||||
// for non-active rooms — notification serverName extraction, mention autocomplete
|
||||
// alias display, and getCanonicalAliasOrRoomId for navigation. Without it, aliases
|
||||
// fall back silently to room IDs.
|
||||
const buildListRequiredState = (): MSC3575RoomSubscription['required_state'] => [
|
||||
[EventType.RoomJoinRules, ''],
|
||||
[EventType.RoomAvatar, ''],
|
||||
[EventType.RoomTombstone, ''],
|
||||
[EventType.RoomEncryption, ''],
|
||||
[EventType.RoomCreate, ''],
|
||||
[EventType.RoomTopic, ''],
|
||||
[EventType.RoomCanonicalAlias, ''],
|
||||
[EventType.RoomMember, MSC3575_STATE_KEY_ME],
|
||||
['m.space.child', MSC3575_WILDCARD],
|
||||
['im.ponies.room_emotes', MSC3575_WILDCARD],
|
||||
];
|
||||
|
||||
// For an active encrypted room: fetch everything so the client can decrypt all events.
|
||||
const buildEncryptedSubscription = (timelineLimit: number): MSC3575RoomSubscription => ({
|
||||
timeline_limit: timelineLimit,
|
||||
required_state: [[MSC3575_WILDCARD, MSC3575_WILDCARD]],
|
||||
});
|
||||
|
||||
// For an active unencrypted room: fetch everything, plus explicit lazy+ME members so
|
||||
// the member list and display names are always available.
|
||||
const buildUnencryptedSubscription = (timelineLimit: number): MSC3575RoomSubscription => ({
|
||||
timeline_limit: timelineLimit,
|
||||
required_state: [
|
||||
[MSC3575_WILDCARD, MSC3575_WILDCARD],
|
||||
[EventType.RoomMember, MSC3575_STATE_KEY_ME],
|
||||
[EventType.RoomMember, MSC3575_STATE_KEY_LAZY],
|
||||
[EventType.RoomCreate, ''],
|
||||
[EventType.RoomName, ''],
|
||||
[EventType.RoomAvatar, ''],
|
||||
[EventType.RoomCanonicalAlias, ''],
|
||||
[EventType.RoomEncryption, ''],
|
||||
[EventType.RoomTombstone, ''],
|
||||
[EventType.RoomJoinRules, ''],
|
||||
[EventType.RoomHistoryVisibility, ''],
|
||||
[EventType.RoomPowerLevels, ''],
|
||||
[StateEvent.PoniesRoomEmotes, '*'],
|
||||
[StateEvent.RoomWidget, '*'],
|
||||
[StateEvent.GroupCallPrefix, '*'],
|
||||
[EventType.SpaceChild, '*'],
|
||||
[EventType.SpaceParent, '*'],
|
||||
[StateEvent.RoomCosmeticsColor, '*'],
|
||||
[StateEvent.RoomCosmeticsFont, '*'],
|
||||
[StateEvent.RoomCosmeticsPronouns, '*'],
|
||||
],
|
||||
});
|
||||
|
||||
const buildLists = (
|
||||
pageSize: number,
|
||||
timelineLimit: number,
|
||||
includeInviteList: boolean,
|
||||
requiredState: MSC3575RoomSubscription['required_state']
|
||||
): Map<string, MSC3575List> => {
|
||||
const buildLists = (pageSize: number, includeInviteList: boolean): Map<string, MSC3575List> => {
|
||||
const lists = new Map<string, MSC3575List>();
|
||||
const listRequiredState = buildListRequiredState();
|
||||
|
||||
lists.set(LIST_JOINED, {
|
||||
ranges: [[0, Math.max(0, pageSize - 1)]],
|
||||
timeline_limit: timelineLimit,
|
||||
required_state: requiredState,
|
||||
sort: LIST_SORT_ORDER,
|
||||
timeline_limit: LIST_TIMELINE_LIMIT,
|
||||
required_state: listRequiredState,
|
||||
slow_get_all_rooms: true,
|
||||
filters: {
|
||||
is_invite: false,
|
||||
},
|
||||
filters: { is_invite: false },
|
||||
});
|
||||
|
||||
if (includeInviteList) {
|
||||
lists.set(LIST_INVITES, {
|
||||
ranges: [[0, Math.max(0, pageSize - 1)]],
|
||||
timeline_limit: timelineLimit,
|
||||
required_state: requiredState,
|
||||
sort: LIST_SORT_ORDER,
|
||||
timeline_limit: LIST_TIMELINE_LIMIT,
|
||||
required_state: listRequiredState,
|
||||
slow_get_all_rooms: true,
|
||||
filters: {
|
||||
is_invite: true,
|
||||
},
|
||||
filters: { is_invite: true },
|
||||
});
|
||||
}
|
||||
|
||||
lists.set(LIST_DMS, {
|
||||
ranges: [[0, Math.max(0, pageSize - 1)]],
|
||||
sort: LIST_SORT_ORDER,
|
||||
timeline_limit: LIST_TIMELINE_LIMIT,
|
||||
required_state: listRequiredState,
|
||||
slow_get_all_rooms: true,
|
||||
filters: { is_dm: true },
|
||||
});
|
||||
|
||||
return lists;
|
||||
};
|
||||
|
||||
@@ -185,6 +238,53 @@ const getListEndIndex = (list: MSC3575List | null): number => {
|
||||
return list.ranges.reduce((max, range) => Math.max(max, range[1] ?? -1), -1);
|
||||
};
|
||||
|
||||
// MSC4186 presence extension: requests `extensions.presence` in every sliding sync
|
||||
// poll and feeds received `m.presence` events into the SDK's User objects so that
|
||||
// components using `useUserPresence` see live updates (same path as regular /sync).
|
||||
class ExtensionPresence implements Extension<{ enabled: boolean }, { events?: object[] }> {
|
||||
private enabled = true;
|
||||
|
||||
public constructor(private readonly mx: MatrixClient) {}
|
||||
|
||||
public setEnabled(value: boolean): void {
|
||||
this.enabled = value;
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
public name(): string {
|
||||
return 'presence';
|
||||
}
|
||||
|
||||
// eslint-disable-next-line class-methods-use-this
|
||||
public when(): ExtensionState {
|
||||
// Run after the main response body has been processed so room/member state is ready.
|
||||
return ExtensionState.PostProcess;
|
||||
}
|
||||
|
||||
public async onRequest(): Promise<{ enabled: boolean }> {
|
||||
return { enabled: this.enabled };
|
||||
}
|
||||
|
||||
public async onResponse(data: { events?: object[] }): Promise<void> {
|
||||
if (!data?.events?.length) return;
|
||||
const mapper = this.mx.getEventMapper();
|
||||
data.events.forEach((rawEvent) => {
|
||||
const event = mapper(rawEvent as Parameters<typeof mapper>[0]);
|
||||
const userId = event.getSender() ?? (event.getContent().user_id as string | undefined);
|
||||
if (!userId) return;
|
||||
let user = this.mx.store.getUser(userId);
|
||||
if (user) {
|
||||
user.setPresenceEvent(event);
|
||||
} else {
|
||||
user = User.createUser(userId, this.mx);
|
||||
user.setPresenceEvent(event);
|
||||
this.mx.store.storeUser(user);
|
||||
}
|
||||
this.mx.emit(ClientEvent.Event, event);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export class SlidingSyncManager {
|
||||
private disposed = false;
|
||||
|
||||
@@ -192,13 +292,13 @@ export class SlidingSyncManager {
|
||||
|
||||
private readonly listKeys: string[];
|
||||
|
||||
private timelineLimit: number;
|
||||
private readonly activeRoomSubscriptions = new Set<string>();
|
||||
|
||||
private readonly listPageSize: number;
|
||||
|
||||
private readonly adaptiveTimeline: boolean;
|
||||
private roomTimelineLimit: number;
|
||||
|
||||
private deviceDiagnostics: SlidingSyncDeviceDiagnostics;
|
||||
private readonly adaptiveTimeline: boolean;
|
||||
|
||||
private readonly configuredTimelineLimit?: number;
|
||||
|
||||
@@ -206,6 +306,8 @@ export class SlidingSyncManager {
|
||||
|
||||
private readonly onLifecycle: (state: SlidingSyncState, resp: unknown, err?: Error) => void;
|
||||
|
||||
private presenceExtension!: ExtensionPresence;
|
||||
|
||||
public readonly slidingSync: SlidingSync;
|
||||
|
||||
public readonly probeTimeoutMs: number;
|
||||
@@ -216,30 +318,37 @@ export class SlidingSyncManager {
|
||||
config: SlidingSyncConfig
|
||||
) {
|
||||
const listPageSize = clampPositive(config.listPageSize, DEFAULT_LIST_PAGE_SIZE);
|
||||
const pollTimeoutMs = clampPositive(config.pollTimeoutMs, DEFAULT_POLL_TIMEOUT_MS);
|
||||
this.probeTimeoutMs = clampPositive(config.probeTimeoutMs, 5000);
|
||||
this.maxRooms = clampPositive(config.maxRooms, DEFAULT_MAX_ROOMS);
|
||||
this.listPageSize = listPageSize;
|
||||
const includeInviteList = config.includeInviteList !== false;
|
||||
|
||||
const adaptiveTimeline = !(
|
||||
typeof config.timelineLimit === 'number' && config.timelineLimit > 0
|
||||
);
|
||||
const signals = readAdaptiveSignals();
|
||||
const timelineLimit = resolveAdaptiveTimelineLimit(config.timelineLimit, listPageSize, signals);
|
||||
const pollTimeoutMs = clampPositive(config.pollTimeoutMs, DEFAULT_POLL_TIMEOUT_MS);
|
||||
this.probeTimeoutMs = clampPositive(config.probeTimeoutMs, 5000);
|
||||
this.maxRooms = clampPositive(config.maxRooms, DEFAULT_MAX_ROOMS);
|
||||
this.timelineLimit = timelineLimit;
|
||||
this.listPageSize = listPageSize;
|
||||
const roomTimelineLimit = resolveAdaptiveRoomTimelineLimit(config.timelineLimit, signals);
|
||||
this.adaptiveTimeline = adaptiveTimeline;
|
||||
this.deviceDiagnostics = signals;
|
||||
this.roomTimelineLimit = roomTimelineLimit;
|
||||
this.configuredTimelineLimit = config.timelineLimit;
|
||||
const includeInviteList = config.includeInviteList !== false;
|
||||
|
||||
const subscription = buildDefaultSubscription(timelineLimit);
|
||||
const lists = buildLists(
|
||||
listPageSize,
|
||||
timelineLimit,
|
||||
includeInviteList,
|
||||
subscription.required_state
|
||||
);
|
||||
const defaultSubscription = buildEncryptedSubscription(roomTimelineLimit);
|
||||
const lists = buildLists(listPageSize, includeInviteList);
|
||||
this.listKeys = Array.from(lists.keys());
|
||||
this.slidingSync = new SlidingSync(proxyBaseUrl, lists, subscription, mx, pollTimeoutMs);
|
||||
this.slidingSync = new SlidingSync(proxyBaseUrl, lists, defaultSubscription, mx, pollTimeoutMs);
|
||||
|
||||
// Register the presence extension so m.presence events from the server are fed
|
||||
// into the SDK's User objects, keeping useUserPresence accurate during sliding sync.
|
||||
this.presenceExtension = new ExtensionPresence(mx);
|
||||
this.slidingSync.registerExtension(this.presenceExtension);
|
||||
|
||||
// Register a custom subscription for unencrypted active rooms; encrypted rooms use
|
||||
// the default subscription (which already has [*,*]).
|
||||
this.slidingSync.addCustomSubscription(
|
||||
UNENCRYPTED_SUBSCRIPTION_KEY,
|
||||
buildUnencryptedSubscription(roomTimelineLimit)
|
||||
);
|
||||
|
||||
this.onLifecycle = (state, resp, err) => {
|
||||
if (this.disposed || err || !resp || state !== SlidingSyncState.Complete) return;
|
||||
@@ -248,18 +357,15 @@ export class SlidingSyncManager {
|
||||
|
||||
this.onConnectionChange = () => {
|
||||
if (this.disposed || !this.adaptiveTimeline) return;
|
||||
const currentSignals = readAdaptiveSignals();
|
||||
this.deviceDiagnostics = currentSignals;
|
||||
const nextTimelineLimit = resolveAdaptiveTimelineLimit(
|
||||
const nextLimit = resolveAdaptiveRoomTimelineLimit(
|
||||
this.configuredTimelineLimit,
|
||||
this.listPageSize,
|
||||
currentSignals
|
||||
readAdaptiveSignals()
|
||||
);
|
||||
if (nextTimelineLimit === this.timelineLimit) return;
|
||||
this.timelineLimit = nextTimelineLimit;
|
||||
this.applyTimelineLimit(nextTimelineLimit);
|
||||
if (nextLimit === this.roomTimelineLimit) return;
|
||||
this.roomTimelineLimit = nextLimit;
|
||||
this.applyRoomTimelineLimit(nextLimit);
|
||||
log.log(
|
||||
`Sliding Sync adaptive timeline updated to ${nextTimelineLimit} for ${this.mx.getUserId()}`
|
||||
`Sliding Sync adaptive room timeline updated to ${nextLimit} for ${this.mx.getUserId()}`
|
||||
);
|
||||
};
|
||||
}
|
||||
@@ -270,15 +376,13 @@ export class SlidingSyncManager {
|
||||
typeof navigator !== 'undefined' ? (navigator as any).connection : undefined
|
||||
) as
|
||||
| {
|
||||
addEventListener?: (event: string, cb: () => void) => void;
|
||||
removeEventListener?: (event: string, cb: () => void) => void;
|
||||
addEventListener?: (e: string, cb: () => void) => void;
|
||||
removeEventListener?: (e: string, cb: () => void) => void;
|
||||
onchange?: (() => void) | null;
|
||||
}
|
||||
| undefined;
|
||||
connection?.addEventListener?.('change', this.onConnectionChange);
|
||||
if (connection && connection.onchange === null) {
|
||||
connection.onchange = this.onConnectionChange;
|
||||
}
|
||||
if (connection && connection.onchange === null) connection.onchange = this.onConnectionChange;
|
||||
if (typeof window !== 'undefined') {
|
||||
window.addEventListener('online', this.onConnectionChange);
|
||||
window.addEventListener('offline', this.onConnectionChange);
|
||||
@@ -293,28 +397,37 @@ export class SlidingSyncManager {
|
||||
typeof navigator !== 'undefined' ? (navigator as any).connection : undefined
|
||||
) as
|
||||
| {
|
||||
addEventListener?: (event: string, cb: () => void) => void;
|
||||
removeEventListener?: (event: string, cb: () => void) => void;
|
||||
addEventListener?: (e: string, cb: () => void) => void;
|
||||
removeEventListener?: (e: string, cb: () => void) => void;
|
||||
onchange?: (() => void) | null;
|
||||
}
|
||||
| undefined;
|
||||
connection?.removeEventListener?.('change', this.onConnectionChange);
|
||||
if (connection?.onchange === this.onConnectionChange) {
|
||||
connection.onchange = null;
|
||||
}
|
||||
if (connection?.onchange === this.onConnectionChange) connection.onchange = null;
|
||||
if (typeof window !== 'undefined') {
|
||||
window.removeEventListener('online', this.onConnectionChange);
|
||||
window.removeEventListener('offline', this.onConnectionChange);
|
||||
}
|
||||
}
|
||||
|
||||
private applyRoomTimelineLimit(timelineLimit: number): void {
|
||||
this.slidingSync.modifyRoomSubscriptionInfo(buildEncryptedSubscription(timelineLimit));
|
||||
this.slidingSync.addCustomSubscription(
|
||||
UNENCRYPTED_SUBSCRIPTION_KEY,
|
||||
buildUnencryptedSubscription(timelineLimit)
|
||||
);
|
||||
}
|
||||
|
||||
public setPresenceEnabled(enabled: boolean): void {
|
||||
this.presenceExtension.setEnabled(enabled);
|
||||
}
|
||||
|
||||
public getDiagnostics(): SlidingSyncDiagnostics {
|
||||
return {
|
||||
proxyBaseUrl: this.proxyBaseUrl,
|
||||
timelineLimit: this.timelineLimit,
|
||||
listPageSize: this.listPageSize,
|
||||
timelineLimit: this.roomTimelineLimit,
|
||||
adaptiveTimeline: this.adaptiveTimeline,
|
||||
device: this.deviceDiagnostics,
|
||||
listPageSize: this.listPageSize,
|
||||
lists: this.listKeys.map((key) => {
|
||||
const listData = this.slidingSync.getListData(key);
|
||||
const params = this.slidingSync.getListParams(key);
|
||||
@@ -347,16 +460,191 @@ export class SlidingSyncManager {
|
||||
});
|
||||
}
|
||||
|
||||
private applyTimelineLimit(timelineLimit: number): void {
|
||||
this.slidingSync.modifyRoomSubscriptionInfo(buildDefaultSubscription(timelineLimit));
|
||||
this.listKeys.forEach((key) => {
|
||||
const existing = this.slidingSync.getListParams(key);
|
||||
if (!existing) return;
|
||||
this.slidingSync.setList(key, {
|
||||
...existing,
|
||||
timeline_limit: timelineLimit,
|
||||
});
|
||||
/**
|
||||
* Ensure a dynamic list is registered (or updated) on the sliding sync session.
|
||||
* If the list does not yet exist it is created with sensible defaults merged with
|
||||
* `updateArgs`. If it already exists and the merged result differs, only the ranges
|
||||
* are updated (cheaper — avoids resending sticky params) when `updateArgs` only
|
||||
* contains `ranges`; otherwise the full list is replaced.
|
||||
*
|
||||
* This mirrors Element Web's `SlidingSyncManager.ensureListRegistered`.
|
||||
*/
|
||||
public ensureListRegistered(listKey: string, updateArgs: PartialSlidingSyncRequest): MSC3575List {
|
||||
let list = this.slidingSync.getListParams(listKey);
|
||||
if (!list) {
|
||||
list = {
|
||||
ranges: [[0, 20]],
|
||||
sort: LIST_SORT_ORDER,
|
||||
timeline_limit: LIST_TIMELINE_LIMIT,
|
||||
required_state: buildListRequiredState(),
|
||||
...updateArgs,
|
||||
};
|
||||
} else {
|
||||
const updated = { ...list, ...updateArgs };
|
||||
if (JSON.stringify(list) === JSON.stringify(updated)) return list;
|
||||
list = updated;
|
||||
}
|
||||
|
||||
try {
|
||||
if (updateArgs.ranges && Object.keys(updateArgs).length === 1) {
|
||||
this.slidingSync.setListRanges(listKey, updateArgs.ranges);
|
||||
} else {
|
||||
this.slidingSync.setList(listKey, list);
|
||||
}
|
||||
} catch {
|
||||
// ignore — the list will be re-sent on the next sync cycle
|
||||
}
|
||||
return this.slidingSync.getListParams(listKey) ?? list;
|
||||
}
|
||||
|
||||
/**
|
||||
* Spider through all rooms by incrementally expanding the search list, matching
|
||||
* Element Web's `startSpidering` behaviour. Called once after `attach()` and runs
|
||||
* in the background; callers must not await it.
|
||||
*
|
||||
* The first request uses `setList` to register the list with its full config;
|
||||
* subsequent page advances use the cheaper `setListRanges` (sticky params are
|
||||
* not resent). A gap sleep is applied before the first request and after each
|
||||
* subsequent one to avoid hammering the proxy at startup.
|
||||
*/
|
||||
public async startSpidering(batchSize: number, gapBetweenRequestsMs: number): Promise<void> {
|
||||
// Delay before the first request — startSpidering is called right after attach(),
|
||||
// so give the initial sync a moment to settle first.
|
||||
await new Promise<void>((res) => {
|
||||
setTimeout(res, gapBetweenRequestsMs);
|
||||
});
|
||||
if (this.disposed) return;
|
||||
|
||||
// Use a single expanding range [[0, endIndex]] rather than a two-range sliding
|
||||
// window. Synapse's extension handler asserts len(actual_list.ops) == 1, which
|
||||
// fails when the response contains multiple ops (one per range). A single range
|
||||
// always produces a single SYNC op, avoiding the assertion.
|
||||
let endIndex = batchSize - 1;
|
||||
let hasMore = true;
|
||||
let firstTime = true;
|
||||
|
||||
const spideringRequiredState: MSC3575List['required_state'] = [
|
||||
[EventType.RoomJoinRules, ''],
|
||||
[EventType.RoomAvatar, ''],
|
||||
[EventType.RoomTombstone, ''],
|
||||
[EventType.RoomEncryption, ''],
|
||||
[EventType.RoomCreate, ''],
|
||||
[EventType.RoomTopic, ''],
|
||||
[EventType.RoomCanonicalAlias, ''],
|
||||
[EventType.RoomMember, MSC3575_STATE_KEY_ME],
|
||||
['m.space.child', MSC3575_WILDCARD],
|
||||
['im.ponies.room_emotes', MSC3575_WILDCARD],
|
||||
];
|
||||
|
||||
while (hasMore) {
|
||||
if (this.disposed) return;
|
||||
const ranges: [number, number][] = [[0, endIndex]];
|
||||
try {
|
||||
if (firstTime) {
|
||||
// Full setList on first call to register the list with all params.
|
||||
this.slidingSync.setList(LIST_SEARCH, {
|
||||
ranges,
|
||||
sort: ['by_recency'],
|
||||
timeline_limit: 0,
|
||||
required_state: spideringRequiredState,
|
||||
});
|
||||
} else {
|
||||
// Cheaper range-only update for subsequent pages; sticky params are preserved.
|
||||
this.slidingSync.setListRanges(LIST_SEARCH, ranges);
|
||||
}
|
||||
} catch {
|
||||
// Swallow errors — the next iteration will retry with updated ranges.
|
||||
} finally {
|
||||
// eslint-disable-next-line no-await-in-loop
|
||||
await new Promise<void>((res) => {
|
||||
setTimeout(res, gapBetweenRequestsMs);
|
||||
});
|
||||
}
|
||||
|
||||
if (this.disposed) return;
|
||||
const listData = this.slidingSync.getListData(LIST_SEARCH);
|
||||
hasMore = endIndex + 1 < (listData?.joinedCount ?? 0);
|
||||
endIndex += batchSize;
|
||||
firstTime = false;
|
||||
}
|
||||
log.log(`Sliding Sync spidering complete for ${this.mx.getUserId()}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Enable or disable server-side room name filtering.
|
||||
* When `query` is a non-empty string, registers (or updates) a dedicated
|
||||
* `room_search` list that uses the MSC4186 `room_name_like` filter so the
|
||||
* server returns only rooms whose name matches the query. When `query` is
|
||||
* null or empty the list is reset to an unfiltered minimal range — callers
|
||||
* should hide/ignore the list results in that case.
|
||||
* This is a no-op after dispose().
|
||||
*/
|
||||
public setRoomNameSearch(query: string | null): void {
|
||||
if (this.disposed) return;
|
||||
const trimmed = query?.trim() ?? '';
|
||||
const filters: MSC3575List['filters'] = trimmed ? { room_name_like: trimmed } : {};
|
||||
this.ensureListRegistered(LIST_ROOM_SEARCH, {
|
||||
filters,
|
||||
ranges: [[0, 19]],
|
||||
sort: LIST_SORT_ORDER,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate or clear a space-scoped room list.
|
||||
* When `spaceId` is provided, registers (or updates) a dedicated `space`
|
||||
* list filtered to rooms that are children of that space, returning the
|
||||
* first page sorted by recency. This supplements the main `joined` list
|
||||
* rather than replacing it, so background sync of all rooms is unaffected.
|
||||
* Pass `null` to deactivate the space list (collapses range to 0–0).
|
||||
* This is a no-op after dispose().
|
||||
*/
|
||||
public setSpaceScope(spaceId: string | null): void {
|
||||
if (this.disposed) return;
|
||||
const filters: MSC3575List['filters'] = spaceId
|
||||
? { is_invite: false, spaces: [spaceId] }
|
||||
: { is_invite: false };
|
||||
this.ensureListRegistered(LIST_SPACE, {
|
||||
filters,
|
||||
ranges: spaceId ? [[0, Math.min(this.listPageSize - 1, 499)]] : [[0, 0]],
|
||||
sort: LIST_SORT_ORDER,
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Subscribe to a room with the appropriate active-room subscription.
|
||||
* Encrypted rooms use the default subscription ([*,*]); unencrypted rooms use a
|
||||
* custom subscription that also requests lazy members.
|
||||
* If the room is not yet known to the SDK (e.g. navigating directly to a room URL
|
||||
* before the list has synced it), we default to the encrypted subscription — it is
|
||||
* always safe to over-request state.
|
||||
* Safe to call when already subscribed — the SDK deduplicates.
|
||||
* This is a no-op after dispose().
|
||||
*/
|
||||
public subscribeToRoom(roomId: string): void {
|
||||
if (this.disposed) return;
|
||||
const room = this.mx.getRoom(roomId);
|
||||
if (room && !this.mx.isRoomEncrypted(roomId)) {
|
||||
// Only use the unencrypted (lazy-load) subscription when we are certain
|
||||
// the room is unencrypted. Unknown rooms fall through to the safer
|
||||
// encrypted default.
|
||||
this.slidingSync.useCustomSubscription(roomId, UNENCRYPTED_SUBSCRIPTION_KEY);
|
||||
}
|
||||
this.activeRoomSubscriptions.add(roomId);
|
||||
this.slidingSync.modifyRoomSubscriptions(new Set(this.activeRoomSubscriptions));
|
||||
log.log(`Sliding Sync active room subscription added: ${roomId}`);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the explicit room subscription for a room.
|
||||
* Rooms that are still in a list will continue to receive background updates.
|
||||
* This is a no-op after dispose().
|
||||
*/
|
||||
public unsubscribeFromRoom(roomId: string): void {
|
||||
if (this.disposed) return;
|
||||
this.activeRoomSubscriptions.delete(roomId);
|
||||
this.slidingSync.modifyRoomSubscriptions(new Set(this.activeRoomSubscriptions));
|
||||
log.log(`Sliding Sync active room subscription removed: ${roomId}`);
|
||||
}
|
||||
|
||||
public static async probe(
|
||||
|
||||
@@ -16,7 +16,6 @@ let showMessageContent = false;
|
||||
let showEncryptedMessageContent = false;
|
||||
let clearNotificationsOnRead = false;
|
||||
const { handlePushNotificationPushData } = createPushNotifications(self, () => ({
|
||||
notificationSoundEnabled,
|
||||
showMessageContent,
|
||||
showEncryptedMessageContent,
|
||||
}));
|
||||
|
||||
@@ -7,7 +7,6 @@ import {
|
||||
} from '../app/utils/notificationStyle';
|
||||
|
||||
type NotificationSettings = {
|
||||
notificationSoundEnabled: boolean;
|
||||
showMessageContent: boolean;
|
||||
showEncryptedMessageContent: boolean;
|
||||
};
|
||||
@@ -16,13 +15,10 @@ export const createPushNotifications = (
|
||||
self: ServiceWorkerGlobalScope,
|
||||
getNotificationSettings: () => NotificationSettings
|
||||
) => {
|
||||
const resolveSilent = (silent: unknown, tweakSound?: unknown): boolean => {
|
||||
if (typeof silent === 'boolean') return silent;
|
||||
// If the push rule doesn't request a sound tweak, the notification should be silent
|
||||
// (no sound), regardless of the user's global sound preference.
|
||||
if (!tweakSound) return true;
|
||||
return !getNotificationSettings().notificationSoundEnabled;
|
||||
};
|
||||
// Push notification sound is always controlled by the OS/device settings.
|
||||
// We never explicitly silence push notifications — the user's device notification
|
||||
// preferences (volume, Do Not Disturb, per-app settings) handle that instead.
|
||||
const resolveSilent = (): boolean => false;
|
||||
|
||||
const showNotificationWithData = async (
|
||||
title: string,
|
||||
@@ -73,7 +69,7 @@ export const createPushNotifications = (
|
||||
showMessageContent: getNotificationSettings().showMessageContent,
|
||||
showEncryptedMessageContent: getNotificationSettings().showEncryptedMessageContent,
|
||||
}),
|
||||
silent: resolveSilent(pushData?.silent, pushData?.tweaks?.sound),
|
||||
silent: resolveSilent(),
|
||||
eventId: pushData?.event_id,
|
||||
recipientId: typeof pushData?.user_id === 'string' ? pushData.user_id : undefined,
|
||||
data,
|
||||
@@ -108,7 +104,7 @@ export const createPushNotifications = (
|
||||
showMessageContent: getNotificationSettings().showMessageContent,
|
||||
showEncryptedMessageContent: getNotificationSettings().showEncryptedMessageContent,
|
||||
}),
|
||||
silent: resolveSilent(pushData?.silent, pushData?.tweaks?.sound),
|
||||
silent: resolveSilent(),
|
||||
eventId: pushData?.event_id,
|
||||
recipientId: typeof pushData?.user_id === 'string' ? pushData.user_id : undefined,
|
||||
data,
|
||||
@@ -141,7 +137,7 @@ export const createPushNotifications = (
|
||||
...pushData.data,
|
||||
};
|
||||
|
||||
await showNotificationWithData('New Invitation', body, data, resolveSilent(pushData?.silent));
|
||||
await showNotificationWithData('New Invitation', body, data, resolveSilent());
|
||||
};
|
||||
|
||||
const handlePushNotificationPushData = async (pushData: any) => {
|
||||
|
||||
Reference in new issue
Block a user