This commit is contained in:
MathMan05 2024-12-10 11:44:56 -06:00
parent 127a9e8250
commit 0ced3f594c
4 changed files with 23 additions and 3 deletions

View file

@ -761,7 +761,7 @@ class Channel extends SnowFlake{
typebox.classList.remove("typeboxreplying");
}
}
async getmessage(id: string): Promise<Message>{
async getmessage(id: string): Promise<Message|undefined>{
const message = this.messages.get(id);
if(message){
return message;
@ -771,6 +771,9 @@ class Channel extends SnowFlake{
{ headers: this.headers }
);
const json = await gety.json();
if(json.length===0){
return undefined;
}
return new Message(json[0], this);
}
}

View file

@ -439,6 +439,12 @@ class Message extends SnowFlake{
replyline.classList.add("flexltr","replyflex");
// TODO: Fix this
this.channel.getmessage(this.message_reference.message_id).then(message=>{
if(!message){
minipfp.remove();
username.textContent=I18n.getTranslation("message.deleted");
username.classList.remove("username");
return;
}
if(message.author.relationshipType === 2){
username.textContent = "Blocked user";
return;

View file

@ -164,7 +164,12 @@ class User extends SnowFlake{
this.contextmenu.addbutton(()=>I18n.getTranslation("user.friendReq"), function(this: User){
this.changeRelationship(1);
},null,function(){
return this.relationshipType===0;
return this.relationshipType===0||this.relationshipType===3;
});
this.contextmenu.addbutton(()=>I18n.getTranslation("friends.removeFriend"), function(this: User){
this.changeRelationship(0);
},null,function(){
return this.relationshipType===1;
});
this.contextmenu.addbutton(
()=>I18n.getTranslation("user.kick"),
@ -363,11 +368,15 @@ class User extends SnowFlake{
}
if(member){
member.bind(html);
}else{
User.contextmenu.bindContextmenu(html, this, undefined);
}
})
.catch(err=>{
console.log(err);
});
}else{
User.contextmenu.bindContextmenu(html, this, undefined);
}
if(guild){
this.profileclick(html, guild);

View file

@ -322,7 +322,8 @@
"reactionAdd":"Add reaction",
"delete":"Delete message",
"edit":"Edit message",
"edited":"(edited)"
"edited":"(edited)",
"deleted":"Deleted message"
},
"instanceStats":{
"name":"Instance stats: $1",
@ -364,6 +365,7 @@
"blocked":"Blocked",
"blockedusers":"Blocked Users:",
"addfriend":"Add Friend",
"removeFriend":"Remove Friend",
"addfriendpromt":"Add friends by username:",
"notfound":"User not found",
"discnotfound":"Discriminator not found",