Skip to content
This repository was archived by the owner on Sep 11, 2024. It is now read-only.

Commit 047f39e

Browse files
committed
edits to changelog
1 parent d1b6068 commit 047f39e

File tree

3 files changed

+11
-40
lines changed

3 files changed

+11
-40
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
<<<<<<< HEAD
12
Changes in [3.53.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.53.0) (2022-08-31)
23
=====================================================================================================
34

@@ -75,6 +76,11 @@ Changes in [3.52.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/
7576
* Use default styling on nested numbered lists due to MD being sensitive ([\#9110](https://github.com/matrix-org/matrix-react-sdk/pull/9110)). Fixes vector-im/element-web#22935.
7677
* Fix replying using chat effect commands ([\#9101](https://github.com/matrix-org/matrix-react-sdk/pull/9101)). Fixes vector-im/element-web#22824.
7778
* The first message in a DM can no longer be a sticker. This has been changed to avoid issues with the integration manager. ([\#9180](https://github.com/matrix-org/matrix-react-sdk/pull/9180)).
79+
=======
80+
Added ability to upload room-specific custom emotes in Room Settings. These show up in the room's messages when the shortcode is in the message.
81+
The file fixes were a local issue in which I had to copy the correct version of the files from another folder. Not a part of the emote feature.
82+
Currently emotes are not encrypted and do not show up in autocomplete or the right side emoji panel. I think this could be a start for fully implementing custom emotes.
83+
>>>>>>> 8a422d88e6 (edits to changelog)
7884

7985
Changes in [3.51.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.51.0) (2022-08-02)
8086
=====================================================================================================

src/components/views/messages/TextualBody.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -574,6 +574,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
574574
let body: ReactNode;
575575
const client = MatrixClientPeg.get();
576576
const room = client.getRoom(mxEvent.getRoomId());
577+
//TODO: Decrypt emotes if encryption is added
577578
let emotesEvent = room.currentState.getStateEvents("m.room.emotes", "");
578579
let rawEmotes = emotesEvent ? (emotesEvent.getContent() || {}) : {};
579580
let finalEmotes = {};
@@ -614,8 +615,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
614615
});
615616

616617
}
617-
//console.log(body);
618-
//body.replace(/:[\w+-]+:/, m => finalEmotes[m] ? finalEmotes[m] : m)
619618
if (this.props.replacingEventId) {
620619
body = <>
621620
{ body }
@@ -652,8 +651,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
652651
/>;
653652
}
654653

655-
//console.log(body.props.children);
656-
//.replace(/:[\w+-]+:/, m => finalEmotes[m] ? finalEmotes[m] : m)
657654
if (isEmote) {
658655
return (
659656
<div className="mx_MEmoteBody mx_EventTile_content"

src/components/views/room_settings/RoomEmoteSettings.tsx

Lines changed: 4 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -55,23 +55,15 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
5555
const client = MatrixClientPeg.get();
5656
const room = client.getRoom(props.roomId);
5757
if (!room) throw new Error(`Expected a room for ID: ${props.roomId}`);
58-
58+
//TODO: Decrypt the shortcodes and emotes if they are encrypted
5959
let emotesEvent = room.currentState.getStateEvents("m.room.emotes", "");
60-
//console.log(room.currentState);
6160
let emotes: Dictionary<string>;
6261
emotes = emotesEvent ? (emotesEvent.getContent() || {}) : {};
6362
let value = {};
6463
for (let emote in emotes) {
6564
value[emote] = emote;
6665
}
67-
//TODO: Decrypt the shortcodes and emotes if they are encrypted
68-
// if (emotes) {
69-
// console.log(room.roomId);
70-
// console.log(room.name);
71-
// console.log(emotes);
72-
// }
73-
//if (avatarUrl) avatarUrl = mediaFromMxc(avatarUrl).getSquareThumbnailHttp(96);
74-
//emotes={}
66+
7567
this.state = {
7668
emotes: emotes,
7769
EmoteFieldsTouched: {},
@@ -128,7 +120,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
128120
let cleanemotes = {}
129121
let deletedItems = this.state.deletedItems;
130122
let value = {}
131-
//console.log(e.currentTarget.getAttribute("name"));
132123
let id = e.currentTarget.getAttribute("id")
133124
for (let emote in this.state.emotes) {
134125
if (emote != id) {
@@ -141,13 +132,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
141132
}
142133

143134
this.setState({ deleted: true, emotes: cleanemotes, deletedItems: deletedItems, value: value })
144-
// document.querySelectorAll(".mx_EmoteSettings_existingEmoteCode").forEach(field => {
145-
// field.setAttribute("value",(field as HTMLInputElement).id);
146-
// field.setAttribute("defaultValue",(field as HTMLInputElement).id);
147-
// })
148-
// for(let DOMid in this.state.emotes){
149-
// document.getElementById(DOMid).setAttribute("value",DOMid);
150-
// }
151135
return;
152136

153137
}
@@ -163,7 +147,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
163147
// TODO: What do we do about errors?
164148

165149
if (this.state.emotes || (this.state.newEmoteFileAdded && this.state.newEmoteCodeAdded)) {
166-
//const emotes = await client.uploadContent(this.state.emotes);
167150
//TODO: Encrypt the shortcode and the image data before uploading
168151
if (this.state.newEmoteFileAdded && this.state.newEmoteCodeAdded) {
169152
const newEmote = await client.uploadContent(this.state.newEmoteFile);
@@ -178,12 +161,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
178161
if (this.state.EmoteFieldsTouched.hasOwnProperty(shortcode)) {
179162
emotesMxcs[this.state.EmoteFieldsTouched[shortcode]] = this.state.emotes[shortcode];
180163
value[this.state.EmoteFieldsTouched[shortcode]] = this.state.EmoteFieldsTouched[shortcode];
181-
182-
// document.querySelectorAll(".mx_EmoteSettings_existingEmoteCode").forEach(field => {
183-
// if((field as HTMLInputElement).name===shortcode){
184-
// (field as HTMLInputElement).name= this.state.EmoteFieldsTouched[shortcode];
185-
// }
186-
// })
187164
}
188165

189166
else {
@@ -193,7 +170,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
193170

194171
};
195172
}
196-
//console.log(emotesMxcs);
197173
newState.value = value;
198174
await client.sendStateEvent(this.props.roomId, 'm.room.emotes', emotesMxcs, "");
199175
this.emoteUpload.current.value = "";
@@ -205,21 +181,13 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
205181
newState.deleted = false;
206182
newState.deletedItems = {};
207183

208-
/*newState.avatarUrl = mediaFromMxc(uri).getSquareThumbnailHttp(96);
209-
newState.originalAvatarUrl = newState.avatarUrl;
210-
newState.avatarFile = null;*/
211-
} /*else if (this.state.originalAvatarUrl !== this.state.avatarUrl) {
212-
await client.sendStateEvent(this.props.roomId, 'm.room.avatar', {}, '');
213-
}*/
184+
}
214185
this.setState(newState as IState);
215186
};
216187

217188

218189
private onEmoteChange = (e: React.ChangeEvent<HTMLInputElement>): void => {
219190
const id = e.target.getAttribute("id");
220-
//e.target.setAttribute("value", e.target.value);
221-
//const newEmotes = { ...this.state.emotes, [value]: value };
222-
//let newState=this.state.emotes;
223191
let b = this.state.value
224192
b[id] = e.target.value;
225193
this.setState({ value: b, EmoteFieldsTouched: { ...this.state.EmoteFieldsTouched, [id]: e.target.value } });
@@ -306,7 +274,7 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
306274

307275
/>
308276
<img className="mx_EmoteSettings_uploadedEmoteImage" src={
309-
mediaFromMxc(this.state.emotes[emotecode]).srcHttp//.getSquareThumbnailHttp(96)
277+
mediaFromMxc(this.state.emotes[emotecode]).srcHttp
310278
} />
311279
<div className="mx_EmoteSettings_uploadButton">
312280
<AccessibleButton

0 commit comments

Comments
 (0)