docbrown/app/javascript/chat/RequestManager/PersonalInvitationListItem.jsx
Sarthak Sharma 11820aa29b
[deploy] 🐞Fixes #9503 When joining a new room, user is not taken to the new room (#9564)
* 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

* Merge conflict resolved

* 🐞 Fixes bug #9503 When joining a new room, user is not taken to the new room

Co-authored-by: Narender Singh <narender2031@gmail.com>
2020-07-30 16:21:55 -04:00

59 lines
1.7 KiB
JavaScript

import { h } from 'preact';
import PropTypes from 'prop-types';
import { Button } from '@crayons';
const RequestListItem = ({ request, updateMembership }) => (
<div className="crayons-card mb-6">
<div className="crayons-card__body channel-request-card">
<div className="request-message d-flex flex-wrap">
You got invitation to join <b>{request.chat_channel_name}</b>.
</div>
<div className="request-actions">
<Button
className="m-2"
size="s"
variant="danger"
onClick={updateMembership}
data-channel-id={request.chat_channel_id}
data-membership-id={request.membership_id}
data-channel-slug={request.channel_modified_slug}
data-user-action="reject"
>
{' '}
Reject
</Button>
<Button
className="m-2"
size="s"
onClick={updateMembership}
data-channel-id={request.chat_channel_id}
data-membership-id={request.membership_id}
data-channel-slug={request.channel_modified_slug}
data-user-action="accept"
>
{' '}
Accept
</Button>
</div>
</div>
</div>
);
RequestListItem.propTypes = {
request: PropTypes.arrayOf(
PropTypes.shape({
name: PropTypes.string.isRequired,
membership_id: PropTypes.number.isRequired,
user_id: PropTypes.number.isRequired,
role: PropTypes.string.isRequired,
image: PropTypes.string.isRequired,
username: PropTypes.string.isRequired,
status: PropTypes.string.isRequired,
chat_channel_name: PropTypes.string.isRequired,
}),
).isRequired,
updateMembership: PropTypes.func.isRequired,
};
export default RequestListItem;