This commit is contained in:
Mirco Wittrien 2020-10-06 12:40:59 +02:00
parent 65a0638336
commit e307a2c14d
2 changed files with 8 additions and 8 deletions

View File

@ -2333,11 +2333,11 @@ module.exports = (_ => {
} }
}, instant ? 0 : 1000); }, instant ? 0 : 1000);
}; };
BDFDB.MessageUtils.openMenu = function (message, e = mousePosition) { BDFDB.MessageUtils.openMenu = function (message, e = mousePosition, slim = false) {
if (!message) return; if (!message) return;
let channel = LibraryModules.ChannelStore.getChannel(message.channel_id); let channel = LibraryModules.ChannelStore.getChannel(message.channel_id);
if (channel) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) { if (channel) LibraryModules.ContextMenuUtils.openContextMenu(e, function (e) {
return BDFDB.ReactUtils.createElement((BDFDB.ModuleUtils.findByName("MessageContextMenu", false) || {exports:{}}).exports.default, Object.assign({}, e, { return BDFDB.ReactUtils.createElement((BDFDB.ModuleUtils.findByName(slim ? "MessageSearchResultContextMenu" : "MessageContextMenu", false) || {exports:{}}).exports.default, Object.assign({}, e, {
message: message, message: message,
channel: channel channel: channel
})); }));

View File

@ -405,14 +405,14 @@ module.exports = (_ => {
renderMessage (buttonInstance, note, message, channel, filter) { renderMessage (buttonInstance, note, message, channel, filter) {
if (!message || !channel) return null; if (!message || !channel) return null;
let channelname = channel.name; let channelName = channel.name;
let guild = channel.guild_id && BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id); let guild = channel.guild_id && BDFDB.LibraryModules.GuildStore.getGuild(channel.guild_id);
let role = guild && BDFDB.LibraryModules.PermissionRoleUtils.getHighestRole(guild, message.author.id); let role = guild && BDFDB.LibraryModules.PermissionRoleUtils.getHighestRole(guild, message.author.id);
if (role) message.colorString = role.colorString; if (role) message.colorString = role.colorString;
if (filter != "channel" && !channelname && channel.recipients.length > 0) { if (filter != "channel" && !channelName && channel.recipients.length > 0) {
for (let dmuser_id of channel.recipients) { for (let dmuser_id of channel.recipients) {
channelname = channelname ? channelname + ", @" : channelname; channelName = channelName ? channelName + ", @" : channelName;
channelname = channelname + ((BDFDB.LibraryModules.UserStore.getUser(dmuser_id) || {}).username || BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER); channelName = channelName + ((BDFDB.LibraryModules.UserStore.getUser(dmuser_id) || {}).username || BDFDB.LanguageUtils.LanguageStrings.UNKNOWN_USER);
} }
} }
return [filter == "channel" ? null : BDFDB.ReactUtils.createElement("div", { return [filter == "channel" ? null : BDFDB.ReactUtils.createElement("div", {
@ -424,7 +424,7 @@ module.exports = (_ => {
onClick: _ => { onClick: _ => {
BDFDB.LibraryModules.SelectChannelUtils.selectChannel(channel.guild_id, channel.id); BDFDB.LibraryModules.SelectChannelUtils.selectChannel(channel.guild_id, channel.id);
}, },
children: channelname ? ((channel.guild_id ? "#" : "@") + channelname) : "???" children: channelName ? ((channel.guild_id ? "#" : "@") + channelName) : "???"
}), }),
filter == "all" ? BDFDB.ReactUtils.createElement("span", { filter == "all" ? BDFDB.ReactUtils.createElement("span", {
className: BDFDB.disCN.messagespopoutguildname, className: BDFDB.disCN.messagespopoutguildname,
@ -440,7 +440,7 @@ module.exports = (_ => {
message: message, message: message,
channel: channel, channel: channel,
onContextMenu: e => { onContextMenu: e => {
BDFDB.MessageUtils.openMenu(message, e); BDFDB.MessageUtils.openMenu(message, e, true);
} }
}), }),
BDFDB.ReactUtils.createElement("div", { BDFDB.ReactUtils.createElement("div", {