Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor desc. in non-autoconfirmed error messages #10257

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion server/chat-commands/info.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2772,7 +2772,10 @@ export const commands: Chat.ChatCommands = {
if (Monitor.countNetRequests(connection.ip)) {
return this.errorReply(`You are using this command too quickly. Wait a bit and try again.`);
}
if (!user.autoconfirmed) return this.errorReply(`Only autoconfirmed users can use this command.`);
if (!user.autoconfirmed) {
return this.errorReply(`Only autoconfirmed users can use this command. ` +
`Autoconfirmed users have won at least one rated battle and been registered for one week or longer`);
Comment on lines +2776 to +2777
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
return this.errorReply(`Only autoconfirmed users can use this command. ` +
`Autoconfirmed users have won at least one rated battle and been registered for one week or longer`);
return this.errorReply(
`Only autoconfirmed users can use this command. ` +
`Autoconfirmed users have won at least one rated battle and been registered for one week or longer`
);

}
target = toID(target);
if (!target) target = user.id;
let rawResult;
Expand Down
5 changes: 4 additions & 1 deletion server/chat-plugins/friends.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,10 @@ export const Friends = new class {
checkCanUse(context: Chat.CommandContext | Chat.PageContext) {
const user = context.user;
if (!user.autoconfirmed) {
throw new Chat.ErrorMessage(context.tr`You must be autoconfirmed to use the friends feature.`);
throw new Chat.ErrorMessage(context.tr(
`You must be autoconfirmed to use the friends feature ` +
`(autoconfirmed users have won at least one rated battle and been registered for one week or longer).`
));
}
if (user.locked || user.namelocked || user.semilocked || user.permalocked) {
throw new Chat.ErrorMessage(`You are locked, and so cannot use the friends feature.`);
Expand Down
7 changes: 6 additions & 1 deletion server/chat-plugins/teams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,12 @@ export const TeamsHandler = new class {
err("You cannot currently use the teams database.");
}
if (user.locked || user.semilocked) err("You cannot use the teams database while locked.");
if (!user.autoconfirmed) err("You must be autoconfirmed to use the teams database.");
if (!user.autoconfirmed) {
err(
"You must be autoconfirmed to use the teams database " +
"(autoconfirmed users have won at least one rated battle and been registered for one week or longer)."
);
}
}
async count(user: string | User) {
const id = toID(user);
Expand Down
3 changes: 2 additions & 1 deletion server/chat-plugins/wifi.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,8 @@ export class QuestionGiveaway extends Giveaway {
tid = toID(tid);
if (isNaN(parseInt(tid)) || tid.length < 5 || tid.length > 6) throw new Chat.ErrorMessage("Invalid TID");
if (!targetUser.autoconfirmed) {
throw new Chat.ErrorMessage(`User '${targetUser.name}' needs to be autoconfirmed to give something away.`);
throw new Chat.ErrorMessage(`User '${targetUser.name}' needs to be autoconfirmed ` +
`(have won at least one rated battle and been registered for one week or longer) to give something away.`);
}
if (Giveaway.checkBanned(context.room!, targetUser)) {
throw new Chat.ErrorMessage(`User '${targetUser.name}' is giveaway banned.`);
Expand Down
4 changes: 3 additions & 1 deletion server/chat.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1236,7 +1236,9 @@ export class CommandContext extends MessageContext {
// If the corresponding config option is set, non-AC users cannot send links, except to staff.
if (Config.restrictLinks && !user.autoconfirmed) {
if (this.checkBannedLinks(message).length && !(targetUser?.can('lock') || room?.settings.isHelp)) {
throw new Chat.ErrorMessage("Your account must be autoconfirmed to send links to other users, except for global staff.");
throw new Chat.ErrorMessage("Your account must be autoconfirmed " +
"(have won at least one rated battle and been registered for one week or longer) " +
"to send links to other users, except for global staff.");
}
}

Expand Down
3 changes: 2 additions & 1 deletion server/ladders.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ class Ladder extends LadderStore {
if (currentChallenges && currentChallenges.length >= 3 && !user.autoconfirmed) {
connection.popup(
`This user already has 3 pending challenges.\n` +
`You must be autoconfirmed to challenge them.`
`You must be autoconfirmed to challenge them.\n` +
`(Autoconfirmed users have won at least one rated battle and been registered for one week or longer.)`
);
return false;
}
Expand Down
5 changes: 4 additions & 1 deletion server/private-messages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,10 @@ export const PrivateMessages = new class {
}
if (!(options.isLogin ? user.registered : user.autoconfirmed)) {
if (options.forceBool) return false;
throw new Chat.ErrorMessage("You must be autoconfirmed to use offine messaging.");
throw new Chat.ErrorMessage(
"You must be autoconfirmed to use offine messaging " +
"(autoconfirmed users have won at least one rated battle and been registered for one week or longer)."
);
}
if (!Users.globalAuth.atLeast(user, Config.usesqlitepms)) {
if (options.forceBool) return false;
Expand Down