change reaction api to match other interactions

Status reactions had an API similar to that of
announcement reactions, using PUT and DELETE at a
single endpoint.  I believe that for statuses, it
makes more sense to follow the convention of the
other interactions and use separate POST endpoints
for create and destroy respectively.
This commit is contained in:
fef 2022-12-01 02:24:08 +00:00 committed by Jeremy Kescher
parent 5d94cbfc31
commit b978e10bef
No known key found for this signature in database
GPG Key ID: 80A419A7A613DFA4
3 changed files with 5 additions and 5 deletions

View File

@ -7,7 +7,7 @@ class Api::V1::Statuses::ReactionsController < Api::BaseController
before_action :require_user!
before_action :set_status
def update
def create
ReactService.new.call(current_account, @status, params[:id])
render_empty
end

View File

@ -417,7 +417,7 @@ export const addReaction = (statusId, name) => (dispatch, getState) => {
dispatch(addReactionRequest(statusId, name, alreadyAdded));
}
api(getState).put(`/api/v1/statuses/${statusId}/reactions/${name}`).then(() => {
api(getState).post(`/api/v1/statuses/${statusId}/react/${name}`).then(() => {
dispatch(addReactionSuccess(statusId, name, alreadyAdded));
}).catch(err => {
if (!alreadyAdded) {
@ -451,7 +451,7 @@ export const addReactionFail = (statusId, name, error) => ({
export const removeReaction = (statusId, name) => (dispatch, getState) => {
dispatch(removeReactionRequest(statusId, name));
api(getState).delete(`/api/v1/statuses/${statusId}/reactions/${name}`).then(() => {
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${name}`).then(() => {
dispatch(removeReactionSuccess(statusId, name));
}).catch(err => {
dispatch(removeReactionFail(statusId, name, err));

View File

@ -437,7 +437,7 @@ export const addReaction = (statusId, name) => (dispatch, getState) => {
dispatch(addReactionRequest(statusId, name, alreadyAdded));
}
api(getState).put(`/api/v1/statuses/${statusId}/reactions/${name}`).then(() => {
api(getState).post(`/api/v1/statuses/${statusId}/react/${name}`).then(() => {
dispatch(addReactionSuccess(statusId, name, alreadyAdded));
}).catch(err => {
if (!alreadyAdded) {
@ -471,7 +471,7 @@ export const addReactionFail = (statusId, name, error) => ({
export const removeReaction = (statusId, name) => (dispatch, getState) => {
dispatch(removeReactionRequest(statusId, name));
api(getState).delete(`/api/v1/statuses/${statusId}/reactions/${name}`).then(() => {
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${name}`).then(() => {
dispatch(removeReactionSuccess(statusId, name));
}).catch(err => {
dispatch(removeReactionFail(statusId, name, err));