fix(dragify): pass message.author instead of author to onUserDragStart (#1119)
* fix(dragify): pass message.author instead of author to onUserDragStart The patch passed arguments[0].author which is a nickname display object with no .id. The full user object lives at arguments[0].message.author. Also flipped onUserDragStart priority so explicit user?.id wins over DOM inspection, since the caller's passed user is authoritative. * Apply suggestions from code review Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com> --------- Co-authored-by: thororen <78185467+thororen1234@users.noreply.github.com> Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
This commit is contained in:
parent
5aaa8c2a08
commit
972ae1184d
1 changed files with 3 additions and 3 deletions
|
|
@ -216,7 +216,7 @@ export default definePlugin({
|
|||
find: ']="BADGES"',
|
||||
replacement: {
|
||||
match: /(?="data-username-has-gradient")/,
|
||||
replace: "draggable:!0,onDragStart:e=>$self.onUserDragStart(e,arguments[0].author),\"data-dragify-user\":!0,\"data-user-id\":arguments[0].author.id,"
|
||||
replace: "draggable:!0,onDragStart:e=>$self.onUserDragStart(e,arguments[0].message?.author),\"data-dragify-user\":!0,\"data-user-id\":arguments[0].message?.author?.id,"
|
||||
}
|
||||
},
|
||||
// Call avatars (DM/group call tiles)
|
||||
|
|
@ -382,10 +382,10 @@ export default definePlugin({
|
|||
if (inspection.hasAttachment) return;
|
||||
|
||||
const rawUserId =
|
||||
inspection.authorId
|
||||
?? user?.id
|
||||
user?.id
|
||||
?? user?.userId
|
||||
?? user?.user?.id
|
||||
?? inspection.authorId
|
||||
?? inspection.userId
|
||||
?? null;
|
||||
const userId = rawUserId?.trim();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue