show appropriate author credit for emojis

pull/216/head
Aevann 2023-10-26 17:58:58 +03:00
parent cdad9c2069
commit b60f3deb90
3 changed files with 14 additions and 14 deletions

View File

@ -163,7 +163,7 @@ function fetchEmojis() {
if (! (emojis instanceof Array ))
throw new TypeError("[EMOJI DIALOG] rDrama's server should have sent a JSON-coded Array!");
globalEmojis = emojis.map(({name, author, count}) => ({name, author, count}));
globalEmojis = emojis.map(({name, author_username, count}) => ({name, author_username, count}));
let classes = ["Marsey", "Platy", "Wolf", "Donkey Kong", "Tay", "Capy", "Carp", "Marsey Flags", "Marsey Alphabet", "Classic", "Rage", "Wojak", "Misc"]
@ -175,14 +175,11 @@ function fetchEmojis() {
emojisSearchDictionary.updateTag(emoji.name, emoji.name);
if (emoji.author_username !== undefined && emoji.author_username !== null)
if (!emoji.author_username.endsWith(' user')) {
emojisSearchDictionary.updateTag(`@${emoji.author_username.toLowerCase()}`, emoji.name);
if (emoji.author_original_username !== undefined && emoji.author_original_username !== null)
emojisSearchDictionary.updateTag(`@${emoji.author_original_username.toLowerCase()}`, emoji.name);
if (emoji.author_prelock_username !== undefined && emoji.author_prelock_username !== null)
emojisSearchDictionary.updateTag(`@${emoji.author_prelock_username.toLowerCase()}`, emoji.name);
}
if (emoji.tags instanceof Array)
for(let i = 0; i < emoji.tags.length; i++)
@ -192,8 +189,7 @@ function fetchEmojis() {
const emojiDOM = document.importNode(emojiButtonTemplateDOM.content, true).children[0];
emojiDOM.title = emoji.name
if (emoji.author_username !== undefined && emoji.author_username !== null)
emojiDOM.title += "\nauthor\t" + emoji.author_username
emojiDOM.title += "\nauthor\t" + emoji.author_username
if (emoji.count !== undefined)
emojiDOM.title += "\nused\t" + emoji.count;
emojiDOM.dataset.className = emoji.kind;
@ -414,8 +410,7 @@ function populate_speed_emoji_modal(results, textbox)
emoji_option_text.title = name;
if (emoji.author_username !== undefined && emoji.author_username !== null)
emoji_option_text.title += "\nauthor\t" + emoji.author_username
emoji_option_text.title += "\nauthor\t" + emoji.author_username
if (emoji.count !== undefined)
emoji_option_text.title += "\nused\t" + emoji.count;

View File

@ -99,7 +99,12 @@ def get_emojis(nsfw):
collected = []
for emoji, author in emojis:
if FEATURES['EMOJI_SUBMISSIONS']:
if author.id == 2:
if SITE == 'rdrama.net':
emoji.author_username = 'a WPD user'
else:
emoji.author_username = 'an rDrama user'
else:
emoji.author_username = author.username
emoji.author_original_username = author.original_username
emoji.author_prelock_username = author.prelock_username

View File

@ -46,10 +46,10 @@
{% if FEATURES['EMOJI_SUBMISSIONS'] %}
<td>
{% if emoji.author_id == 2 %}
{% if SITE_NAME == 'WPD' %}
an rDrama user
{% else %}
{% if SITE == 'rdrama.net' %}
a WPD user
{% else %}
an rDrama user
{% endif %}
{% else %}
{% set user = emoji.user %}