Skip to content

Commit

Permalink
Fix long title handling
Browse files Browse the repository at this point in the history
  • Loading branch information
1aerostorm committed Dec 16, 2023
1 parent e9e457f commit 5c8d160
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -973,6 +973,7 @@
"chain_errors": {
"only_comment_once_every": "You may only comment once every 20 seconds",
"only_post_once_every": "You may only post once every 5 minutes",
"too_long_title": "Too long post title.",
"exceeded_maximum_allowed_bandwidth": "Insufficient account bandwidth. Replenish the Golos Power or write to [email protected]",
"already_voted": "You have already voted in a similar way",
"only_vote_once_every": "Can only vote once every 3 seconds",
Expand Down
1 change: 1 addition & 0 deletions app/locales/ru-RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1036,6 +1036,7 @@
"chain_errors": {
"only_comment_once_every": "Комментировать можно не чаще, чем раз в 20 секунд",
"only_post_once_every": "Публиковать посты можно не чаще, чем раз в 5 минут",
"too_long_title": "Слишком длинный заголовок поста.",
"exceeded_maximum_allowed_bandwidth": "Недостаточно пропускной способности аккаунта. Пополните Силу Голоса или напишите на [email protected]",
"already_voted": "Вы уже голосовали за этот пост",
"only_vote_once_every": "Голосовать можно не чаще, чем раз в 3 секунды",
Expand Down
2 changes: 1 addition & 1 deletion app/redux/TransactionSaga.js
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ function* broadcastPayload({payload: {operations, keys, username, hideErrors, su
yield new Promise((resolve, reject) => {
broadcast.send({ extensions: [], operations }, keys, (err) => {
if(err) {
console.error(err);
console.error(err)
reject(err)
} else {
broadcastedEvent()
Expand Down
10 changes: 9 additions & 1 deletion app/redux/Transaction_Error.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,11 @@ export default function transactionErrorReducer(
const err_lines = error.message.split('\n');

if (err_lines.length > 2) {
errorKey = err_lines[1];
if (error.message.includes('Title larger than size limit') && err_lines.length >= 4) {
errorKey = err_lines[3]
} else {
errorKey = err_lines[1]
}
const txt = errorKey.split(': ');

if (txt.length && txt[txt.length - 1].trim() !== '') {
Expand Down Expand Up @@ -126,6 +130,10 @@ export default function transactionErrorReducer(
errorKey.includes('You may only post once every 5 minutes')
) {
errorKey = errorStr = tt('chain_errors.only_post_once_every');
} else if (
errorKey.includes('Title larger than size limit')
) {
errorKey = errorStr = tt('chain_errors.too_long_title')
} else if (
errorKey.includes(
'Account exceeded maximum allowed bandwidth per vesting share'
Expand Down

0 comments on commit 5c8d160

Please sign in to comment.