Update PersonalPins.plugin.js

This commit is contained in:
Mirco Wittrien 2018-12-28 15:16:56 +01:00
parent b7c3e58cc6
commit e385385a1d
1 changed files with 22 additions and 21 deletions

View File

@ -155,7 +155,7 @@ class PersonalPins {
getDescription () {return "Similar to normal pins. Lets you save messages as notes for yourself.";} getDescription () {return "Similar to normal pins. Lets you save messages as notes for yourself.";}
getVersion () {return "1.6.4";} getVersion () {return "1.6.5";}
getAuthor () {return "DevilBro";} getAuthor () {return "DevilBro";}
@ -295,26 +295,27 @@ class PersonalPins {
processMessageOptionPopout (instance, wrapper) { processMessageOptionPopout (instance, wrapper) {
if (!wrapper.querySelector(".btn-pinitem-personalpins") && !wrapper.querySelector(".btn-unpinitem-personalpins")) { if (!wrapper.querySelector(".btn-pinitem-personalpins") && !wrapper.querySelector(".btn-unpinitem-personalpins")) {
let pins = BDFDB.loadAllData(this, "pins"); let pins = BDFDB.loadAllData(this, "pins");
let channel = instance.props.channel; let channel = instance.props.channel;
let {messagediv, pos} = this.getMessageAndPos(instance._reactInternalFiber.return.return.return.memoizedProps.target); let target = instance.props.target || instance._reactInternalFiber.return.return.return.memoizedProps.target;
if (!messagediv || pos == -1) return; let {messagediv, pos} = this.getMessageAndPos(target);
if (pins[channel.guild_id] && pins[channel.guild_id][channel.id] && pins[channel.guild_id][channel.id][instance.props.message.id + "_" + pos]) { if (!messagediv || pos == -1) return;
$(this.popoutUnpinEntryMarkup) if (pins[channel.guild_id] && pins[channel.guild_id][channel.id] && pins[channel.guild_id][channel.id][instance.props.message.id + "_" + pos]) {
.on("click." + this.getName(), () => { $(this.popoutUnpinEntryMarkup)
this.removeNoteData(instance.props.message, instance.props.channel, pos); .on("click." + this.getName(), () => {
instance.props.onClose(); this.removeNoteData(instance.props.message, instance.props.channel, pos);
}) instance.props.onClose();
.appendTo(wrapper); })
} .appendTo(wrapper);
else { }
$(this.popoutPinEntryMarkup) else {
.on("click." + this.getName(), () => { $(this.popoutPinEntryMarkup)
this.addMessageToNotes(instance.props.message, instance._reactInternalFiber.return.return.return.memoizedProps.target, instance.props.channel); .on("click." + this.getName(), () => {
instance.props.onClose(); this.addMessageToNotes(instance.props.message, target, instance.props.channel);
}) instance.props.onClose();
.appendTo(wrapper); })
} .appendTo(wrapper);
}
} }
} }