This commit is contained in:
Mirco Wittrien 2019-11-28 09:32:01 +01:00
parent 4c6ef769fb
commit c5654f9991
2 changed files with 23 additions and 2 deletions

View File

@ -2137,7 +2137,7 @@ var BDFDB = {
if (type) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
return BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("ChannelContextMenu"), Object.assign({}, e, {
type,
channel,
channel: channel,
guild: LibraryModules.GuildStore.getGuild(channel.guild_id),
selected: channel.id == LibraryModules.LastChannelStore.getChannelId()
}));
@ -2198,6 +2198,27 @@ var BDFDB = {
}
return found;
};
BDFDB.DMUtils.openMenu = function (eleOrInfoOrId, e = BDFDB.mousePosition) {
if (!eleOrInfoOrId) return;
let id = Node.prototype.isPrototypeOf(eleOrInfoOrId) ? BDFDB.ChannelUtils.getId(eleOrInfoOrId) : (typeof eleOrInfoOrId == "object" ? eleOrInfoOrId.id : eleOrInfoOrId);
let channel = LibraryModules.ChannelStore.getChannel(id);
if (channel) {
if (channel.isMultiUserDM()) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
return BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("FluxContainer(GroupDMContextMenu)"), Object.assign({}, e, {
channelId: channel.id,
selected: channel.id == LibraryModules.LastChannelStore.getChannelId()
}));
}, {noBlurEvent: true});
else LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
return BDFDB.ReactUtils.createElement(BDFDB.ModuleUtils.findByName("UserContextMenu"), Object.assign({}, e, {
type: BDFDB.DiscordConstants.ContextMenuTypes.USER_PRIVATE_CHANNELS,
user: LibraryModules.UserStore.getUser(channel.recipients[0]),
channelId: channel.id,
selected: channel.id == LibraryModules.LastChannelStore.getChannelId()
}));
});
}
};
BDFDB.DMUtils.markAsRead = function (dms) {
if (!dms) return;
var unreadchannels = [];

File diff suppressed because one or more lines are too long