mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 14:40:58 -05:00
Fix blocked users appearing in typing indicator.
Make typing indicator time out.
This commit is contained in:
parent
76478f67be
commit
8872ed56b1
5 changed files with 102 additions and 93 deletions
|
@ -97,7 +97,7 @@
|
|||
"react-router-dom": "^5.2.0",
|
||||
"react-scroll": "^1.8.2",
|
||||
"redux": "^4.1.0",
|
||||
"revolt.js": "5.0.0-alpha.17",
|
||||
"revolt.js": "5.0.0-alpha.18",
|
||||
"rimraf": "^3.0.2",
|
||||
"sass": "^1.35.1",
|
||||
"shade-blend-color": "^1.0.0",
|
||||
|
|
|
@ -323,7 +323,7 @@ export default observer(({ channel }: Props) => {
|
|||
|
||||
const ws = client.websocket;
|
||||
if (ws.connected) {
|
||||
setTyping(+new Date() + 4000);
|
||||
setTyping(+new Date() + 2500);
|
||||
ws.send({
|
||||
type: "BeginTyping",
|
||||
channel: channel._id,
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
import { observer } from "mobx-react-lite";
|
||||
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||
import { Channel } from "revolt.js/dist/maps/Channels";
|
||||
import styled from "styled-components";
|
||||
|
||||
|
@ -57,7 +58,10 @@ const Base = styled.div`
|
|||
|
||||
export default observer(({ channel }: Props) => {
|
||||
const users = channel.typing.filter(
|
||||
(x) => typeof x !== "undefined" && x._id !== x.client.user!._id,
|
||||
(x) =>
|
||||
typeof x !== "undefined" &&
|
||||
x._id !== x.client.user!._id &&
|
||||
x.relationship !== RelationshipStatus.Blocked,
|
||||
);
|
||||
|
||||
if (users.length > 0) {
|
||||
|
|
177
vite.config.ts
177
vite.config.ts
|
@ -1,103 +1,108 @@
|
|||
import { resolve } from 'path'
|
||||
import { readFileSync } from 'fs'
|
||||
import { defineConfig } from 'vite'
|
||||
import preact from '@preact/preset-vite'
|
||||
import { VitePWA } from 'vite-plugin-pwa'
|
||||
import replace from '@rollup/plugin-replace'
|
||||
import replace from "@rollup/plugin-replace";
|
||||
import { readFileSync } from "fs";
|
||||
import { resolve } from "path";
|
||||
import { defineConfig } from "vite";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
import preact from "@preact/preset-vite";
|
||||
|
||||
function getGitRevision() {
|
||||
try {
|
||||
const rev = readFileSync('.git/HEAD').toString().trim();
|
||||
if (rev.indexOf(':') === -1) {
|
||||
return rev;
|
||||
} else {
|
||||
return readFileSync('.git/' + rev.substring(5)).toString().trim();
|
||||
try {
|
||||
const rev = readFileSync(".git/HEAD").toString().trim();
|
||||
if (rev.indexOf(":") === -1) {
|
||||
return rev;
|
||||
} else {
|
||||
return readFileSync(".git/" + rev.substring(5))
|
||||
.toString()
|
||||
.trim();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to get Git revision.");
|
||||
return "?";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to get Git revision.');
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
function getGitBranch() {
|
||||
try {
|
||||
const rev = readFileSync('.git/HEAD').toString().trim();
|
||||
if (rev.indexOf(':') === -1) {
|
||||
return 'DETACHED';
|
||||
} else {
|
||||
return rev.split('/').pop();
|
||||
try {
|
||||
const rev = readFileSync(".git/HEAD").toString().trim();
|
||||
if (rev.indexOf(":") === -1) {
|
||||
return "DETACHED";
|
||||
} else {
|
||||
return rev.split("/").pop();
|
||||
}
|
||||
} catch (err) {
|
||||
console.error("Failed to get Git branch.");
|
||||
return "?";
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to get Git branch.');
|
||||
return '?';
|
||||
}
|
||||
}
|
||||
|
||||
function getVersion() {
|
||||
return readFileSync('VERSION').toString();
|
||||
return readFileSync("VERSION").toString();
|
||||
}
|
||||
|
||||
const branch = getGitBranch();
|
||||
const isNightly = false;//branch !== 'production';
|
||||
const iconPrefix = isNightly ? 'nightly-' : '';
|
||||
const isNightly = false; //branch !== 'production';
|
||||
const iconPrefix = isNightly ? "nightly-" : "";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [
|
||||
preact(),
|
||||
VitePWA({
|
||||
srcDir: 'src',
|
||||
filename: 'sw.ts',
|
||||
strategies: 'injectManifest',
|
||||
manifest: {
|
||||
name: isNightly ? "Revolt Nightly" : "Revolt",
|
||||
short_name: "Revolt",
|
||||
description: isNightly ? "Early preview builds of Revolt." : "User-first, privacy-focused chat platform.",
|
||||
categories: ["messaging"],
|
||||
start_url: "/",
|
||||
orientation: "portrait",
|
||||
display: "standalone",
|
||||
background_color: "#101823",
|
||||
theme_color: "#101823",
|
||||
icons: [
|
||||
{
|
||||
"src": `/assets/icons/${iconPrefix}android-chrome-192x192.png`,
|
||||
"type": "image/png",
|
||||
"sizes": "192x192"
|
||||
plugins: [
|
||||
preact(),
|
||||
VitePWA({
|
||||
srcDir: "src",
|
||||
filename: "sw.ts",
|
||||
strategies: "injectManifest",
|
||||
manifest: {
|
||||
name: isNightly ? "Revolt Nightly" : "Revolt",
|
||||
short_name: "Revolt",
|
||||
description: isNightly
|
||||
? "Early preview builds of Revolt."
|
||||
: "User-first, privacy-focused chat platform.",
|
||||
categories: ["messaging"],
|
||||
start_url: "/",
|
||||
orientation: "portrait",
|
||||
display: "standalone",
|
||||
background_color: "#101823",
|
||||
theme_color: "#101823",
|
||||
icons: [
|
||||
{
|
||||
src: `/assets/icons/${iconPrefix}android-chrome-192x192.png`,
|
||||
type: "image/png",
|
||||
sizes: "192x192",
|
||||
},
|
||||
{
|
||||
src: `/assets/icons/${iconPrefix}android-chrome-512x512.png`,
|
||||
type: "image/png",
|
||||
sizes: "512x512",
|
||||
},
|
||||
{
|
||||
src: `/assets/icons/monochrome.svg`,
|
||||
type: "image/svg+xml",
|
||||
sizes: "48x48 72x72 96x96 128x128 256x256",
|
||||
purpose: "monochrome",
|
||||
},
|
||||
{
|
||||
src: `/assets/icons/masking-512x512.png`,
|
||||
type: "image/png",
|
||||
sizes: "512x512",
|
||||
purpose: "maskable",
|
||||
},
|
||||
],
|
||||
},
|
||||
{
|
||||
"src": `/assets/icons/${iconPrefix}android-chrome-512x512.png`,
|
||||
"type": "image/png",
|
||||
"sizes": "512x512"
|
||||
}),
|
||||
replace({
|
||||
__GIT_REVISION__: getGitRevision(),
|
||||
__GIT_BRANCH__: getGitBranch(),
|
||||
__APP_VERSION__: getVersion(),
|
||||
preventAssignment: true,
|
||||
}),
|
||||
],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, "index.html"),
|
||||
ui: resolve(__dirname, "ui/index.html"),
|
||||
},
|
||||
{
|
||||
"src": `/assets/icons/monochrome.svg`,
|
||||
"type": "image/svg+xml",
|
||||
"sizes": "48x48 72x72 96x96 128x128 256x256",
|
||||
"purpose": "monochrome"
|
||||
},
|
||||
{
|
||||
"src": `/assets/icons/masking-512x512.png`,
|
||||
"type": "image/png",
|
||||
"sizes": "512x512",
|
||||
"purpose": "maskable"
|
||||
}
|
||||
]
|
||||
}
|
||||
}),
|
||||
replace({
|
||||
__GIT_REVISION__: getGitRevision(),
|
||||
__GIT_BRANCH__: getGitBranch(),
|
||||
__APP_VERSION__: getVersion(),
|
||||
preventAssignment: true
|
||||
})
|
||||
],
|
||||
build: {
|
||||
sourcemap: true,
|
||||
rollupOptions: {
|
||||
input: {
|
||||
main: resolve(__dirname, 'index.html'),
|
||||
ui: resolve(__dirname, 'ui/index.html')
|
||||
}
|
||||
}
|
||||
}
|
||||
})
|
||||
},
|
||||
},
|
||||
});
|
||||
|
|
|
@ -3570,10 +3570,10 @@ revolt-api@0.5.1-alpha.10-patch.0:
|
|||
resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.1-alpha.10-patch.0.tgz#97d31bec7dfa4573567097443acb059c4feaac20"
|
||||
integrity sha512-UyM890HkGlYNQOxpHuEpUsJHLt8Ujnjg9/zPEDGpbvS4iy0jmHX23Hh8tOCfb/ewxbNrtT3G1HpSWKOneW/vYg==
|
||||
|
||||
revolt.js@5.0.0-alpha.17:
|
||||
version "5.0.0-alpha.17"
|
||||
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.17.tgz#a0cb48327a7904379a5099b46b24a484b1d08b20"
|
||||
integrity sha512-anEece/7V2tSszOWSKYakNHqWZHwGsAVpVL9CAtKNsF+bC+2C/7UhTsWL5w2g3FxJd7tobrEuck0by7ULnOvLw==
|
||||
revolt.js@5.0.0-alpha.18:
|
||||
version "5.0.0-alpha.18"
|
||||
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.18.tgz#fffd63a4f4f93a4a6422de6a68c1ba3f3f9b55e5"
|
||||
integrity sha512-NVd00P4CYLVJf1AuYwo65mPeLaST/RdU7dMLFwCZPvQAHvyPwTfLekCc9dfKPT4BkS2sjF8Vxi2xUFpMRMZYfw==
|
||||
dependencies:
|
||||
axios "^0.19.2"
|
||||
eventemitter3 "^4.0.7"
|
||||
|
|
Loading…
Reference in a new issue