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

Commit

Permalink
edits to changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
nmscode committed Sep 2, 2022
1 parent d1b6068 commit 047f39e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 40 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<<<<<<< HEAD
Changes in [3.53.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.53.0) (2022-08-31)
=====================================================================================================

Expand Down Expand Up @@ -75,6 +76,11 @@ Changes in [3.52.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/
* 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.
* Fix replying using chat effect commands ([\#9101](https://github.com/matrix-org/matrix-react-sdk/pull/9101)). Fixes vector-im/element-web#22824.
* 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)).
=======
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.
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.
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.
>>>>>>> 8a422d88e6 (edits to changelog)

Changes in [3.51.0](https://github.com/matrix-org/matrix-react-sdk/releases/tag/v3.51.0) (2022-08-02)
=====================================================================================================
Expand Down
5 changes: 1 addition & 4 deletions src/components/views/messages/TextualBody.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -574,6 +574,7 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
let body: ReactNode;
const client = MatrixClientPeg.get();
const room = client.getRoom(mxEvent.getRoomId());
//TODO: Decrypt emotes if encryption is added
let emotesEvent = room.currentState.getStateEvents("m.room.emotes", "");
let rawEmotes = emotesEvent ? (emotesEvent.getContent() || {}) : {};
let finalEmotes = {};
Expand Down Expand Up @@ -614,8 +615,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
});

}
//console.log(body);
//body.replace(/:[\w+-]+:/, m => finalEmotes[m] ? finalEmotes[m] : m)
if (this.props.replacingEventId) {
body = <>
{ body }
Expand Down Expand Up @@ -652,8 +651,6 @@ export default class TextualBody extends React.Component<IBodyProps, IState> {
/>;
}

//console.log(body.props.children);
//.replace(/:[\w+-]+:/, m => finalEmotes[m] ? finalEmotes[m] : m)
if (isEmote) {
return (
<div className="mx_MEmoteBody mx_EventTile_content"
Expand Down
40 changes: 4 additions & 36 deletions src/components/views/room_settings/RoomEmoteSettings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,23 +55,15 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
const client = MatrixClientPeg.get();
const room = client.getRoom(props.roomId);
if (!room) throw new Error(`Expected a room for ID: ${props.roomId}`);

//TODO: Decrypt the shortcodes and emotes if they are encrypted
let emotesEvent = room.currentState.getStateEvents("m.room.emotes", "");
//console.log(room.currentState);
let emotes: Dictionary<string>;
emotes = emotesEvent ? (emotesEvent.getContent() || {}) : {};
let value = {};
for (let emote in emotes) {
value[emote] = emote;
}
//TODO: Decrypt the shortcodes and emotes if they are encrypted
// if (emotes) {
// console.log(room.roomId);
// console.log(room.name);
// console.log(emotes);
// }
//if (avatarUrl) avatarUrl = mediaFromMxc(avatarUrl).getSquareThumbnailHttp(96);
//emotes={}

this.state = {
emotes: emotes,
EmoteFieldsTouched: {},
Expand Down Expand Up @@ -128,7 +120,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
let cleanemotes = {}
let deletedItems = this.state.deletedItems;
let value = {}
//console.log(e.currentTarget.getAttribute("name"));
let id = e.currentTarget.getAttribute("id")
for (let emote in this.state.emotes) {
if (emote != id) {
Expand All @@ -141,13 +132,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
}

this.setState({ deleted: true, emotes: cleanemotes, deletedItems: deletedItems, value: value })
// document.querySelectorAll(".mx_EmoteSettings_existingEmoteCode").forEach(field => {
// field.setAttribute("value",(field as HTMLInputElement).id);
// field.setAttribute("defaultValue",(field as HTMLInputElement).id);
// })
// for(let DOMid in this.state.emotes){
// document.getElementById(DOMid).setAttribute("value",DOMid);
// }
return;

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

if (this.state.emotes || (this.state.newEmoteFileAdded && this.state.newEmoteCodeAdded)) {
//const emotes = await client.uploadContent(this.state.emotes);
//TODO: Encrypt the shortcode and the image data before uploading
if (this.state.newEmoteFileAdded && this.state.newEmoteCodeAdded) {
const newEmote = await client.uploadContent(this.state.newEmoteFile);
Expand All @@ -178,12 +161,6 @@ export default class RoomEmoteSettings extends React.Component<IProps, IState> {
if (this.state.EmoteFieldsTouched.hasOwnProperty(shortcode)) {
emotesMxcs[this.state.EmoteFieldsTouched[shortcode]] = this.state.emotes[shortcode];
value[this.state.EmoteFieldsTouched[shortcode]] = this.state.EmoteFieldsTouched[shortcode];

// document.querySelectorAll(".mx_EmoteSettings_existingEmoteCode").forEach(field => {
// if((field as HTMLInputElement).name===shortcode){
// (field as HTMLInputElement).name= this.state.EmoteFieldsTouched[shortcode];
// }
// })
}

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

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

/*newState.avatarUrl = mediaFromMxc(uri).getSquareThumbnailHttp(96);
newState.originalAvatarUrl = newState.avatarUrl;
newState.avatarFile = null;*/
} /*else if (this.state.originalAvatarUrl !== this.state.avatarUrl) {
await client.sendStateEvent(this.props.roomId, 'm.room.avatar', {}, '');
}*/
}
this.setState(newState as IState);
};


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

/>
<img className="mx_EmoteSettings_uploadedEmoteImage" src={
mediaFromMxc(this.state.emotes[emotecode]).srcHttp//.getSquareThumbnailHttp(96)
mediaFromMxc(this.state.emotes[emotecode]).srcHttp
} />
<div className="mx_EmoteSettings_uploadButton">
<AccessibleButton
Expand Down

0 comments on commit 047f39e

Please sign in to comment.