Merge branch '385-urdu-sender-name-fix' into 'dev'

fix urdu sender name and better object key check

For issue #385

See merge request keanuapp/keanuapp-weblite!168
This commit is contained in:
N Pex 2023-04-10 08:31:08 +00:00
commit 37b3d2d274
2 changed files with 18 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,15 @@ 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(); if ('body' in content) {
while (lines.length && !lines[0].startsWith("> ")) lines.shift(); const lines = content.body.split("\n").reverse() || [];
// Reply fallback has a blank line after it, so remove it to prevent leading newline while (lines.length && !lines[0].startsWith("> ")) lines.shift();
if (lines[0] === "") lines.shift(); // Reply fallback has a blank line after it, so remove it to prevent leading newline
const text = lines[0] && lines[0].replace(/^> (<.*> )?/g, ""); if (lines[0] === "") lines.shift();
if (text) { const text = lines[0] && lines[0].replace(/^> (<.*> )?/g, "");
return text; if (text) {
return text;
}
} }
if (this.inReplyToEvent) { if (this.inReplyToEvent) {
@ -122,13 +124,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;
}, },