stuff
This commit is contained in:
parent
c5654f9991
commit
22eba17302
|
@ -2136,7 +2136,7 @@ var BDFDB = {
|
|||
}
|
||||
if (type) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
|
||||
return BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("ChannelContextMenu"), Object.assign({}, e, {
|
||||
type,
|
||||
type: type,
|
||||
channel: channel,
|
||||
guild: LibraryModules.GuildStore.getGuild(channel.guild_id),
|
||||
selected: channel.id == LibraryModules.LastChannelStore.getChannelId()
|
||||
|
|
|
@ -374,22 +374,7 @@ class PinDMs {
|
|||
if (e.node) {
|
||||
BDFDB.DOMUtils.removeClass(e.node, BDFDB.disCN._pindmsrecentpinned);
|
||||
e.node.removeEventListener("contextmenu", e.node.PinDMsContextMenuListener);
|
||||
e.node.PinDMsContextMenuListener = event => {
|
||||
let pinnedInGuild = this.isPinned(e.instance.props.channel.id, "pinnedRecents");
|
||||
BDFDB.ContextMenuUtils.open(this, event, BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItemGroup, {
|
||||
children: [
|
||||
BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: this.labels[pinnedInGuild ? "context_unpinguild_text" : "context_pinguild_text"],
|
||||
danger: pinnedInGuild,
|
||||
action: event2 => {
|
||||
BDFDB.ContextMenuUtils.close(event2.target);
|
||||
if (!pinnedInGuild) this.addPin(e.instance.props.channel.id, "pinnedRecents");
|
||||
else this.removePin(e.instance.props.channel.id, "pinnedRecents");
|
||||
}
|
||||
})
|
||||
]
|
||||
}));
|
||||
};
|
||||
e.node.PinDMsContextMenuListener = event => {BDFDB.DMUtils.openMenu(e.instance.props.channel.id, event);};
|
||||
e.node.addEventListener("contextmenu", e.node.PinDMsContextMenuListener);
|
||||
if (this.isPinned(e.instance.props.channel.id, "pinnedRecents")) {
|
||||
BDFDB.DOMUtils.addClass(e.node, BDFDB.disCN._pindmsrecentpinned);
|
||||
|
@ -436,12 +421,12 @@ class PinDMs {
|
|||
e.node.addEventListener("mousedown", e.node.PinDMsMouseDownListener);
|
||||
}
|
||||
}
|
||||
if (e.returnvalue && this.isPinned(e.instance.props.channel.id, "pinnedRecents")) {
|
||||
if (this.isPinned(e.instance.props.channel.id, "pinnedRecents") && BDFDB.DataUtils.get(this, "settings", "showPinIcon")) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name:"BlobMask"});
|
||||
if (index > -1 && !children[index].props.upperBadge && BDFDB.DataUtils.get(this, "settings", "showPinIcon")) children[index].props.upperBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.BadgeComponents.IconBadge, {
|
||||
if (index > -1) children[index].props.upperLeftBadge = BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.BadgeComponents.IconBadge, {
|
||||
className: BDFDB.disCN.guildbadgeiconbadge2,
|
||||
name: BDFDB.LibraryComponents.SvgIcon.Names.NOVA_PIN,
|
||||
style: {backgroundColor: null}
|
||||
style: {backgroundColor: null, transform: "scale(-1, 1)"}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -124,6 +124,19 @@ class ReadAllNotificationsButton {
|
|||
|
||||
// begin of own functions
|
||||
|
||||
onUserContextMenu (e) {
|
||||
if (e.instance.props.channelId && e.instance.props.type == BDFDB.DiscordConstants.ContextMenuTypes.USER_PRIVATE_CHANNELS) {
|
||||
e.returnvalue.props.children.props.children.props.children.unshift(BDFDB.ReactUtils.createElement(BDFDB.LibraryComponents.ContextMenuItem, {
|
||||
label: BDFDB.LanguageUtils.LanguageStrings.MARK_AS_READ,
|
||||
disabled: !BDFDB.LibraryModules.DirectMessageUnreadStore.getUnreadPrivateChannelIds().includes(e.instance.props.channelId),
|
||||
action: event => {
|
||||
BDFDB.ContextMenuUtils.close(event.target);
|
||||
BDFDB.DMUtils.markAsRead(e.instance.props.channelId);
|
||||
}
|
||||
}));
|
||||
}
|
||||
}
|
||||
|
||||
processGuilds (e) {
|
||||
let [children, index] = BDFDB.ReactUtils.findChildren(e.returnvalue, {name: "ConnectedUnreadDMs"});
|
||||
if (index > -1) children.splice(index + 1, 0, BDFDB.ReactUtils.createElement("div", {
|
||||
|
|
Loading…
Reference in New Issue