fix urdu sender name and object key check

This commit is contained in:
10G Meow 2023-04-09 14:53:16 +03:00
parent 19d3605e11
commit dd15a058ee
2 changed files with 20 additions and 15 deletions

View file

@ -29,7 +29,7 @@
"download_progress": "{پىرسەنت}% چۈشۈرۈلدى", "download_progress": "{پىرسەنت}% چۈشۈرۈلدى",
"edited": "تەھرىرلەندى", "edited": "تەھرىرلەندى",
"file_prefix": "ھۆججەت ", "file_prefix": "ھۆججەت ",
"user_said": "قوللانغۇچى سۆزلىدى:", "user_said": "{user} سۆزلىدى:",
"user_left": "قوللانغۇچى مۇنازىرىدىن چېكىندى", "user_left": "قوللانغۇچى مۇنازىرىدىن چېكىندى",
"user_joined": "قوللانغۇچى مۇنازىرىغا قاتناشتى", "user_joined": "قوللانغۇچى مۇنازىرىغا قاتناشتى",
"user_was_invited": "قوللانغۇچى مۇنازىرە ئۆيىگە تەكلىپ قىلىندى...", "user_was_invited": "قوللانغۇچى مۇنازىرە ئۆيىگە تەكلىپ قىلىندى...",

View file

@ -98,13 +98,17 @@ export default {
const relatesTo = this.event.getWireContent()["m.relates_to"]; const relatesTo = this.event.getWireContent()["m.relates_to"];
if (relatesTo && relatesTo["m.in_reply_to"]) { if (relatesTo && relatesTo["m.in_reply_to"]) {
const content = this.event.getContent(); const content = this.event.getContent();
const lines = content.body.split("\n").reverse(); console.log('content')
while (lines.length && !lines[0].startsWith("> ")) lines.shift(); console.log(content)
// Reply fallback has a blank line after it, so remove it to prevent leading newline if ('body' in content) {
if (lines[0] === "") lines.shift(); const lines = content.body.split("\n").reverse() || [];
const text = lines[0] && lines[0].replace(/^> (<.*> )?/g, ""); while (lines.length && !lines[0].startsWith("> ")) lines.shift();
if (text) { // Reply fallback has a blank line after it, so remove it to prevent leading newline
return text; if (lines[0] === "") lines.shift();
const text = lines[0] && lines[0].replace(/^> (<.*> )?/g, "");
if (text) {
return text;
}
} }
if (this.inReplyToEvent) { if (this.inReplyToEvent) {
@ -122,13 +126,14 @@ export default {
const relatesTo = this.event.getWireContent()["m.relates_to"]; const relatesTo = this.event.getWireContent()["m.relates_to"];
if (relatesTo && relatesTo["m.in_reply_to"]) { if (relatesTo && relatesTo["m.in_reply_to"]) {
const content = this.event.getContent(); const content = this.event.getContent();
if ('body' in content) {
// Remove the new text and strip "> " from the old original text // Remove the new text and strip "> " from the old original text
const lines = content.body.split("\n"); const lines = content.body.split("\n");
while (lines.length && lines[0].startsWith("> ")) lines.shift(); while (lines.length && lines[0].startsWith("> ")) lines.shift();
// Reply fallback has a blank line after it, so remove it to prevent leading newline // Reply fallback has a blank line after it, so remove it to prevent leading newline
if (lines[0] === "") lines.shift(); if (lines[0] === "") lines.shift();
return lines.join("\n"); return lines.join("\n");
}
} }
return this.event.getContent().body; return this.event.getContent().body;
}, },