forwarding from channels and some other minor fixes
This commit is contained in:
@@ -102,7 +102,7 @@ class MessagesView extends React.Component {
|
||||
this.handleClosePreview = this.handleClosePreview.bind(this);
|
||||
this.handleFormResponse = this.handleFormResponse.bind(this);
|
||||
this.handleContextClick = this.handleContextClick.bind(this);
|
||||
this.handleShowContextMenuMessage = this.handleShowContextMenuMessage.bind(this);
|
||||
this.handleShowMessageContextMenu = this.handleShowMessageContextMenu.bind(this);
|
||||
this.handleNewChatAcceptance = this.handleNewChatAcceptance.bind(this);
|
||||
this.handleEnablePeer = this.handleEnablePeer.bind(this);
|
||||
this.handleAttachFile = this.handleAttachFile.bind(this);
|
||||
@@ -642,7 +642,11 @@ class MessagesView extends React.Component {
|
||||
this.props.showContextMenu({ topicName: this.state.topic, y: e.pageY, x: e.pageX });
|
||||
}
|
||||
|
||||
handleShowContextMenuMessage(params, messageSpecificMenuItems) {
|
||||
handleShowMessageContextMenu(params, messageSpecificMenuItems) {
|
||||
if (params.userFrom == 'chan') {
|
||||
params.userFrom = this.state.topic;
|
||||
params.userName = this.state.title;
|
||||
}
|
||||
params.topicName = this.state.topic;
|
||||
const menuItems = messageSpecificMenuItems || [];
|
||||
const topic = this.props.tinode.getTopic(params.topicName);
|
||||
@@ -950,7 +954,7 @@ class MessagesView extends React.Component {
|
||||
let previousFrom = null;
|
||||
let chatBoxClass = null;
|
||||
topic.messages((msg, prev, next, i) => {
|
||||
let nextFrom = next ? (next.from || null) : 'chan';
|
||||
let nextFrom = next ? (next.from || 'chan') : null;
|
||||
|
||||
let sequence = 'single';
|
||||
let thisFrom = msg.from || 'chan';
|
||||
@@ -994,6 +998,7 @@ class MessagesView extends React.Component {
|
||||
response={isReply}
|
||||
seq={msg.seq}
|
||||
isGroup={groupTopic}
|
||||
isChan={this.state.channel}
|
||||
userFrom={userFrom}
|
||||
userName={userName}
|
||||
userAvatar={userAvatar}
|
||||
@@ -1001,7 +1006,7 @@ class MessagesView extends React.Component {
|
||||
received={deliveryStatus}
|
||||
uploader={msg._uploader}
|
||||
viewportWidth={this.props.viewportWidth} // Used by `formatter`.
|
||||
showContextMenu={this.state.channel? false : this.handleShowContextMenuMessage}
|
||||
showContextMenu={this.handleShowMessageContextMenu}
|
||||
onImagePreview={this.handleImagePostview}
|
||||
onFormResponse={this.handleFormResponse}
|
||||
onError={this.props.onError}
|
||||
|
||||
@@ -15,7 +15,7 @@ import InfoView from './info-view.jsx';
|
||||
import MessagesView from './messages-view.jsx';
|
||||
import SidepanelView from './sidepanel-view.jsx';
|
||||
|
||||
import { API_KEY, APP_NAME, DEFAULT_P2P_ACCESS_MODE, LOGGING_ENABLED,
|
||||
import { API_KEY, APP_NAME, DEFAULT_P2P_ACCESS_MODE, FORWARDED_PREVIEW_LENGTH, LOGGING_ENABLED,
|
||||
MEDIA_BREAKPOINT, QUOTED_REPLY_LENGTH, RECEIVED_DELAY } from '../config.js';
|
||||
import { PACKAGE_VERSION } from '../version.js';
|
||||
import { base64ReEncode, makeImageUrl } from '../lib/blob-helpers.js';
|
||||
|
||||
@@ -71,13 +71,16 @@ class BaseChatMessage extends React.PureComponent {
|
||||
handleContextClick(e) {
|
||||
e.preventDefault();
|
||||
e.stopPropagation();
|
||||
const menuItems = this.props.received == Tinode.MESSAGE_STATUS_FAILED ? ['menu_item_send_retry'] : [];
|
||||
const menuItems = [];
|
||||
if (this.props.received == Tinode.MESSAGE_STATUS_FAILED) {
|
||||
menuItems.push('menu_item_send_retry');
|
||||
}
|
||||
if (this.props.userIsWriter &&
|
||||
this.props.received > Tinode.MESSAGE_STATUS_FAILED &&
|
||||
this.props.received < Tinode.MESSAGE_STATUS_DEL_RANGE) {
|
||||
menuItems.push('menu_item_reply');
|
||||
menuItems.push('menu_item_forward');
|
||||
}
|
||||
menuItems.push('menu_item_forward');
|
||||
|
||||
this.props.showContextMenu({
|
||||
seq: this.props.seq,
|
||||
|
||||
@@ -52,7 +52,6 @@ export default class ForwardDialog extends React.Component {
|
||||
let contacts = this.state.query != null ? this.props.searchResults : this.props.contacts;
|
||||
// Filter out contacts without a 'W' or 'J' permissions as well as the current topic.
|
||||
contacts = contacts.filter((c) => {
|
||||
console.log(c.name, this.props.topicSelected);
|
||||
return (c.name != this.props.topicSelected) && c.acs.isJoiner() && c.acs.isWriter();
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user