* 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 * 🐞 Channel List bug in mobile view * changes in joining request responses * 🛠 Request Managers Frontend ready * changes in routes for adding and removing remembership * 🚀 New routes implemented for request manager * fix issues * changes in api for remove membership * Merge conflict resolved * 🐞 Channel List bug in mobile view * changes in joining request responses * 🛠 Request Managers Frontend ready * changes in routes for adding and removing remembership * 🚀 New routes implemented for request manager * fix issues * changes in api for remove membership * 🛠Optimizing for CodeClimate * 🛠Optimizing again for CodeClimate * 🛠Optimizing again 2 for CodeClimate * 🛠 Added more test cases * 🛠 Optimizing code * 🛠 vscode file changed * 🛠 Updated schema as requested Co-authored-by: Parasgr-code <paras.gaur@skynox.tech>
71 lines
1.6 KiB
JavaScript
71 lines
1.6 KiB
JavaScript
export function rejectJoiningRequest(
|
|
channelId,
|
|
membershipId,
|
|
successCb,
|
|
failureCb,
|
|
) {
|
|
fetch(`/chat_channel_memberships/remove_membership`, {
|
|
method: 'POST',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'X-CSRF-Token': window.csrfToken,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
status: 'pending',
|
|
chat_channel_id: channelId,
|
|
membership_id: membershipId,
|
|
}),
|
|
credentials: 'same-origin',
|
|
})
|
|
.then((response) => response.json())
|
|
.then(successCb)
|
|
.catch(failureCb);
|
|
}
|
|
|
|
export function acceptJoiningRequest(
|
|
channelId,
|
|
membershipId,
|
|
successCb,
|
|
failureCb,
|
|
) {
|
|
fetch(`/chat_channel_memberships/add_membership`, {
|
|
method: 'POST',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'X-CSRF-Token': window.csrfToken,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
chat_channel_id: channelId,
|
|
membership_id: membershipId,
|
|
chat_channel_membership: {
|
|
user_action: 'accept',
|
|
},
|
|
}),
|
|
credentials: 'same-origin',
|
|
})
|
|
.then((response) => response.json())
|
|
.then(successCb)
|
|
.catch(failureCb);
|
|
}
|
|
|
|
export function sendChannelRequest(id, successCb, failureCb) {
|
|
fetch(`/join_chat_channel`, {
|
|
method: 'POST',
|
|
headers: {
|
|
Accept: 'application/json',
|
|
'X-CSRF-Token': window.csrfToken,
|
|
'Content-Type': 'application/json',
|
|
},
|
|
body: JSON.stringify({
|
|
chat_channel_membership: {
|
|
chat_channel_id: id,
|
|
},
|
|
}),
|
|
credentials: 'same-origin',
|
|
})
|
|
.then((response) => response.json())
|
|
.then(successCb)
|
|
.catch(failureCb);
|
|
}
|