Added helper methods to send ephemeral messages to specific users
Этот коммит содержится в:
@@ -9,6 +9,7 @@ import Constants from '../utils/constants.jsx';
|
||||
const ActionTypes = Constants.ActionTypes;
|
||||
import * as AsyncClient from '../utils/async_client.jsx';
|
||||
import * as Client from '../utils/client.jsx';
|
||||
import * as Utils from '../utils/utils.jsx';
|
||||
|
||||
export function emitChannelClickEvent(channel) {
|
||||
AsyncClient.getChannels(true);
|
||||
@@ -187,3 +188,20 @@ export function emitRemovePost(post) {
|
||||
post
|
||||
});
|
||||
}
|
||||
|
||||
export function sendEphemeralPost(message, channelId) {
|
||||
const timestamp = Utils.getTimestamp();
|
||||
const post = {
|
||||
id: Utils.generateId(),
|
||||
user_id: '0',
|
||||
channel_id: channelId || ChannelStore.getCurrentId(),
|
||||
message,
|
||||
type: Constants.POST_TYPE_EPHEMERAL,
|
||||
create_at: timestamp,
|
||||
update_at: timestamp,
|
||||
filenames: [],
|
||||
props: {}
|
||||
};
|
||||
|
||||
emitPostRecievedEvent(post);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,6 @@ function handleNewPostEvent(msg, translations) {
|
||||
mentions = JSON.parse(msg.props.mentions);
|
||||
}
|
||||
|
||||
const channelType = msgProps.channel_type;
|
||||
const channel = ChannelStore.get(msg.channel_id);
|
||||
const user = UserStore.getCurrentUser();
|
||||
const member = ChannelStore.getMember(msg.channel_id);
|
||||
@@ -192,7 +191,7 @@ function handleNewPostEvent(msg, translations) {
|
||||
|
||||
if (notifyLevel === 'none') {
|
||||
return;
|
||||
} else if (notifyLevel === 'mention' && mentions.indexOf(user.id) === -1 && channelType !== Constants.DM_CHANNEL) {
|
||||
} else if (notifyLevel === 'mention' && mentions.indexOf(user.id) === -1 && channel.type !== Constants.DM_CHANNEL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user