fix(reactions): match redaction codepoint. && fix/styling(feed): bad pathing, cleanup.
This commit is contained in:
parent
58fe0c19d2
commit
a9073b0b9d
2 changed files with 23 additions and 16 deletions
|
@ -9,6 +9,7 @@ const sendEventWithMeta = async (roomId, content, meta) => {
|
||||||
};
|
};
|
||||||
|
|
||||||
const hasAttachment = (res) => {
|
const hasAttachment = (res) => {
|
||||||
|
if (res.status) res = res.status;
|
||||||
if (!res.media_attachments) return '<br>';
|
if (!res.media_attachments) return '<br>';
|
||||||
return res.media_attachments.map((media) => {
|
return res.media_attachments.map((media) => {
|
||||||
const mediaURL = new URL(media.remote_url);
|
const mediaURL = new URL(media.remote_url);
|
||||||
|
@ -19,14 +20,14 @@ const hasAttachment = (res) => {
|
||||||
|
|
||||||
const notifyFormatter = (res, roomId) => {
|
const notifyFormatter = (res, roomId) => {
|
||||||
userDetails = `<b><a href="${config.fediverse.domain}/${res.account.id}">
|
userDetails = `<b><a href="${config.fediverse.domain}/${res.account.id}">
|
||||||
${res.account.acct}</a></b>`;
|
${res.account.acct}</a>`;
|
||||||
switch (res.type) {
|
switch (res.type) {
|
||||||
case 'follow':
|
case 'follow':
|
||||||
fediverse.auth.me !== res.account.url ? res.meta = 'follow' : res.meta = 'redact';
|
fediverse.auth.me !== res.account.url ? res.meta = 'follow' : res.meta = 'redact';
|
||||||
meta = `${res.meta} ${res.account.id}`;
|
meta = `${res.meta} ${res.account.id}`;
|
||||||
content = `${userDetails}
|
content = `${userDetails}
|
||||||
<font color="#03b381"><b>has followed you.</b></font>
|
<font color="#03b381"><b>has followed you.</font>
|
||||||
<br><blockquote><i>${res.account.note}</i></blockquote>`;
|
<blockquote><i>${res.account.note}</i></blockquote>`;
|
||||||
sendEventWithMeta(roomId, content, meta);
|
sendEventWithMeta(roomId, content, meta);
|
||||||
break;
|
break;
|
||||||
case 'favourite':
|
case 'favourite':
|
||||||
|
@ -34,8 +35,11 @@ const notifyFormatter = (res, roomId) => {
|
||||||
meta = `${res.meta} ${res.status.id}`;
|
meta = `${res.meta} ${res.status.id}`;
|
||||||
content = `${userDetails}
|
content = `${userDetails}
|
||||||
<font color="#03b381"><b>has <a href="${res.status.uri}">favorited</a>
|
<font color="#03b381"><b>has <a href="${res.status.uri}">favorited</a>
|
||||||
your post:</b></font>
|
your post:</font>
|
||||||
<br><blockquote><i><b>${res.status.content}</i></b></blockquote>`;
|
<blockquote><i>${res.status.content}</i><br>
|
||||||
|
${hasAttachment(res)}
|
||||||
|
<br>(id: ${res.id}) ${registrar.post.visibilityEmoji(res.status.visibility)}
|
||||||
|
</blockquote>`;
|
||||||
sendEventWithMeta(roomId, content, res.meta);
|
sendEventWithMeta(roomId, content, res.meta);
|
||||||
break;
|
break;
|
||||||
case 'mention':
|
case 'mention':
|
||||||
|
@ -43,9 +47,10 @@ const notifyFormatter = (res, roomId) => {
|
||||||
meta = `${res.meta} ${res.status.id}`;
|
meta = `${res.meta} ${res.status.id}`;
|
||||||
content = `${userDetails}
|
content = `${userDetails}
|
||||||
<font color="#03b381"><b>has <a href="${res.status.uri}">mentioned</a>
|
<font color="#03b381"><b>has <a href="${res.status.uri}">mentioned</a>
|
||||||
you:</b></font><br><blockquote><i><b>${res.status.content}
|
you:</font><blockquote><i>${res.status.content}</i><br>
|
||||||
<br>(id: ${res.status.id}) ${registrar.post.visibilityEmoji(res.status.visibility)}</i></b>
|
${hasAttachment(res)}
|
||||||
</blockquote>`;
|
<br>(id: ${res.id}) ${registrar.post.visibilityEmoji(res.status.visibility)}
|
||||||
|
</blockquote>`;
|
||||||
sendEventWithMeta(roomId, content, meta);
|
sendEventWithMeta(roomId, content, meta);
|
||||||
break;
|
break;
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
|
@ -53,8 +58,10 @@ const notifyFormatter = (res, roomId) => {
|
||||||
meta = `${res.meta} ${res.status.id}`;
|
meta = `${res.meta} ${res.status.id}`;
|
||||||
content = `${userDetails}
|
content = `${userDetails}
|
||||||
<font color="#03b381"><b>has <a href="${res.status.uri}">repeated</a>
|
<font color="#03b381"><b>has <a href="${res.status.uri}">repeated</a>
|
||||||
your post:</b></font><br>
|
your post:</font><blockquote><i>${res.status.content}</i><br>
|
||||||
<blockquote><i><b>${res.status.content}</i></b></blockquote>`;
|
${hasAttachment(res)}
|
||||||
|
<br>(id: ${res.id}) ${registrar.post.visibilityEmoji(res.status.visibility)}
|
||||||
|
</blockquote>`;
|
||||||
sendEventWithMeta(roomId, content, meta);
|
sendEventWithMeta(roomId, content, meta);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -83,8 +90,8 @@ const isReblog = (res, roomId) => {
|
||||||
fediverse.auth.me !== res.account.url ? res.meta = 'status' : res.meta = 'unreblog';
|
fediverse.auth.me !== res.account.url ? res.meta = 'status' : res.meta = 'unreblog';
|
||||||
meta = `${res.meta} ${res.reblog.id}`;
|
meta = `${res.meta} ${res.reblog.id}`;
|
||||||
content = `${userDetails}
|
content = `${userDetails}
|
||||||
<font color="#7886D7"><b>has <a href="${config.fediverse.domain}/${res.reblog.id}">repeated</a>
|
<font color="#7886D7"><b>has <a href="${res.reblog.uri}">repeated</a>
|
||||||
${res.reblog.account.acct}'s post:</b></font>
|
${res.reblog.account.acct}'s post:</font>
|
||||||
<blockquote><i>${res.content}</i><br>
|
<blockquote><i>${res.content}</i><br>
|
||||||
${hasAttachment(res)}
|
${hasAttachment(res)}
|
||||||
<br>(id: ${res.reblog.id}) ${registrar.post.visibilityEmoji(res.visibility)}
|
<br>(id: ${res.reblog.id}) ${registrar.post.visibilityEmoji(res.visibility)}
|
||||||
|
|
8
utils.js
8
utils.js
|
@ -96,9 +96,9 @@ module.exports.handleReact = async (event) => {
|
||||||
if (!isMeta.includes(args[0])) return;
|
if (!isMeta.includes(args[0])) return;
|
||||||
let command = [];
|
let command = [];
|
||||||
args.shift().toLowerCase();
|
args.shift().toLowerCase();
|
||||||
if (reaction.key === '🔃') command = 'copy';
|
if (reaction.key === '🔁') command = 'copy';
|
||||||
if (reaction.key === '👏') command = 'clap';
|
if (reaction.key === '👏') command = 'clap';
|
||||||
if (reaction.key === '🗑') command = 'redact';
|
if (reaction.key === '🗑️️') command = 'redact';
|
||||||
eventHandler(args, roomId, command, event);
|
eventHandler(args, roomId, command, event);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,9 +123,9 @@ module.exports.selfReact = async (event) => {
|
||||||
const { meta } = event.getContent();
|
const { meta } = event.getContent();
|
||||||
if (!meta) return;
|
if (!meta) return;
|
||||||
const type = meta.split(' ')[0];
|
const type = meta.split(' ')[0];
|
||||||
if (type === 'redact' || type === 'unreblog') addReact(event, '🗑️');
|
if (type === 'redact' || type === 'unreblog') addReact(event, '🗑️️');
|
||||||
if (type === 'status' || type === 'reblog' || type === 'mention') {
|
if (type === 'status' || type === 'reblog' || type === 'mention') {
|
||||||
addReact(event, '🔃');
|
addReact(event, '🔁');
|
||||||
addReact(event, '👏');
|
addReact(event, '👏');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue