1
0
Fork 0
mirror of https://github.com/FrankerFaceZ/FrankerFaceZ.git synced 2025-09-15 17:46:55 +00:00

Toggle highlighting works, it's just very basic

This commit is contained in:
gr3ger 2020-09-25 20:19:27 +02:00
parent 472f9472ee
commit c836d33aba
3 changed files with 42 additions and 1 deletions

View file

@ -69,7 +69,8 @@ export default class Actions extends Module {
{v: {action: 'unban', appearance: {type: 'icon', icon: 'ffz-i-ok'}, options: {}, display: {mod: true, mod_icons: true, deleted: true}}},
{v: {action: 'timeout', appearance: {type: 'icon', icon: 'ffz-i-clock'}, display: {mod: true, mod_icons: true}}},
{v: {action: 'msg_delete', appearance: {type: 'icon', icon: 'ffz-i-trash'}, options: {}, display: {mod: true, mod_icons: true}}},
{v: {action: 'reply', appearance: {type: 'icon', icon: 'ffz-i-reply'}, options: {}, display: {}}}
{v: {action: 'reply', appearance: {type: 'icon', icon: 'ffz-i-reply'}, options: {}, display: {}}},
{v: {action: 'highlight', appearance: {type: 'icon', icon: 'ffz-i-eye'}, options: {}, display: {}}}
],
type: 'array_merge',

View file

@ -354,6 +354,39 @@ export const untimeout = {
}
}
export const highlight = {
presets: [{
appearance: {
type: 'icon',
icon: 'ffz-i-eye'
},
}],
defaults: {},
required_context: ['user'],
title: 'Highlight User',
tooltip(data) {
return this.i18n.t('chat.actions.highlight.tooltip', 'Highlight {user.login}', {user: data});
},
click(event, data) {
let key = 'chat.filtering.highlight-temp'
let val = this.settings.provider.get(key)
if(!val)
val = []
if(val.includes(data.user.id))
val = val.filter(value => value !== data.user.id);
else
val.push(data.user.id)
this.settings.provider.set(key, val)
}
}
// ============================================================================
// Whisper

View file

@ -433,6 +433,13 @@ export const UserHighlights = {
}
}
if(this.context.manager.provider.get('chat.filtering.highlight-temp')?.includes(msg.user.userID))
{
(msg.highlights = (msg.highlights || new Set())).add('user');
msg.mentioned = true;
return tokens;
}
return tokens;
}
}