feat(pleroma): add post visibility
This commit is contained in:
parent
80dcff0440
commit
a7e32b5a3f
3 changed files with 7 additions and 4 deletions
|
@ -15,11 +15,11 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
||||||
matrixClient.sendHtmlNotice(room.roomId,
|
matrixClient.sendHtmlNotice(room.roomId,
|
||||||
'',
|
'',
|
||||||
`<b><a href="${registrar.config.fediverse.domain}/notice/${events.data[0].id}">${events.data[0].account.acct}</a>
|
`<b><a href="${registrar.config.fediverse.domain}/notice/${events.data[0].id}">${events.data[0].account.acct}</a>
|
||||||
<blockquote><i>${events.data[0].content}<br>
|
<blockquote><i>${events.data[0].content}</i><br>
|
||||||
${events.data[0].media_attachments.map(media =>
|
${events.data[0].media_attachments.map(media =>
|
||||||
`<a href="${media.remote_url}">`+`${media.description}`+'</a>'
|
`<a href="${media.remote_url}">`+`${media.description}`+'</a>'
|
||||||
).join('<br>')}
|
).join('<br>')}
|
||||||
(id: ${events.data[0].id}</a>)
|
(id: ${events.data[0].id}) ${registrar.media.visibilityEmoji(events.data[0].visibility)}
|
||||||
</blockquote>`);
|
</blockquote>`);
|
||||||
} else {
|
} else {
|
||||||
matrixClient.sendHtmlNotice(room.roomId,
|
matrixClient.sendHtmlNotice(room.roomId,
|
||||||
|
@ -32,7 +32,7 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
||||||
${events.data[0].media_attachments.map(media =>
|
${events.data[0].media_attachments.map(media =>
|
||||||
`<a href="${media.remote_url}">`+`Proxied image, no description available.`+'</a>'
|
`<a href="${media.remote_url}">`+`Proxied image, no description available.`+'</a>'
|
||||||
).join('<br>')}
|
).join('<br>')}
|
||||||
<br>(id: ${events.data[0].id})
|
<br>(id: ${events.data[0].id}) ${registrar.media.visibilityEmoji(events.data[0].visibility)}
|
||||||
</blockquote>`);
|
</blockquote>`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,9 @@ const qs = require('qs');
|
||||||
const axios = require('axios');
|
const axios = require('axios');
|
||||||
const FormData = require('form-data');
|
const FormData = require('form-data');
|
||||||
|
|
||||||
|
const emojis = { public: 'ðŸŒ', unlisted: 'ðŸ“', private: '🔒ï¸', direct: '✉ï¸' };
|
||||||
|
exports.visibilityEmoji = v => emojis[v] || v;
|
||||||
|
|
||||||
const getFilename = header => {
|
const getFilename = header => {
|
||||||
if(typeof header !== 'string') return null;
|
if(typeof header !== 'string') return null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -34,7 +34,7 @@ exports.runQuery = function (matrixClient, room, registrar) {
|
||||||
${notifications.data[0].account.acct}</a></b>
|
${notifications.data[0].account.acct}</a></b>
|
||||||
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">mentioned</a>
|
<font color="#03b381"><b>has <a href="${notifications.data[0].status.uri}">mentioned</a>
|
||||||
you:</b></font><br><blockquote><i><b>${notifications.data[0].status.content}
|
you:</b></font><br><blockquote><i><b>${notifications.data[0].status.content}
|
||||||
<br>(id: ${notifications.data[0].status.id})</i></b>
|
<br>(id: ${notifications.data[0].status.id}) ${registrar.media.visibilityEmoji(notifications.data[0].status.visibility)}</i></b>
|
||||||
</blockquote>`);
|
</blockquote>`);
|
||||||
} else if (notifications.data[0].type === 'reblog') {
|
} else if (notifications.data[0].type === 'reblog') {
|
||||||
matrixClient.sendHtmlNotice(room.roomId,
|
matrixClient.sendHtmlNotice(room.roomId,
|
||||||
|
|
Loading…
Reference in a new issue