merge: branch 'master' into production

This commit is contained in:
Paul Makles 2022-09-18 12:32:36 +01:00
commit 1621e3b17d
11 changed files with 73 additions and 30 deletions

2
external/components vendored

@ -1 +1 @@
Subproject commit 557094115d17a363eb6fb8f27c6e697e049ce623 Subproject commit ab0fc1af739f877c8f416dcd7e47d25aacbb7eea

2
external/lang vendored

@ -1 +1 @@
Subproject commit 14d51d68a579ee3796837cd16deda4281f83c923 Subproject commit 843cece2854185651e17765bcb78109d22eba769

2
external/revolt.js vendored

@ -1 +1 @@
Subproject commit 044b1b91ee583bfb89fff140ecda29a32f6535aa Subproject commit ab064f41a4154acee7c1751ea5b59d9ee4345a0b

View file

@ -25,6 +25,8 @@ export function useStatusColour(user?: User) {
return user?.online && user?.status?.presence !== "Invisible" return user?.online && user?.status?.presence !== "Invisible"
? user?.status?.presence === "Idle" ? user?.status?.presence === "Idle"
? theme.getVariable("status-away") ? theme.getVariable("status-away")
: user?.status?.presence === "Focus"
? theme.getVariable("status-focus")
: user?.status?.presence === "Busy" : user?.status?.presence === "Busy"
? theme.getVariable("status-busy") ? theme.getVariable("status-busy")
: theme.getVariable("status-online") : theme.getVariable("status-online")

View file

@ -32,6 +32,10 @@ export default observer(({ user, tooltip }: Props) => {
return <Text id="app.status.idle" />; return <Text id="app.status.idle" />;
} }
if (user.status?.presence === "Focus") {
return <Text id="app.status.focus" />;
}
if (user.status?.presence === "Invisible") { if (user.status?.presence === "Invisible") {
return <Text id="app.status.offline" />; return <Text id="app.status.offline" />;
} }

View file

@ -31,6 +31,7 @@ export type Variables =
| "tooltip" | "tooltip"
| "status-online" | "status-online"
| "status-away" | "status-away"
| "status-focus"
| "status-busy" | "status-busy"
| "status-streaming" | "status-streaming"
| "status-invisible"; | "status-invisible";
@ -283,6 +284,7 @@ export const PRESETS: Record<string, Theme> = {
"tertiary-foreground": "#3a3a3a", "tertiary-foreground": "#3a3a3a",
"status-online": "#3ABF7E", "status-online": "#3ABF7E",
"status-away": "#F39F00", "status-away": "#F39F00",
"status-focus": "#4799F0",
"status-busy": "#F84848", "status-busy": "#F84848",
"status-streaming": "#977EFF", "status-streaming": "#977EFF",
"status-invisible": "#A5A5A5", "status-invisible": "#A5A5A5",
@ -310,6 +312,7 @@ export const PRESETS: Record<string, Theme> = {
"tertiary-foreground": "#848484", "tertiary-foreground": "#848484",
"status-online": "#3ABF7E", "status-online": "#3ABF7E",
"status-away": "#F39F00", "status-away": "#F39F00",
"status-focus": "#4799F0",
"status-busy": "#F84848", "status-busy": "#F84848",
"status-streaming": "#977EFF", "status-streaming": "#977EFF",
"status-invisible": "#A5A5A5", "status-invisible": "#A5A5A5",
@ -338,7 +341,6 @@ export const generateVariables = (theme: Theme) => {
return `--${key}: ${theme[key]}; --${key}-rgb: ${r}, ${g}, ${b};`; return `--${key}: ${theme[key]}; --${key}-rgb: ${r}, ${g}, ${b};`;
} }
return `--${key}: ${theme[key]};`; return `--${key}: ${theme[key]};`;
}); });
}; };

View file

@ -1110,6 +1110,15 @@ export default function ContextMenus() {
<div className="indicator idle" /> <div className="indicator idle" />
<Text id={`app.status.idle`} /> <Text id={`app.status.idle`} />
</MenuItem> </MenuItem>
<MenuItem
data={{
action: "set_presence",
presence: "Focus",
}}
disabled={!isOnline}>
<div className="indicator focus" />
<Text id={`app.status.focus`} />
</MenuItem>
<MenuItem <MenuItem
data={{ data={{
action: "set_presence", action: "set_presence",

View file

@ -1,3 +1,6 @@
/**
* Type of link
*/
type LinkType = type LinkType =
| { | {
type: "navigate"; type: "navigate";
@ -6,6 +9,9 @@ type LinkType =
| { type: "external"; href: string; url: URL } | { type: "external"; href: string; url: URL }
| { type: "none" }; | { type: "none" };
/**
* Allowed origins for relative navigation
*/
const ALLOWED_ORIGINS = [ const ALLOWED_ORIGINS = [
location.hostname, location.hostname,
"app.revolt.chat", "app.revolt.chat",
@ -13,27 +19,36 @@ const ALLOWED_ORIGINS = [
"local.revolt.chat", "local.revolt.chat",
]; ];
/**
* Permissible protocols in URLs
*/
const PROTOCOL_WHITELIST = [ const PROTOCOL_WHITELIST = [
"https", "http:",
"ftp", "https:",
"ftps", "ftp:",
"mailto", "ftps:",
"news", "mailto:",
"irc", "news:",
"gopher", "irc:",
"nntp", "gopher:",
"feed", "nntp:",
"telnet", "feed:",
"mms", "telnet:",
"rtsp", "mms:",
"svn", "rtsp:",
"git", "svn:",
"tel", "git:",
"fax", "tel:",
"xmpp", "fax:",
"magnet", "xmpp:",
"magnet:",
]; ];
/**
* Determine what kind of link we are dealing with and sanitise any malicious input
* @param href Input URL
* @returns Link Type
*/
export function determineLink(href?: string): LinkType { export function determineLink(href?: string): LinkType {
let internal, let internal,
url: URL | null = null; url: URL | null = null;

View file

@ -157,6 +157,8 @@ export default class NotificationOptions
return false; return false;
} }
// Check channel notification settings
const mentioned = message.mention_ids?.includes(user._id);
switch (this.computeForChannel(message.channel!)) { switch (this.computeForChannel(message.channel!)) {
case "muted": case "muted":
case "none": case "none":
@ -164,7 +166,12 @@ export default class NotificationOptions
return false; return false;
case "mention": case "mention":
// Ignore if it doesn't mention us. // Ignore if it doesn't mention us.
if (!message.mention_ids?.includes(user._id)) return false; if (!mentioned) return false;
}
// Check if we are in focus mode
if (user.status?.presence === "Focus" && !mentioned) {
return false;
} }
return true; return true;

View file

@ -92,6 +92,10 @@
background: var(--status-away); background: var(--status-away);
} }
&.focus {
background: var(--status-focus);
}
&.busy { &.busy {
background: var(--status-busy); background: var(--status-busy);
} }

View file

@ -8012,14 +8012,14 @@ __metadata:
languageName: node languageName: node
linkType: hard linkType: hard
"revolt-api@npm:0.5.5-3": "revolt-api@npm:0.5.5-4":
version: 0.5.5-3 version: 0.5.5-4
resolution: "revolt-api@npm:0.5.5-3" resolution: "revolt-api@npm:0.5.5-4"
dependencies: dependencies:
"@insertish/oapi": 0.1.18 "@insertish/oapi": 0.1.18
axios: ^0.26.1 axios: ^0.26.1
lodash.defaultsdeep: ^4.6.1 lodash.defaultsdeep: ^4.6.1
checksum: adf13c87ad22acced931fbac45d49d858346ad03c0aea5045af2e38ee345b85a094b6b2abf76aed93dc6694daae5235e3fd9ed2f213f4700b5ce07688b8a4503 checksum: dfb374d58f1b8b5a6de2e7fa05e386b3df3ffb85a450a6894f23c6b9760af8bff0d198d8352063c33084f0dbc6ff84a234300efb0c62c7b27f709887402787f1
languageName: node languageName: node
linkType: hard linkType: hard
@ -8036,7 +8036,7 @@ __metadata:
lodash.isequal: ^4.5.0 lodash.isequal: ^4.5.0
long: ^5.2.0 long: ^5.2.0
mobx: ^6.3.2 mobx: ^6.3.2
revolt-api: 0.5.5-3 revolt-api: 0.5.5-4
ulid: ^2.3.0 ulid: ^2.3.0
ws: ^8.2.2 ws: ^8.2.2
languageName: node languageName: node