mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-04-26 18:57:15 -05:00
Allow highlighting on broadcast !faq,rfaq,daily,avatars (#11818)
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
Some checks are pending
Node.js CI / build (18.x) (push) Waiting to run
This commit is contained in:
parent
84f6e93478
commit
1832b39b7b
|
|
@ -772,12 +772,11 @@ export const commands: Chat.ChatCommands = {
|
||||||
const targetUser = this.broadcasting && !target ? null : this.getUserOrSelf(target);
|
const targetUser = this.broadcasting && !target ? null : this.getUserOrSelf(target);
|
||||||
const targetUserids = targetUser ? new Set([targetUser.id, ...targetUser.previousIDs]) :
|
const targetUserids = targetUser ? new Set([targetUser.id, ...targetUser.previousIDs]) :
|
||||||
target ? new Set([toID(target)]) : null;
|
target ? new Set([toID(target)]) : null;
|
||||||
if (targetUserids && targetUser !== user && !user.can('alts')) {
|
|
||||||
throw new Chat.ErrorMessage("You don't have permission to look at another user's avatars!");
|
|
||||||
}
|
|
||||||
|
|
||||||
const out = [];
|
const out = [];
|
||||||
if (targetUserids) {
|
if (targetUserids && (targetUser === user || user.can('alts'))) {
|
||||||
|
// If the user lacks permission to view avatars, the argument is ignored silently,
|
||||||
|
// so that it can highlight the target user.
|
||||||
const hasButton = !this.broadcasting && targetUser === user;
|
const hasButton = !this.broadcasting && targetUser === user;
|
||||||
for (const id of targetUserids) {
|
for (const id of targetUserids) {
|
||||||
const allowed = customAvatars[id]?.allowed;
|
const allowed = customAvatars[id]?.allowed;
|
||||||
|
|
|
||||||
|
|
@ -2128,7 +2128,7 @@ export const commands: Chat.ChatCommands = {
|
||||||
],
|
],
|
||||||
|
|
||||||
faq(target, room, user) {
|
faq(target, room, user) {
|
||||||
target = toID(target);
|
target = toID(this.splitOne(target)[0]);
|
||||||
const showAll = target === 'all';
|
const showAll = target === 'all';
|
||||||
if (showAll && this.shouldBroadcast()) {
|
if (showAll && this.shouldBroadcast()) {
|
||||||
throw new Chat.ErrorMessage(this.tr`You cannot broadcast all FAQs at once.`);
|
throw new Chat.ErrorMessage(this.tr`You cannot broadcast all FAQs at once.`);
|
||||||
|
|
|
||||||
|
|
@ -279,7 +279,7 @@ export const commands: Chat.ChatCommands = {
|
||||||
daily(target, room, user) {
|
daily(target, room, user) {
|
||||||
room = this.requireRoom();
|
room = this.requireRoom();
|
||||||
if (!room.persist) throw new Chat.ErrorMessage("This command is unavailable in temporary rooms.");
|
if (!room.persist) throw new Chat.ErrorMessage("This command is unavailable in temporary rooms.");
|
||||||
const key = toID(target);
|
const key = toID(this.splitOne(target)[0]);
|
||||||
if (!key) return this.parse('/help daily');
|
if (!key) return this.parse('/help daily');
|
||||||
|
|
||||||
if (!spotlights[room.roomid]?.[key]) {
|
if (!spotlights[room.roomid]?.[key]) {
|
||||||
|
|
|
||||||
|
|
@ -161,7 +161,7 @@ export const commands: Chat.ChatCommands = {
|
||||||
roomfaq(target, room, user, connection, cmd) {
|
roomfaq(target, room, user, connection, cmd) {
|
||||||
room = this.requireRoom();
|
room = this.requireRoom();
|
||||||
if (!roomFaqs[room.roomid]) throw new Chat.ErrorMessage("This room has no FAQ topics.");
|
if (!roomFaqs[room.roomid]) throw new Chat.ErrorMessage("This room has no FAQ topics.");
|
||||||
let topic: string = toID(target);
|
let topic: string = toID(this.splitOne(target)[0]);
|
||||||
if (topic === 'constructor') return false;
|
if (topic === 'constructor') return false;
|
||||||
if (!topic) {
|
if (!topic) {
|
||||||
return this.parse(`/join view-roomfaqs-${room.roomid}`);
|
return this.parse(`/join view-roomfaqs-${room.roomid}`);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user