fix 404 when reacting with Keycap Number Sign
The Unicode sequence for this emoji starts with an ASCII # character, which the browser's URI parser truncates before sending the request to the backend.
This commit is contained in:
parent
c3248a72c0
commit
79646a499a
|
@ -416,7 +416,9 @@ export const addReaction = (statusId, name, url) => (dispatch, getState) => {
|
||||||
dispatch(addReactionRequest(statusId, name, url));
|
dispatch(addReactionRequest(statusId, name, url));
|
||||||
}
|
}
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${statusId}/react/${name}`).then(() => {
|
// encodeURIComponent is required for the Keycap Number Sign emoji, see:
|
||||||
|
// <https://github.com/glitch-soc/mastodon/pull/1980#issuecomment-1345538932>
|
||||||
|
api(getState).post(`/api/v1/statuses/${statusId}/react/${encodeURIComponent(name)}`).then(() => {
|
||||||
dispatch(addReactionSuccess(statusId, name));
|
dispatch(addReactionSuccess(statusId, name));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (!alreadyAdded) {
|
if (!alreadyAdded) {
|
||||||
|
@ -448,7 +450,7 @@ export const addReactionFail = (statusId, name, error) => ({
|
||||||
export const removeReaction = (statusId, name) => (dispatch, getState) => {
|
export const removeReaction = (statusId, name) => (dispatch, getState) => {
|
||||||
dispatch(removeReactionRequest(statusId, name));
|
dispatch(removeReactionRequest(statusId, name));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${name}`).then(() => {
|
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${encodeURIComponent(name)}`).then(() => {
|
||||||
dispatch(removeReactionSuccess(statusId, name));
|
dispatch(removeReactionSuccess(statusId, name));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(removeReactionFail(statusId, name, err));
|
dispatch(removeReactionFail(statusId, name, err));
|
||||||
|
|
|
@ -436,7 +436,9 @@ export const addReaction = (statusId, name, url) => (dispatch, getState) => {
|
||||||
dispatch(addReactionRequest(statusId, name, url));
|
dispatch(addReactionRequest(statusId, name, url));
|
||||||
}
|
}
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${statusId}/react/${name}`).then(() => {
|
// encodeURIComponent is required for the Keycap Number Sign emoji, see:
|
||||||
|
// <https://github.com/glitch-soc/mastodon/pull/1980#issuecomment-1345538932>
|
||||||
|
api(getState).post(`/api/v1/statuses/${statusId}/react/${encodeURIComponent(name)}`).then(() => {
|
||||||
dispatch(addReactionSuccess(statusId, name));
|
dispatch(addReactionSuccess(statusId, name));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
if (!alreadyAdded) {
|
if (!alreadyAdded) {
|
||||||
|
@ -468,7 +470,7 @@ export const addReactionFail = (statusId, name, error) => ({
|
||||||
export const removeReaction = (statusId, name) => (dispatch, getState) => {
|
export const removeReaction = (statusId, name) => (dispatch, getState) => {
|
||||||
dispatch(removeReactionRequest(statusId, name));
|
dispatch(removeReactionRequest(statusId, name));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${name}`).then(() => {
|
api(getState).post(`/api/v1/statuses/${statusId}/unreact/${encodeURIComponent(name)}`).then(() => {
|
||||||
dispatch(removeReactionSuccess(statusId, name));
|
dispatch(removeReactionSuccess(statusId, name));
|
||||||
}).catch(err => {
|
}).catch(err => {
|
||||||
dispatch(removeReactionFail(statusId, name, err));
|
dispatch(removeReactionFail(statusId, name, err));
|
||||||
|
|
Reference in New Issue