Merge branch 'master' of github.com:hackersanddesigners/chatty-pub

merge with andre
This commit is contained in:
كارل مبارك 2021-07-15 13:29:59 +02:00
commit 6dcdc415fa
5 changed files with 15802 additions and 96 deletions

2
.gitignore vendored
View file

@ -22,3 +22,5 @@ pnpm-debug.log*
*.sln *.sln
*.sw? *.sw?
zuliprc zuliprc
Icon[\ ]

View file

4
front/.gitignore vendored
View file

@ -23,3 +23,7 @@ pnpm-debug.log*
*.sln *.sln
*.sw? *.sw?
zuliprc zuliprc
upload.sh
dist

15878
front/package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -39,10 +39,18 @@ export default {
return "```json\n" + JSON.stringify(this.message, null, 2) + "\n```"; return "```json\n" + JSON.stringify(this.message, null, 2) + "\n```";
}, },
content() { content() {
let url = process.env.VUE_APP_ZULIP_site;
let c = this.message.content.replace("\n", "<br/>"); let c = this.message.content.replace("\n", "<br/>");
// create absolute url on images and relative links
let url = process.env.VUE_APP_ZULIP_site;
c = c.replaceAll('src="', 'src="' + url); c = c.replaceAll('src="', 'src="' + url);
c = c.replaceAll('href="/', 'href="' + url + "/"); c = c.replaceAll('href="/', 'href="' + url + "/");
// replace it with the mirror domain for uploads
// replace this: https://chat.hackersanddesigners.nl/user_uploads/
// with this: https://chatty-pub-files.hackersanddesigners.nl/files/
c = c.replaceAll(
url + "/user_uploads/",
"https://chatty-pub-files.hackersanddesigners.nl/files/"
);
const referrers = this.$store.state.topics const referrers = this.$store.state.topics
.find((t) => t.title == this.message.subject) .find((t) => t.title == this.message.subject)
@ -53,14 +61,14 @@ export default {
m.responseTo.sender_id == this.message.sender_id && m.responseTo.sender_id == this.message.sender_id &&
this.message.content.includes(m.responseTo.quote) this.message.content.includes(m.responseTo.quote)
); );
console.log(c, referrers) console.log(c, referrers);
referrers.forEach((m) => { referrers.forEach((m) => {
const classes = m.reactions.map((r) => "u" + r.emoji_code).join(" "); const classes = m.reactions.map((r) => "u" + r.emoji_code).join(" ");
c = c.replace( c = c.replace(
m.responseTo.quote, m.responseTo.quote,
`<span class="${classes}">${m.responseTo.quote}</span>` `<span class="${classes}">${m.responseTo.quote}</span>`
); );
console.log(c) console.log(c);
}); });
return c; return c;
}, },