diff --git a/backend/app/store/engine/bolt.go b/backend/app/store/engine/bolt.go index 0eb11f42..25725a0e 100644 --- a/backend/app/store/engine/bolt.go +++ b/backend/app/store/engine/bolt.go @@ -797,6 +797,14 @@ func (b *BoltDB) deleteComment(bdb *bolt.DB, locator store.Locator, commentID st if e = b.load(postBkt, commentID, &comment); e != nil { return errors.Wrapf(e, "can't load key %s from bucket %s", commentID, locator.URL) } + + if !comment.Deleted { + // decrement comments count for post url + if _, e = b.count(tx, comment.Locator.URL, -1); e != nil { + return errors.Wrapf(e, "failed to decrement count for %s", comment.Locator) + } + } + // set deleted status and clear fields comment.SetDeleted(mode) @@ -810,11 +818,6 @@ func (b *BoltDB) deleteComment(bdb *bolt.DB, locator store.Locator, commentID st return errors.Wrapf(e, "can't delete key %s from bucket %s", commentID, lastBucketName) } - // decrement comments count for post url - if _, e = b.count(tx, comment.Locator.URL, -1); e != nil { - return errors.Wrapf(e, "failed to decrement count for %s", comment.Locator) - } - return nil }) } diff --git a/backend/app/store/engine/bolt_test.go b/backend/app/store/engine/bolt_test.go index dd30303b..61461c7c 100644 --- a/backend/app/store/engine/bolt_test.go +++ b/backend/app/store/engine/bolt_test.go @@ -694,6 +694,10 @@ func TestBolt_DeleteComment(t *testing.T) { assert.True(t, res[0].Deleted, "marked deleted") assert.Equal(t, store.User{Name: "user name", ID: "user1", Picture: "", Admin: false, Blocked: false, IP: ""}, res[0].User) + // repeated deletion should not decrease comments count + err = b.Delete(delReq) + assert.NoError(t, err) + assert.Equal(t, "some text2", res[1].Text) assert.False(t, res[1].Deleted) @@ -807,10 +811,22 @@ func TestBoltAdmin_DeleteUserHard(t *testing.T) { b, teardown := prep(t) defer teardown() - err := b.Delete(DeleteRequest{Locator: store.Locator{SiteID: "radio-t"}, UserID: "user1", DeleteMode: store.HardDelete}) + comments, err := b.Find(FindRequest{Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com"}, Sort: "time"}) + assert.NoError(t, err) + + // soft delete one comment + delReq := DeleteRequest{ + Locator: store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, + CommentID: comments[0].ID, + DeleteMode: store.SoftDelete, + } + err = b.Delete(delReq) + assert.NoError(t, err) + + err = b.Delete(DeleteRequest{Locator: store.Locator{SiteID: "radio-t"}, UserID: "user1", DeleteMode: store.HardDelete}) require.NoError(t, err) - comments, err := b.Find(FindRequest{Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com"}, Sort: "time"}) + comments, err = b.Find(FindRequest{Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com"}, Sort: "time"}) assert.NoError(t, err) require.Equal(t, 2, len(comments), "2 comments with deleted info") assert.Equal(t, store.User{Name: "deleted", ID: "deleted", Picture: "", Admin: false, Blocked: false, IP: ""}, comments[0].User) @@ -836,10 +852,22 @@ func TestBoltAdmin_DeleteUserSoft(t *testing.T) { b, teardown := prep(t) defer teardown() - err := b.Delete(DeleteRequest{Locator: store.Locator{SiteID: "radio-t"}, UserID: "user1", DeleteMode: store.SoftDelete}) + comments, err := b.Find(FindRequest{Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com"}, Sort: "time"}) + assert.NoError(t, err) + + // soft delete one comment + delReq := DeleteRequest{ + Locator: store.Locator{URL: "https://radio-t.com", SiteID: "radio-t"}, + CommentID: comments[0].ID, + DeleteMode: store.SoftDelete, + } + err = b.Delete(delReq) + assert.NoError(t, err) + + err = b.Delete(DeleteRequest{Locator: store.Locator{SiteID: "radio-t"}, UserID: "user1", DeleteMode: store.SoftDelete}) require.NoError(t, err) - comments, err := b.Find(FindRequest{Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com"}, Sort: "time"}) + comments, err = b.Find(FindRequest{Locator: store.Locator{SiteID: "radio-t", URL: "https://radio-t.com"}, Sort: "time"}) assert.NoError(t, err) require.Equal(t, 2, len(comments), "2 comments with deleted info") assert.Equal(t, store.User{Name: "user name", ID: "user1", Picture: "", Admin: false, Blocked: false, IP: ""}, comments[0].User) diff --git a/docker-init.sh b/docker-init.sh index 3347fee5..1c96a586 100755 --- a/docker-init.sh +++ b/docker-init.sh @@ -1,7 +1,12 @@ #!/bin/sh echo "prepare environment" # replace BASE_URL constant by REMARK_URL -sed -i "s|https://demo.remark42.com|${REMARK_URL}|g" /srv/web/*.js +sed -i "s|https://demo.remark42.com|${REMARK_URL}|g" /srv/web/*.{js,html} + +if [ -n "${SITE_ID}" ]; then + #replace "site_id: 'remark'" by SITE_ID + se -i "s|'remark'|'${SITE_ID}'|g" /srv/web/*.html +fi if [ -d "/srv/var" ]; then chown -R app:app /srv/var 2>/dev/null diff --git a/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.test.tsx b/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.test.tsx index 1e639cc7..c23c852e 100644 --- a/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.test.tsx +++ b/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.test.tsx @@ -31,9 +31,9 @@ describe('', () => { expect(wrapper.find('.comment-form__rss-dropdown__link')).toHaveLength(3); }); - it('should have userId in site link', () => { - expect(wrapper.find('.comment-form__rss-dropdown__link').at(1).prop('href')).toEqual( - createSubscribeUrl('site', '&user=user-1') + it('should have userId in replies link', () => { + expect(wrapper.find('.comment-form__rss-dropdown__link').at(2).prop('href')).toBe( + createSubscribeUrl('reply', '&user=user-1') ); }); }); diff --git a/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.tsx b/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.tsx index dc9e98cd..9ef68401 100644 --- a/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.tsx +++ b/frontend/app/components/comment-form/__subscribe-by-rss/comment-form__subscribe-by-rss.tsx @@ -39,9 +39,9 @@ export const SubscribeByRSS: FunctionComponent<{ userId: string | null }> = ({ u const intl = useIntl(); const items: Array<[string, string]> = useMemo( () => [ - [createSubscribeUrl('post'), intl.formatMessage(messages.thread)], - [createSubscribeUrl('site', `&user=${userId}`), intl.formatMessage(messages.site)], - [createSubscribeUrl('reply', `&url=${url}`), intl.formatMessage(messages.replies)], + [createSubscribeUrl('post', `&url=${url}`), intl.formatMessage(messages.thread)], + [createSubscribeUrl('site'), intl.formatMessage(messages.site)], + [createSubscribeUrl('reply', `&user=${userId}`), intl.formatMessage(messages.replies)], ], [userId] ); diff --git a/frontend/app/components/comment-form/comment-form.test.tsx b/frontend/app/components/comment-form/comment-form.test.tsx index adb2d69b..f798bd84 100644 --- a/frontend/app/components/comment-form/comment-form.test.tsx +++ b/frontend/app/components/comment-form/comment-form.test.tsx @@ -7,16 +7,16 @@ import { StaticStore } from '@app/common/static_store'; import { LS_SAVED_COMMENT_VALUE } from '@app/common/constants'; import * as localStorageModule from '@app/common/local-storage'; -import { CommentForm, Props, messages } from './comment-form'; +import { CommentForm, Props, messages, State } from './comment-form'; import { SubscribeByEmail } from './__subscribe-by-email'; import TextareaAutosize from './textarea-autosize'; -function createEvent(type: string, value: T) { +function createEvent(type: string, value: T): E { const event = new Event(type); Object.defineProperty(event, 'target', { value }); - return event; + return event as E; } const DEFAULT_PROPS: Readonly> = { @@ -35,7 +35,7 @@ const intl = { } as any; describe('', () => { - it('should render without control panel, preview button, and rss links in "simple view" mode', () => { + it('should shallow without control panel, preview button, and rss links in "simple view" mode', () => { const props = { ...DEFAULT_PROPS, simpleView: true, intl }; const wrapper = shallow(); @@ -44,7 +44,7 @@ describe('', () => { expect(wrapper.exists('.comment-form__rss')).toEqual(false); }); - it('should be rendered with email subscription button', () => { + it('should be shallowed with email subscription button', () => { StaticStore.config.email_notifications = true; const props = { ...DEFAULT_PROPS, user, intl }; @@ -107,9 +107,8 @@ describe('', () => { }); it('should update value', () => { const props = { ...DEFAULT_PROPS, user, intl }; - const wrapper = shallow(); - // @ts-ignore - const instance: CommentForm = wrapper.instance(); + const wrapper = shallow(); + const instance = wrapper.instance(); instance.onInput(createEvent('input', { value: '1' })); expect(localStorage.getItem(LS_SAVED_COMMENT_VALUE)).toBe('{"1":"1"}'); @@ -122,9 +121,8 @@ describe('', () => { localStorage.setItem(LS_SAVED_COMMENT_VALUE, JSON.stringify({ '1': 'asd' })); const updateJsonItemSpy = jest.spyOn(localStorageModule, 'updateJsonItem'); const props = { ...DEFAULT_PROPS, user, intl }; - const wrapper = shallow(); - // @ts-ignore - const instance: CommentForm = wrapper.instance(); + const wrapper = shallow(); + const instance = wrapper.instance(); await instance.send(createEvent('send', { preventDefault: () => undefined })); expect(updateJsonItemSpy).toHaveBeenCalled(); @@ -134,9 +132,8 @@ describe('', () => { it('should show error message of image upload try by anonymous user', () => { const props = { ...DEFAULT_PROPS, user: anonymousUser, intl }; - const wrapper = shallow(); - // @ts-ignore - const instance: CommentForm = wrapper.instance(); + const wrapper = shallow(); + const instance = wrapper.instance(); instance.onDrop(new Event('drag') as DragEvent); expect(wrapper.exists('.comment-form__error')).toEqual(true); @@ -145,12 +142,53 @@ describe('', () => { it('should show error message of image upload try by unauthorized user', () => { const props = { ...DEFAULT_PROPS, intl }; - const wrapper = shallow(); - // @ts-ignore - const instance: CommentForm = wrapper.instance(); + const wrapper = shallow(); + const instance = wrapper.instance(); instance.onDrop(new Event('drag') as DragEvent); expect(wrapper.exists('.comment-form__error')).toEqual(true); expect(wrapper.find('.comment-form__error').text()).toEqual(messages.unauthorizedUploadingDisabled.defaultMessage); }); + + it('should show rest letters counter', async () => { + expect.assertions(3); + + const originalConfig = { ...StaticStore.config }; + StaticStore.config.max_comment_size = 2000; + const props = { ...DEFAULT_PROPS, intl }; + const wrapper = shallow(); + const instance = wrapper.instance(); + const text = + 'That was Wintermute, manipulating the lock the way it had manipulated the drone micro and the chassis of a gutted game console. It was chambered for .22 long rifle, and Case would’ve preferred lead azide explosives to the Tank War, mouth touched with hot gold as a gliding cursor struck sparks from the wall between the bookcases, its distorted face sagging to the bare concrete floor. Splayed in his elastic g-web, Case watched the other passengers as he made his way down Shiga from the sushi stall he cradled it in his jacket pocket. Images formed and reformed: a flickering montage of the Sprawl’s towers and ragged Fuller domes, dim figures moving toward him in the Japanese night like live wire voodoo and he’d cry for it, cry in his jacket pocket. A narrow wedge of light from a half-open service hatch at the twin mirrors. Still it was a square of faint light. The alarm still oscillated, louder here, the rear wall dulling the roar of the arcade showed him broken lengths of damp chipboard and the robot gardener. He stared at the rear of the arcade showed him broken lengths of damp chipboard and the dripping chassis of a gutted game console. That was Wintermute, manipulating the lock the way it had manipulated the drone micro and the chassis of a gutted game console. It was chambered for .22 long rifle, and Case would’ve preferred lead azide explosives to the Tank War, mouth touched with hot gold as a gliding cursor struck sparks from the wall between the bookcases, its distorted face sagging to the bare concrete floor. Splayed in his elastic g-web, Case watched the other passengers as he made his way down Shiga from the sushi stall he cradled it in his jacket pocket. Images formed and reformed: a flickering montage of the Sprawl’s towers and ragged Fuller domes, dim figures moving toward him in the Japanese night like live wire voodoo and he’d cry for it, cry in his jacket.'; + + instance.setState({ text }); + await wrapper.update(); + + expect(instance.state.text).toBe(text); + expect(wrapper.find('.comment-form__counter').exists()).toBe(true); + expect(wrapper.find('.comment-form__counter').text()).toBe('99'); + + StaticStore.config = originalConfig; + }); + + it('should show zero in rest letters counter', async () => { + expect.assertions(2); + + const originalConfig = { ...StaticStore.config }; + StaticStore.config.max_comment_size = 2000; + const props = { ...DEFAULT_PROPS, intl }; + const wrapper = shallow(); + const instance = wrapper.instance(); + const text = + 'All the speed he took, all the turns he’d taken and the amplified breathing of the Sprawl’s towers and ragged Fuller domes, dim figures moving toward him in the dark. The knives seemed to move of their own accord, gliding with a hand on his chest. Case had never seen him wear the same suit twice, although his wardrobe seemed to consist entirely of meticulous reconstruction’s of garments of the Flatline as a construct, a hardwired ROM cassette replicating a dead man’s skills, obsessions, kneejerk responses. Case had never seen him wear the same suit twice, although his wardrobe seemed to consist entirely of meticulous reconstruction’s of garments of the bright void beyond the chain link. Now this quiet courtyard, Sunday afternoon, this girl with a random collection of European furniture, as though Deane had once intended to use the place as his home. Now this quiet courtyard, Sunday afternoon, this girl with a ritual lack of urgency through the arcs and passes of their dance, point passing point, as the men waited for an opening. They floated in the shade beneath a bridge or overpass. A graphic representation of data abstracted from the banks of every computer in the coffin for Armitage’s call. All the speed he took, all the turns he’d taken and the amplified breathing of the Sprawl’s towers and ragged Fuller domes, dim figures moving toward him in the dark. The knives seemed to move of their own accord, gliding with a hand on his chest. Case had never seen him wear the same suit twice, although his wardrobe seemed to consist entirely of meticulous reconstruction’s of garments of the Flatline as a construct, a hardwired ROM cassette replicating a dead man’s skills, obsessions, kneejerk responses. Case had never seen him wear the same suit twice, although his wardrobe seemed to consist entirely of meticulous reconstruction’s of garments of the bright void beyond the chain link. Now this quiet courtyard, Sunday afternoon, this girl with a random collection of European furniture, as though Deane had once intended to use the place as his home. Now this quiet courtyard, Sunday afternoon, this girl with a ritual lack of urgency through the arcs and passes of their dance, point passing point, as the men waited for an opening. They floated in the shade beneath a bridge or overpass. A graphic representation of data abstracted from the banks of every computer in the coffin for Armitage’s call.'; + + instance.onInput(createEvent('input', { value: text })); + + await wrapper.update(); + + expect(instance.state.text).toBe(text.substr(0, StaticStore.config.max_comment_size)); + expect(wrapper.find('.comment-form__counter').text()).toBe('0'); + + StaticStore.config = originalConfig; + }); }); diff --git a/frontend/app/components/comment-form/comment-form.tsx b/frontend/app/components/comment-form/comment-form.tsx index d5d56a8c..55756c9a 100644 --- a/frontend/app/components/comment-form/comment-form.tsx +++ b/frontend/app/components/comment-form/comment-form.tsx @@ -51,7 +51,6 @@ export interface State { /** prevents error hiding on input event */ errorLock: boolean; isDisabled: boolean; - maxLength: number; /** main input value */ text: string; /** override main button text */ @@ -127,7 +126,6 @@ export class CommentForm extends Component { errorMessage: null, errorLock: false, isDisabled: false, - maxLength: StaticStore.config.max_comment_size, text, buttonText: null, }; @@ -178,13 +176,14 @@ export class CommentForm extends Component { onInput = (e: Event) => { const { value } = e.target as HTMLInputElement; + const text = value.substr(0, StaticStore.config.max_comment_size); updateJsonItem(LS_SAVED_COMMENT_VALUE, { [this.props.id]: value }); if (this.state.errorLock) { this.setState({ preview: null, - text: value, + text, }); return; } @@ -193,7 +192,7 @@ export class CommentForm extends Component { isErrorShown: false, errorMessage: null, preview: null, - text: value, + text, }); }; @@ -446,37 +445,38 @@ export class CommentForm extends Component { ); - render(props: Props, { isDisabled, isErrorShown, errorMessage, preview, maxLength, text, buttonText }: State) { - const charactersLeft = maxLength - text.length; - errorMessage = props.errorMessage || errorMessage; + render() { + const { theme, mode, simpleView, mix, uploadImage, autofocus, user, intl } = this.props; + const { isDisabled, isErrorShown, preview, text, buttonText } = this.state; + const charactersLeft = StaticStore.config.max_comment_size - text.length; + const errorMessage = this.props.errorMessage || this.state.errorMessage; const Labels = { main: , edit: , reply: , }; - const label = buttonText || Labels[props.mode || 'main']; - const intl = this.props.intl; + const label = buttonText || Labels[mode || 'main']; const placeholderMessage = intl.formatMessage(messages.placeholder); return (
- {!props.simpleView && ( + {!simpleView && (
@@ -491,11 +491,10 @@ export class CommentForm extends Component { className="comment-form__field" placeholder={placeholderMessage} value={text} - maxLength={maxLength} onInput={this.onInput} onKeyDown={this.onKeyDown} disabled={isDisabled} - autofocus={!!props.autofocus} + autofocus={!!autofocus} spellcheck={true} /> @@ -510,13 +509,13 @@ export class CommentForm extends Component { ))}
- {this.props.user ? ( + {user ? (
- {!props.simpleView && ( + {!simpleView && (
- {!props.simpleView && props.mode === 'main' && ( + {!simpleView && mode === 'main' && (
{this.renderMarkdownTip()} {' '} - + {StaticStore.config.email_notifications && StaticStore.query.show_email_subscription && ( {' '} @@ -559,7 +558,7 @@ export class CommentForm extends Component {
diff --git a/frontend/app/locales/ua.json b/frontend/app/locales/ua.json new file mode 100644 index 00000000..75382438 --- /dev/null +++ b/frontend/app/locales/ua.json @@ -0,0 +1,170 @@ +{ + "anonymousLoginForm.length-limit": "Довжина імені повинна бути більше 3 символів", + "anonymousLoginForm.log-in": "Увійти", + "anonymousLoginForm.symbol-limit": "Ім’я користувача повинно починатися з літери і містити тільки латинські букви,цифри,знаки підкреслення і прогалини", + "anonymousLoginForm.user-name": "Ім’я користувача", + "authPanel.anonymous-provider": "Анонімно", + "authPanel.disable-comments": "Вімкнути коментарі", + "authPanel.disabled-cookies": "Заборонені third-party cookies не дозволяють працювати коментарям", + "authPanel.enable-comments": "Увімкнути коментари", + "authPanel.enable-cookies": "Дозвольте Cookies", + "authPanel.hide-settings": "Заховати налаштування", + "authPanel.logged-as": "Ви увійшли як", + "authPanel.login": "Вхід:", + "authPanel.logout": "Вийти?", + "authPanel.new-page": "нова сторінка", + "authPanel.or-provider": "або", + "authPanel.other-provider": "Інший", + "authPanel.read-only": "Тільки для читання", + "authPanel.request-to-delete-data": "Запросити видалення моїх даних", + "authPanel.show-settings": "Показати налаштування", + "blockingDuration.day": "На день", + "blockingDuration.month": "На місяць", + "blockingDuration.permanently": "Назавжди", + "blockingDuration.week": "На неділю", + "comment.block": "Блокувати", + "comment.block-user": "Заблокувати користувача {userName} {duration}?", + "comment.blocked-user": "Заблокованний", + "comment.blocking-period": "Період блокування", + "comment.cancel": "Відмінити", + "comment.controversy": "Спірність: {value}", + "comment.copied": "Скопійовано!", + "comment.copy": "Скопіювати", + "comment.delete": "Видалити", + "comment.delete-message": "Видалити коментар?", + "comment.deleted-comment": "Коментар був видалений", + "comment.deleted-user": "Видален", + "comment.edit": "Редагувати", + "comment.expired-time": "Час редагування минув.", + "comment.go-to-parent": "До батьківського коментарю", + "comment.hide": "Заховати", + "comment.hide-user-comment": "Заховати коментар від користувача {userName}?", + "comment.pin": "Закріпити", + "comment.pin-comment": "Закріпити коментар?", + "comment.reply": "Відповісти", + "comment.time": "{day} в {time}", + "comment.toggle-verification": "Змінити статус справжності облікового запису", + "comment.unblock": "Розблокувати", + "comment.unblock-user": "Розблокувати користувача?", + "comment.unpin": "Відкріпити", + "comment.unpin-comment": "Відкріпити коментар?", + "comment.unverified-user": "Не перевірений на справжність обліковий запис", + "comment.unverify-user": "Прибрати статус справжності облікового запису для{userName}?", + "comment.verified-user": "Справжність облікового запису", + "comment.verify-user": "Підтвердити справжність облікового запису для{userName}?", + "comment.vote-error": "Помилка голосування: {voteErrorMessage}", + "commentForm.anonymous-uploading-disabled": "Завантаження зображень анонімними користувачами заборонена.Будь ласка увійдіть як не анонімний користувач.", + "commentForm.exceeded-size": "Розмір файла {fileName} повинен бути менший ніж {maxImageSize}", + "commentForm.input-placeholder": "Написати коментар", + "commentForm.new-comment": "Новий коментар", + "commentForm.notice-about-styling": "Підтримуеться Markdown форматування", + "commentForm.preview": "Предперегляд", + "commentForm.reply": "Відповісти", + "commentForm.save": "Зберегти", + "commentForm.send": "Відправити", + "commentForm.subscribe-by": "Підписатися", + "commentForm.subscribe-or": "або", + "commentForm.unauthorized-uploading-disabled": "Завантаження зображень недоступна для неавторизованих користувачів. Авторизуйтесь як не анонімний користувач для завантаження зображень.", + "commentForm.unexpected-error": "Щось пішло не так, спробуйте ще раз пізніше.", + "commentForm.upload-file-fail": "{fileName} неможливо завантажити через помилку: \"{errorMessage}\"", + "commentForm.uploading": "Завантаження...", + "commentForm.uploading-file": "Завантаження {fileName}...", + "commentSort.sort-by": "Сортувати по", + "commentsSort.best": "Кращі", + "commentsSort.least-controversial": "Найменш спірні", + "commentsSort.least-recently-updated": "Давно оновлені", + "commentsSort.most-controversial": "Найбільш спірні", + "commentsSort.newest": "Нові", + "commentsSort.oldest": "Старі", + "commentsSort.recently-updated": "Нещодавно оновлені", + "commentsSort.worst": "Гірші", + "emailLoginForm.back": "Назад", + "emailLoginForm.confirm": "Підтвердити", + "emailLoginForm.email-address": "Email адрес", + "emailLoginForm.empty-token": "Поле введення токена не повинно бути порожнім", + "emailLoginForm.expired-token": "Час дії токена минув", + "emailLoginForm.invalid-email": "Введений некоректний email адрес", + "emailLoginForm.loading": "Завантаження...", + "emailLoginForm.send-verification": "Відправити перевірку", + "emailLoginForm.token": "Токен", + "emailLoginForm.user-not-found": "Користувач не знайдений", + "errors.0": "Щось пішло не так,спробуйте ще раз пізніше.", + "errors.1": "Коментар не знайдений. Перезавантажте сторінку і спробуйте ще раз.", + "errors.10": "Час редагування коментаря минув.", + "errors.11": "На ваш коментар вже відповіли, редагування недоступне.", + "errors.12": "Не вдалося проголосувати. Спробуйте ще раз пізніше.", + "errors.13": "Ви не можете голосувати за свій коментар.", + "errors.14": "Ви вже голосували за цей коментар.", + "errors.15": "Занадто багато голосів за коментар .", + "errors.16": "Коментар досяг мінімальної оцінки.", + "errors.17": "Дія відклонена. Спробуйте ще раз пізніше.", + "errors.18": "Запрашиваемый файл не найден.", + "errors.2": "Не вдалося обробити відповідь від сервера.", + "errors.3": "Недостатньо прав на здійснення цієї дії.", + "errors.4": "Неправильно відформатований коментар.", + "errors.5": "Коментар не знайдений. Перезавантажте сторінку і спробуйте ще раз.", + "errors.6": "Сайт не знайдено. Перезавантажте сторінку і спробуйте ще раз.", + "errors.7": "Користувач був заблокований.", + "errors.8": "Користувач був заблокований.", + "errors.9": "Не вдалося зберегти зміни.Спробуйте ще раз пізніше.", + "errors.failed-fetch": "Немає відповіді с сервера.Перевірте ваше з’єднання з інтернетом або спробуйте пізніше.", + "errors.forbidden": "Заборонено.", + "errors.not-authorized": "Не авторизований.", + "errors.to-many-request": "Занадто багато запитів.", + "errors.unexpected-error": "Щось пішло не так.", + "root.pinned-comments": "Закріпленні коментарі", + "root.powered-by": "Powered by Remark42", + "root.show-more": "Показати ще", + "settings.block": "блокувати", + "settings.block-time": "до {day} в {time}", + "settings.block-user": "Заблокувати користувача {userName}?", + "settings.blocked-users-header": "Заблоковані користувачі:", + "settings.blocked-users-title": "Заблоковані користувачі", + "settings.hidden-user-header": "Приховані користувачі:", + "settings.hidden-users-title": "Приховані користувачі", + "settings.hide": "Приховати", + "settings.no-blocked-users": "Немає заблокованих користувачів.", + "settings.no-hidden-users": "Немає прихованих користувачів.", + "settings.permanently": "назавжди", + "settings.show": "Показати", + "settings.unblock": "розблокувати", + "settings.unblock-user": "Розблокувати користувача {userName}?", + "settings.unknown": "безіменний", + "subscribeByEmail.back": "Назад", + "subscribeByEmail.close": "Закрити", + "subscribeByEmail.email": "Email", + "subscribeByEmail.expired-token": "Час дії токена минув", + "subscribeByEmail.have-been-subscribed": "Ви були підписані на оновлення по email", + "subscribeByEmail.have-been-unsubscribed": "Ви були відписані від оновлень по email", + "subscribeByEmail.only-registered-users": "Доступно тільки для зареєстрованих користувачів", + "subscribeByEmail.submit": "Відправити", + "subscribeByEmail.subscribe": "Підписатися", + "subscribeByEmail.subscribe-by-email": "Підписатися по Email", + "subscribeByEmail.subscribe-to-replies": "Підписатися на відповіді", + "subscribeByEmail.subscribed": "Ви були підписані на оновлення по email", + "subscribeByEmail.token": "Токен", + "subscribeByEmail.unsubscribe": "Відмовитися від підписки", + "subscribeByRSS.button-title": "Підписатися по RSS", + "subscribeByRSS.replies": "Відповіді", + "subscribeByRSS.site": "Сайт", + "subscribeByRSS.thread": "Ветка", + "subscribeByRSS.title": "RSS", + "toolbar.attach-image": "Прикріпити зображення,перетягніть або вставте зображення з буфера обміну", + "toolbar.bold": "Жирний ", + "toolbar.code": "Код", + "toolbar.header": "Заголовок", + "toolbar.italic": "Курсив ", + "toolbar.link": "Посилання ", + "toolbar.ordered-list": "Упорядкованний список", + "toolbar.quote": "Цитата", + "toolbar.unordered-list": "Неупорядкованний список", + "user-info.last-comments": "Останні коментарі {userName}", + "user-info.unexpected-error": "Щось пішло не так", + "vote.anonymous": "Не можна голосувати анонімному користувачу", + "vote.deleted": "Не можна голосувати за видалений коментар", + "vote.guest": "Увійдіть в систему для голосування", + "vote.only-positive": "Дозволені тільки позитивні оцінки", + "vote.only-post-page": "Голосування можливо тільки для статей", + "vote.own-comment": "Ви не можете голосувати за свої коментарі", + "vote.readonly": "Не можна голосувати за коментарі, які в режимі тільки для читання" +} diff --git a/frontend/app/utils/loadLocale.ts b/frontend/app/utils/loadLocale.ts index fcdac2c1..3174012c 100644 --- a/frontend/app/utils/loadLocale.ts +++ b/frontend/app/utils/loadLocale.ts @@ -43,6 +43,11 @@ export async function loadLocale(locale: string): Promise .then(res => res.default) .catch(() => enMessages); } + if (locale === 'ua') { + return import(/* webpackChunkName: "ua" */ '../locales/ua.json') + .then(res => res.default) + .catch(() => enMessages); + } return enMessages; } diff --git a/frontend/comments.ejs b/frontend/comments.ejs index caba10fc..50af6a97 100644 --- a/frontend/comments.ejs +++ b/frontend/comments.ejs @@ -68,7 +68,7 @@ var remark_config = { site_id: query.site_id, - host: window.location.origin, + host: '<%= htmlWebpackPlugin.options.remarkUrl %>', url: query.url }; diff --git a/frontend/counter.ejs b/frontend/counter.ejs index b0f63920..70234b83 100644 --- a/frontend/counter.ejs +++ b/frontend/counter.ejs @@ -39,7 +39,7 @@