mirror of
https://github.com/smogon/pokemon-showdown.git
synced 2026-06-03 14:28:53 -05:00
Friends: Match behavior with online friend requests when only one request is pending
This commit is contained in:
parent
3316bf3ffb
commit
34f9e33116
|
|
@ -27,8 +27,21 @@ export const Friends = new class {
|
|||
const friendRequests = await Chat.Friends.getRequests(user);
|
||||
const pendingCount = friendRequests.received.size;
|
||||
if (pendingCount < 1) return;
|
||||
sendPM(`/nonotify You have ${pendingCount} friend requests pending!`, user.id);
|
||||
sendPM(`/raw <button class="button" name="send" value="/j view-friends-received">View</button></div>`, user.id);
|
||||
if (pendingCount === 1) {
|
||||
let buf = Utils.html`/uhtml sent,<button class="button" name="send" value="/friends accept ${user.id}">Accept</button> | `;
|
||||
buf += Utils.html`<button class="button" name="send" value="/friends reject ${user.id}">Deny</button><br /> `;
|
||||
buf += `<small>(You can also stop this user from sending you friend requests with <code>/ignore</code>)</small>`;
|
||||
sendPM(Utils.html`/html <span class="username">${user.name}</span> sent you a friend request!`, user.id);
|
||||
sendPM(buf, user.id);
|
||||
sendPM(
|
||||
`/raw <small>Note: If this request is accepted, your friend will be notified when you come online, ` +
|
||||
`and you will be notified when they do, unless you opt out of receiving them.</small>`,
|
||||
user.id
|
||||
);
|
||||
} else {
|
||||
sendPM(`/nonotify You have ${pendingCount} friend requests pending!`, user.id);
|
||||
sendPM(`/raw <button class="button" name="send" value="/j view-friends-received">View</button></div>`, user.id);
|
||||
}
|
||||
}
|
||||
async notifyConnection(user: User) {
|
||||
const connected = await Chat.Friends.getLastLogin(user.id);
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ export class FriendsDatabase {
|
|||
|
||||
const result = await this.transaction('send', [user.id, receiverID]);
|
||||
if (receiver) {
|
||||
sendPM(`/text ${Utils.escapeHTML(user.name)} sent you a friend request!`, receiver.id);
|
||||
sendPM(`/html <span class="username">${user.name}</span> sent you a friend request!`, receiver.id);
|
||||
sendPM(buf, receiver.id);
|
||||
sendPM(disclaimer, receiver.id);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user