Merge remote-tracking branch 'upstream/main' into refactor/typescript

# Conflicts:
#	src/app/services/server.ts
#	src/common/component/GoogleLoginButton.tsx
#	src/common/utils.tsx
This commit is contained in:
HD
2022-06-28 10:10:56 +08:00
47 changed files with 513 additions and 355 deletions
+2 -2
View File
@@ -1,6 +1,6 @@
import { useEffect, useState } from "react";
import toast from "react-hot-toast";
import { isObjectEqual } from "../utils";
import { isEqual } from "lodash";
import {
useUpdateLoginConfigMutation,
useUpdateSMTPConfigMutation,
@@ -101,7 +101,7 @@ export default function useConfig(config = "smtp") {
useEffect(() => {
// 空对象
if (Object.keys(values).length == 0) return;
if (!isObjectEqual(originalValue, values)) {
if (!isEqual(originalValue, values)) {
setChanged(true);
} else {
setChanged(false);
+1 -1
View File
@@ -65,7 +65,7 @@ export default function useMessageFeed({ context = "channel", id = null }) {
}, [context, id]);
useEffect(() => {
if (items.length) {
containerRef.current = document.querySelector(`#RUSTCHAT_FEED_${context}_${id}`);
containerRef.current = document.querySelector(`#VOCECHAT_FEED_${context}_${id}`);
if (containerRef.current) {
const newScroll = containerRef.current.scrollHeight - containerRef.current.clientHeight;
containerRef.current.scrollTop = curScrollPos + (newScroll - oldScroll);
+4 -4
View File
@@ -219,7 +219,7 @@ export default function useStreaming() {
const { gid, ...rest } = data;
dispatch(
updateChannel({
id: gid,
gid,
...rest
})
);
@@ -233,7 +233,7 @@ export default function useStreaming() {
dispatch(
updateChannel({
operation: "add_member",
id: gid,
gid,
members: uids
})
);
@@ -242,13 +242,13 @@ export default function useStreaming() {
case "user_leaved_group":
{
const { gid, uid: uids } = data;
if (uids.findIndex((id) => id == loginUid) > -1) {
if (uids.findIndex((uid) => uid == loginUid) > -1) {
dispatch(removeChannel(gid));
} else {
dispatch(
updateChannel({
operation: "remove_member",
id: gid,
gid,
members: uids
})
);
+1 -1
View File
@@ -42,7 +42,7 @@ export default function useUploadFile(props: { context: string; id: string } | o
if (!file) return;
setData(null);
const {
name = `rustchat-${+new Date()}.${file.type.split("/")[1]}`,
name = `-${+new Date()}.${file.type.split("/")[1]}`,
type: file_type,
size: file_size
} = file;