mirror of
https://github.com/revoltchat/revite.git
synced 2024-11-21 22:50:59 -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-router-dom": "^5.2.0",
|
||||||
"react-scroll": "^1.8.2",
|
"react-scroll": "^1.8.2",
|
||||||
"redux": "^4.1.0",
|
"redux": "^4.1.0",
|
||||||
"revolt.js": "5.0.0-alpha.17",
|
"revolt.js": "5.0.0-alpha.18",
|
||||||
"rimraf": "^3.0.2",
|
"rimraf": "^3.0.2",
|
||||||
"sass": "^1.35.1",
|
"sass": "^1.35.1",
|
||||||
"shade-blend-color": "^1.0.0",
|
"shade-blend-color": "^1.0.0",
|
||||||
|
|
|
@ -323,7 +323,7 @@ export default observer(({ channel }: Props) => {
|
||||||
|
|
||||||
const ws = client.websocket;
|
const ws = client.websocket;
|
||||||
if (ws.connected) {
|
if (ws.connected) {
|
||||||
setTyping(+new Date() + 4000);
|
setTyping(+new Date() + 2500);
|
||||||
ws.send({
|
ws.send({
|
||||||
type: "BeginTyping",
|
type: "BeginTyping",
|
||||||
channel: channel._id,
|
channel: channel._id,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { observer } from "mobx-react-lite";
|
import { observer } from "mobx-react-lite";
|
||||||
|
import { RelationshipStatus } from "revolt-api/types/Users";
|
||||||
import { Channel } from "revolt.js/dist/maps/Channels";
|
import { Channel } from "revolt.js/dist/maps/Channels";
|
||||||
import styled from "styled-components";
|
import styled from "styled-components";
|
||||||
|
|
||||||
|
@ -57,7 +58,10 @@ const Base = styled.div`
|
||||||
|
|
||||||
export default observer(({ channel }: Props) => {
|
export default observer(({ channel }: Props) => {
|
||||||
const users = channel.typing.filter(
|
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) {
|
if (users.length > 0) {
|
||||||
|
|
177
vite.config.ts
177
vite.config.ts
|
@ -1,103 +1,108 @@
|
||||||
import { resolve } from 'path'
|
import replace from "@rollup/plugin-replace";
|
||||||
import { readFileSync } from 'fs'
|
import { readFileSync } from "fs";
|
||||||
import { defineConfig } from 'vite'
|
import { resolve } from "path";
|
||||||
import preact from '@preact/preset-vite'
|
import { defineConfig } from "vite";
|
||||||
import { VitePWA } from 'vite-plugin-pwa'
|
import { VitePWA } from "vite-plugin-pwa";
|
||||||
import replace from '@rollup/plugin-replace'
|
|
||||||
|
import preact from "@preact/preset-vite";
|
||||||
|
|
||||||
function getGitRevision() {
|
function getGitRevision() {
|
||||||
try {
|
try {
|
||||||
const rev = readFileSync('.git/HEAD').toString().trim();
|
const rev = readFileSync(".git/HEAD").toString().trim();
|
||||||
if (rev.indexOf(':') === -1) {
|
if (rev.indexOf(":") === -1) {
|
||||||
return rev;
|
return rev;
|
||||||
} else {
|
} else {
|
||||||
return readFileSync('.git/' + rev.substring(5)).toString().trim();
|
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() {
|
function getGitBranch() {
|
||||||
try {
|
try {
|
||||||
const rev = readFileSync('.git/HEAD').toString().trim();
|
const rev = readFileSync(".git/HEAD").toString().trim();
|
||||||
if (rev.indexOf(':') === -1) {
|
if (rev.indexOf(":") === -1) {
|
||||||
return 'DETACHED';
|
return "DETACHED";
|
||||||
} else {
|
} else {
|
||||||
return rev.split('/').pop();
|
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() {
|
function getVersion() {
|
||||||
return readFileSync('VERSION').toString();
|
return readFileSync("VERSION").toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
const branch = getGitBranch();
|
const branch = getGitBranch();
|
||||||
const isNightly = false;//branch !== 'production';
|
const isNightly = false; //branch !== 'production';
|
||||||
const iconPrefix = isNightly ? 'nightly-' : '';
|
const iconPrefix = isNightly ? "nightly-" : "";
|
||||||
|
|
||||||
export default defineConfig({
|
export default defineConfig({
|
||||||
plugins: [
|
plugins: [
|
||||||
preact(),
|
preact(),
|
||||||
VitePWA({
|
VitePWA({
|
||||||
srcDir: 'src',
|
srcDir: "src",
|
||||||
filename: 'sw.ts',
|
filename: "sw.ts",
|
||||||
strategies: 'injectManifest',
|
strategies: "injectManifest",
|
||||||
manifest: {
|
manifest: {
|
||||||
name: isNightly ? "Revolt Nightly" : "Revolt",
|
name: isNightly ? "Revolt Nightly" : "Revolt",
|
||||||
short_name: "Revolt",
|
short_name: "Revolt",
|
||||||
description: isNightly ? "Early preview builds of Revolt." : "User-first, privacy-focused chat platform.",
|
description: isNightly
|
||||||
categories: ["messaging"],
|
? "Early preview builds of Revolt."
|
||||||
start_url: "/",
|
: "User-first, privacy-focused chat platform.",
|
||||||
orientation: "portrait",
|
categories: ["messaging"],
|
||||||
display: "standalone",
|
start_url: "/",
|
||||||
background_color: "#101823",
|
orientation: "portrait",
|
||||||
theme_color: "#101823",
|
display: "standalone",
|
||||||
icons: [
|
background_color: "#101823",
|
||||||
{
|
theme_color: "#101823",
|
||||||
"src": `/assets/icons/${iconPrefix}android-chrome-192x192.png`,
|
icons: [
|
||||||
"type": "image/png",
|
{
|
||||||
"sizes": "192x192"
|
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`,
|
replace({
|
||||||
"type": "image/png",
|
__GIT_REVISION__: getGitRevision(),
|
||||||
"sizes": "512x512"
|
__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"
|
resolved "https://registry.yarnpkg.com/revolt-api/-/revolt-api-0.5.1-alpha.10-patch.0.tgz#97d31bec7dfa4573567097443acb059c4feaac20"
|
||||||
integrity sha512-UyM890HkGlYNQOxpHuEpUsJHLt8Ujnjg9/zPEDGpbvS4iy0jmHX23Hh8tOCfb/ewxbNrtT3G1HpSWKOneW/vYg==
|
integrity sha512-UyM890HkGlYNQOxpHuEpUsJHLt8Ujnjg9/zPEDGpbvS4iy0jmHX23Hh8tOCfb/ewxbNrtT3G1HpSWKOneW/vYg==
|
||||||
|
|
||||||
revolt.js@5.0.0-alpha.17:
|
revolt.js@5.0.0-alpha.18:
|
||||||
version "5.0.0-alpha.17"
|
version "5.0.0-alpha.18"
|
||||||
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.17.tgz#a0cb48327a7904379a5099b46b24a484b1d08b20"
|
resolved "https://registry.yarnpkg.com/revolt.js/-/revolt.js-5.0.0-alpha.18.tgz#fffd63a4f4f93a4a6422de6a68c1ba3f3f9b55e5"
|
||||||
integrity sha512-anEece/7V2tSszOWSKYakNHqWZHwGsAVpVL9CAtKNsF+bC+2C/7UhTsWL5w2g3FxJd7tobrEuck0by7ULnOvLw==
|
integrity sha512-NVd00P4CYLVJf1AuYwo65mPeLaST/RdU7dMLFwCZPvQAHvyPwTfLekCc9dfKPT4BkS2sjF8Vxi2xUFpMRMZYfw==
|
||||||
dependencies:
|
dependencies:
|
||||||
axios "^0.19.2"
|
axios "^0.19.2"
|
||||||
eventemitter3 "^4.0.7"
|
eventemitter3 "^4.0.7"
|
||||||
|
|
Loading…
Reference in a new issue