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

View file

@ -439,6 +439,12 @@ class Message extends SnowFlake{
replyline.classList.add("flexltr","replyflex"); replyline.classList.add("flexltr","replyflex");
// TODO: Fix this // TODO: Fix this
this.channel.getmessage(this.message_reference.message_id).then(message=>{ 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){ if(message.author.relationshipType === 2){
username.textContent = "Blocked user"; username.textContent = "Blocked user";
return; return;

View file

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

View file

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