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
b7d563611f
commit
9b2cfc3191
2 changed files with 8 additions and 4 deletions
|
@ -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));
|
||||||
|
|
Loading…
Reference in a new issue