Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.6.10 #335

Open
wants to merge 7 commits into
base: release
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,20 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### [0.6.11](https://github.com/TRPGEngine/Client/compare/v0.6.10...v0.6.11) (2023-07-08)


### Features

* add listName in ForEachComponent which can pass into define ([8de14e6](https://github.com/TRPGEngine/Client/commit/8de14e6e086aa6b20d19fee64f4ba4cc8df52ee5))

### [0.6.10](https://github.com/TRPGEngine/Client/compare/v0.6.9...v0.6.10) (2022-08-26)


### Bug Fixes

* 修复管理员不能撤回其他人消息的bug ([cb53eb0](https://github.com/TRPGEngine/Client/commit/cb53eb01418440917769f8a6d16f9aeef17b73e9))

### [0.6.9](https://github.com/TRPGEngine/Client/compare/v0.6.8...v0.6.9) (2022-08-07)


Expand Down
2 changes: 2 additions & 0 deletions build/template/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
{{#if isPro}}
<link rel="manifest" href="/src/web/assets/lib/manifest.json">

<script async defer data-website-id="f3019d31-8bd0-426f-9c28-f3fa3e3dbef0" src="https://umami.moonrailgun.com/script.js"></script>

<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-121610011-1"></script>
<script>
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trpg-game-client",
"version": "0.6.9",
"version": "0.6.11",
"description": "专注于TRPG跑团的IM即时应用聊天软件",
"main": "./dist/entry.js",
"productName": "TRPG Engine",
Expand Down
7 changes: 5 additions & 2 deletions src/playground/editor/advanced-editor/example/xml/dnd5e.xml
Original file line number Diff line number Diff line change
Expand Up @@ -368,8 +368,11 @@
<Col sm="6">
<Input name="name" label="名称" hideLabel="true" />
</Col>
<Col sm="14">
<Input name="name" label="描述" hideLabel="true" />
<Col sm="10">
<Input name="desc" label="描述" hideLabel="true" />
</Col>
<Col flex="0">
<Button type="link" :onClick="() => { setStateDate(`parent.${props.listName}`, _filter(parent[props.listName], (_,i) => i !== _toNumber(props.index))) }">删除</Button>
</Col>
</Row>
</Define>
Expand Down
1 change: 1 addition & 0 deletions src/shared/components/layout/tags/ForEach/shared.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export const ForEachComponent: React.FC<ForEachComponentProps> = TMemo(
key={`${name}.${i}`}
index={i}
name={useName}
listName={name}
define={props.define}
/>
);
Expand Down
3 changes: 3 additions & 0 deletions src/shared/i18n/langs/en-US/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,14 @@
"kb55c8dba": "Invite Member",
"kb5c7b82d": "Settings",
"kb5f6e39e": "Panel Not Found",
"kb69aa763": "Message recall failed:",
"kb8185132": "Or",
"kb9b9bbe9": "Join Room",
"kbac1629c": "Desktop Notification Authority",
"kbff43de3": "Name",
"kc0bd70b7": "Test Mic",
"kc0deb40d": "Are you ensure to promote the user to administrator?",
"kc18c3be8": "Retracting message...",
"kc2455d76": "Developer Lab",
"kc372591a": "Message Combine",
"kc522e12c": "Login Type",
Expand Down Expand Up @@ -249,6 +251,7 @@
"ke4d28dd6": "Ensure to Quit Group",
"ke4ed9d21": "Assign Members",
"ke564042c": "Multi-converse loading failed",
"ke6da074f": "Message recalled successfully",
"ke82cdd0f": "Failed to get group list",
"ke8477173": "Yourself",
"ke88afa8f": "Bot List",
Expand Down
3 changes: 3 additions & 0 deletions src/shared/i18n/langs/zh-CN/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -202,12 +202,14 @@
"kb55c8dba": "邀请成员",
"kb5c7b82d": "设置",
"kb5f6e39e": "找不到该面板",
"kb69aa763": "消息撤回失败:",
"kb8185132": "或",
"kb9b9bbe9": "加入房间",
"kbac1629c": "桌面通知权限",
"kbff43de3": "名称",
"kc0bd70b7": "测试麦克风",
"kc0deb40d": "确定要将用户提升为管理员么?",
"kc18c3be8": "正在撤回消息...",
"kc2455d76": "开发实验室",
"kc372591a": "合并消息",
"kc522e12c": "登录类型",
Expand Down Expand Up @@ -249,6 +251,7 @@
"ke4d28dd6": "是否要退出群",
"ke4ed9d21": "指定成员",
"ke564042c": "多人会话加载失败",
"ke6da074f": "消息撤回成功",
"ke82cdd0f": "群组列表获取失败",
"ke8477173": "你自己",
"ke88afa8f": "机器人列表",
Expand Down
8 changes: 5 additions & 3 deletions src/shared/redux/actions/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import type {
import type { TRPGAction } from '../types/__all__';
import { isUserUUID } from '@shared/utils/uuid';
import { createAction } from '@reduxjs/toolkit';
import { showToasts } from '@shared/manager/ui';
import { showGlobalLoading, showToasts } from '@shared/manager/ui';
import { reportError } from '@web/utils/error';
import { t } from '@shared/i18n';

Expand Down Expand Up @@ -539,18 +539,20 @@ export const sendFile = function sendFile(toUUID, payload, file): TRPGAction {
*/
export const revokeMsg = function revokeMsg(messageUUID: string): TRPGAction {
return (dispatch, getState) => {
const closeLoading = showGlobalLoading(t('正在撤回消息...'));
api.emit(
'chat::revokeMsg',
{
messageUUID,
},
(data) => {
closeLoading();
if (data.result === false) {
// 撤回提示
console.error('消息撤回失败', data.msg);
showToasts('消息撤回失败:' + data.msg, 'error');
showToasts(t('消息撤回失败:') + data.msg, 'error');
} else {
showToasts('消息撤回成功');
showToasts(t('消息撤回成功'));
}
}
);
Expand Down
9 changes: 8 additions & 1 deletion src/shared/redux/types/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,14 @@ export interface MsgPayload {
// 渲染消息时所必须的参数
export type RenderMsgPayload = Pick<
MsgPayload,
'uuid' | 'sender_uuid' | 'message' | 'type' | 'date' | 'data' | 'revoke'
| 'uuid'
| 'sender_uuid'
| 'message'
| 'type'
| 'date'
| 'data'
| 'revoke'
| 'group_uuid'
>;

// 发送消息时所必须的参数
Expand Down
17 changes: 14 additions & 3 deletions src/web/components/messageTypes/Default.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React, { useCallback, useMemo } from 'react';
import { connect, DispatchProp } from 'react-redux';
import Base from './Base';
import type {
MsgPayload,
Expand All @@ -21,6 +22,8 @@ import { Bubble, DefaultAddonContentContainer } from './style';
import { t, useTranslation } from '@shared/i18n';
import { isLocalMsgUUID } from '@shared/utils/uuid';
import { showToasts } from '@shared/manager/ui';
import type { MessageProps } from '@shared/components/message/MessageHandler';
import type { TRPGState } from '@redux/types/__all__';

const DefaultAddonContent: React.FC<{ message: string }> = TMemo((props) => {
const { loading, hasUrl, info } = useWebsiteInfo(props.message);
Expand Down Expand Up @@ -67,15 +70,18 @@ const DefaultMsgReply: React.FC<{
});
DefaultMsgReply.displayName = 'DefaultMsgReply';

class Default extends Base {
interface Props extends MessageProps, DispatchProp<any> {
isGroupOwner: boolean;
}
class Default extends Base<Props> {
getOperation(): MsgOperationItem[] {
const { info, me } = this.props;

const operations: MsgOperationItem[] = [];
operations.push({
component: <DefaultMsgReply payload={this.props.info} />,
});
if (me) {
if (me || this.props.isGroupOwner) {
// 当消息时自己发起的时候,可以撤回
operations.push({
name: t('撤回'),
Expand Down Expand Up @@ -109,4 +115,9 @@ class Default extends Base {
}
}

export default Default;
export default connect((state: TRPGState, props: MessageProps) => ({
isGroupOwner:
props.info.group_uuid &&
state.group.groups.find((group) => group.uuid === props.info.group_uuid)
?.owner_uuid === state.user.info.uuid,
}))(Default as any);
Loading