* Feature 🚀 : Ability to delete messages in chat channels - Sending message ID to frontend - Deleting Message - Use pusher to delete message realtime * Minor Bug 🐞: Show message action only for current user - User can delete or edit their own messages * Test cases added * Bug 🐞: Update message id for receiver Message id was not sent to receiver by pusher * Refactoring🛠: Message controller refactoring * Test Cases📝 : Specs for Delete message added * Feature 🚀 : Ability to edit messages * Test Cases📝 : Specs for Edit message added * added new column discoverable for public channel and changes in elasticsearch * fix corrections * changes in serializer file, added channel_discoverable * added checkbox with discoverable policy * changes in code for discoverable channels * accept and reject member invitation by mod * add joining request to closed groups * fixed merge error * changes in joining member to closed groups * join to closed group * changes in message action of joining * changes in chat upopened json * 🚀Feature : Ability to search Global Channels * touch updated_at in after commit update * 🚀Feature : Ability to send request to discoverable channel * 🚀Feature : Ability to send request to discoverable channel * created new route for joining closed channel * 🚀 Success handle on joining request sent * removed redundant code * join_channel improvement, removed authorization for join channel * list of joining requests * added joining_request status channels on search list * changes in mailer and query builder optimized * 🛠 Adding filter for new Query * added rspec for add membership method in controller * rspec for sending join channel request * invite join request channel list rspec * test case for query builder discoverable * viewable and discoverable channel list * refactored logic for search channels * 🚀 Check if Request already sent * 🛠 Optimizing code and making channelButton Component * 🛠 Optimizing codefor SVG problem * 🛠 Optimized action.js * changes in search controller query * hot fix * removed unwanted code * 🛠 Fix the Channel Name problem * 🛠 Optimizing code further for CodeClimate * added new column discoverable for public channel and changes in elasticsearch * fix corrections * changes in serializer file, added channel_discoverable * added checkbox with discoverable policy * changes in code for discoverable channels * accept and reject member invitation by mod * add joining request to closed groups * fixed merge error * changes in joining member to closed groups * join to closed group * changes in message action of joining * changes in chat upopened json * touch updated_at in after commit update * 🚀Feature : Ability to search Global Channels * 🚀Feature : Ability to send request to discoverable channel * 🚀Feature : Ability to send request to discoverable channel * created new route for joining closed channel * 🚀 Success handle on joining request sent * removed redundant code * join_channel improvement, removed authorization for join channel * list of joining requests * added joining_request status channels on search list * changes in mailer and query builder optimized * added rspec for add membership method in controller * rspec for sending join channel request * invite join request channel list rspec * 🛠 Adding filter for new Query * test case for query builder discoverable * viewable and discoverable channel list * refactored logic for search channels * 🚀 Check if Request already sent * 🛠 Optimizing code and making channelButton Component * 🛠 Optimizing codefor SVG problem * 🛠 Optimized action.js * changes in search controller query * hot fix * 🛠 Fix the Channel Name problem * 🛠 Fixing merge problem * 🛠 Optimizing code further for CodeClimate * updated UI for membership edit * fixed test casses and fixed UI for chat_channel_edit * 🛠napshots added * test cases fixed * 🛠 Test cases added for new component * channel settings accesible only by mod * 🛠 More Test cases added * 🛠 Svg code optimized * 🛠 Svg code optimized in videocontent * optimized code for search query * fix test case for query builder * changes in joining closed channel logic * refactored join channel * redirect to edit channel after joining request * changes in test case for redirect * optimized code * 🛠 Eslint bugs fixed * test case fixed * optimization * olving channel repetition problem * optimization of code for query builder * changes in query builder * test cases fixed * 🛠 Handling reduntant data on frontend * 🛠 Don't show data if no filter query * 🛠 Optimized code for fixing bugs and code coverage * 🛠 Optimizing code further for CodeClimate Co-authored-by: Parasgr-code <paras.gaur@skynox.tech>
84 lines
2.5 KiB
JavaScript
84 lines
2.5 KiB
JavaScript
import { h, Component } from 'preact';
|
|
import PropTypes from 'prop-types';
|
|
import Article from './article';
|
|
import ChannelRequest from './channelRequest';
|
|
export default class Content extends Component {
|
|
static propTypes = {
|
|
resource: PropTypes.object,
|
|
activeChannelId: PropTypes.number,
|
|
pusherKey: PropTypes.string,
|
|
fullscreen: PropTypes.bool,
|
|
};
|
|
|
|
render() {
|
|
const { onTriggerContent, fullscreen } = this.props;
|
|
if (!this.props.resource) {
|
|
return '';
|
|
}
|
|
const smartSvgIcon = (content, d) => (
|
|
<svg
|
|
data-content={content}
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
viewBox="0 0 24 24"
|
|
width="24"
|
|
height="24"
|
|
>
|
|
<path data-content={content} fill="none" d="M0 0h24v24H0z" />
|
|
<path data-content={content} d={d} />
|
|
</svg>
|
|
);
|
|
|
|
return (
|
|
<div
|
|
className="activechatchannel__activecontent activechatchannel__activecontent--sidecar"
|
|
id="chat_activecontent"
|
|
onClick={onTriggerContent}
|
|
>
|
|
<button
|
|
className="activechatchannel__activecontentexitbutton crayons-btn crayons-btn--secondary"
|
|
data-content="exit"
|
|
>
|
|
{smartSvgIcon(
|
|
'exit',
|
|
'M12 10.586l4.95-4.95 1.414 1.414-4.95 4.95 4.95 4.95-1.414 1.414-4.95-4.95-4.95 4.95-1.414-1.414 4.95-4.95-4.95-4.95L7.05 5.636z',
|
|
)}
|
|
</button>
|
|
<button
|
|
className="activechatchannel__activecontentexitbutton activechatchannel__activecontentexitbutton--fullscreen crayons-btn crayons-btn--secondary"
|
|
data-content="fullscreen"
|
|
style={{ left: '39px' }}
|
|
>
|
|
{' '}
|
|
{fullscreen
|
|
? smartSvgIcon(
|
|
'fullscreen',
|
|
'M18 7h4v2h-6V3h2v4zM8 9H2V7h4V3h2v6zm10 8v4h-2v-6h6v2h-4zM8 15v6H6v-4H2v-2h6z',
|
|
)
|
|
: smartSvgIcon(
|
|
'fullscreen',
|
|
'M20 3h2v6h-2V5h-4V3h4zM4 3h4v2H4v4H2V3h2zm16 16v-4h2v6h-6v-2h4zM4 19h4v2H2v-6h2v4z',
|
|
)}
|
|
</button>
|
|
{display(this.props)}
|
|
</div>
|
|
);
|
|
}
|
|
}
|
|
|
|
function display(props) {
|
|
const { resource } = props;
|
|
if (resource.type_of === 'loading-user') {
|
|
return <div className="loading-user" />;
|
|
}
|
|
if (resource.type_of === 'article') {
|
|
return <Article resource={resource} />;
|
|
}
|
|
if (resource.type_of === 'channel-request') {
|
|
return (
|
|
<ChannelRequest
|
|
resource={resource.data}
|
|
handleJoiningRequest={resource.handleJoiningRequest}
|
|
/>
|
|
);
|
|
}
|
|
}
|