Compare commits
4 Commits
63f8176496
...
bd4f834a18
Author | SHA1 | Date |
---|---|---|
khr | bd4f834a18 | |
khr | af6d57b7c8 | |
khr | 16c31821d2 | |
khr | 9a43dce739 |
|
@ -86,7 +86,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
const fulltext = this.getFulltextForCharacterCounting();
|
const fulltext = this.getFulltextForCharacterCounting();
|
||||||
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
|
const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
|
||||||
|
|
||||||
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
|
return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 1024 || (isOnlyWhitespace && !anyMedia));
|
||||||
}
|
}
|
||||||
|
|
||||||
handleSubmit = () => {
|
handleSubmit = () => {
|
||||||
|
@ -96,15 +96,7 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
this.props.onChange(this.autosuggestTextarea.textarea.value);
|
this.props.onChange(this.autosuggestTextarea.textarea.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
if (!this.canSubmit()) {
|
if (!this.canSubmit()) {
|
||||||
=======
|
|
||||||
// Submit disabled:
|
|
||||||
const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
|
|
||||||
const fulltext = [this.props.spoilerText, countableText(this.props.text)].join('');
|
|
||||||
|
|
||||||
if (isSubmitting || isUploading || isChangingUpload || length(fulltext) > 1024 || (fulltext.length !== 0 && fulltext.trim().length === 0 && !anyMedia)) {
|
|
||||||
>>>>>>> Feature: 1024-character posts in server and client
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,11 +188,6 @@ class ComposeForm extends ImmutablePureComponent {
|
||||||
render () {
|
render () {
|
||||||
const { intl, onPaste, showSearch } = this.props;
|
const { intl, onPaste, showSearch } = this.props;
|
||||||
const disabled = this.props.isSubmitting;
|
const disabled = this.props.isSubmitting;
|
||||||
<<<<<<< HEAD
|
|
||||||
=======
|
|
||||||
const text = [this.props.spoilerText, countableText(this.props.text)].join('');
|
|
||||||
const disabledButton = disabled || this.props.isUploading || this.props.isChangingUpload || length(text) > 1024 || (text.length !== 0 && text.trim().length === 0 && !anyMedia);
|
|
||||||
>>>>>>> Feature: 1024-character posts in server and client
|
|
||||||
let publishText = '';
|
let publishText = '';
|
||||||
|
|
||||||
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
|
if (this.props.privacy === 'private' || this.props.privacy === 'direct') {
|
||||||
|
|
|
@ -148,7 +148,6 @@ function main() {
|
||||||
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
|
delegate(document, '.custom-emoji', 'mouseover', getEmojiAnimationHandler('data-original'));
|
||||||
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
|
delegate(document, '.custom-emoji', 'mouseout', getEmojiAnimationHandler('data-static'));
|
||||||
|
|
||||||
<<<<<<< HEAD
|
|
||||||
delegate(document, '.status__content__spoiler-link', 'click', function() {
|
delegate(document, '.status__content__spoiler-link', 'click', function() {
|
||||||
const statusEl = this.parentNode.parentNode;
|
const statusEl = this.parentNode.parentNode;
|
||||||
|
|
||||||
|
@ -168,26 +167,12 @@ function main() {
|
||||||
const message = (statusEl.dataset.spoiler === 'expanded') ? (messages['status.show_less'] || 'Show less') : (messages['status.show_more'] || 'Show more');
|
const message = (statusEl.dataset.spoiler === 'expanded') ? (messages['status.show_less'] || 'Show less') : (messages['status.show_more'] || 'Show more');
|
||||||
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
spoilerLink.textContent = (new IntlMessageFormat(message, locale)).format();
|
||||||
});
|
});
|
||||||
=======
|
|
||||||
if (document.body.classList.contains('with-modals')) {
|
|
||||||
const scrollbarWidth = window.innerWidth - document.documentElement.clientWidth;
|
|
||||||
const scrollbarWidthStyle = document.createElement('style');
|
|
||||||
scrollbarWidthStyle.id = 'scrollbar-width';
|
|
||||||
document.head.appendChild(scrollbarWidthStyle);
|
|
||||||
scrollbarWidthStyle.sheet.insertRule(`body.with-modals--active { margin-right: ${scrollbarWidth}px; }`, 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
[].forEach.call(document.querySelectorAll('[data-component="Card"]'), (content) => {
|
|
||||||
const props = JSON.parse(content.getAttribute('data-props'));
|
|
||||||
ReactDOM.render(<CardContainer locale={locale} {...props} />, content);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (document.fonts && document.fonts.ready) {
|
if (document.fonts && document.fonts.ready) {
|
||||||
document.fonts.ready.then(sizeBioText);
|
document.fonts.ready.then(sizeBioText);
|
||||||
} else {
|
} else {
|
||||||
sizeBioText();
|
sizeBioText();
|
||||||
}
|
}
|
||||||
>>>>>>> Bio length -> 500 characters
|
|
||||||
});
|
});
|
||||||
|
|
||||||
delegate(document, '.webapp-btn', 'click', ({ target, button }) => {
|
delegate(document, '.webapp-btn', 'click', ({ target, button }) => {
|
||||||
|
@ -321,12 +306,12 @@ function main() {
|
||||||
|
|
||||||
delegate(document, '#account_note', 'input', sizeBioText);
|
delegate(document, '#account_note', 'input', sizeBioText);
|
||||||
|
|
||||||
function sizeBioText() {
|
function s500 izeBioText() {
|
||||||
const noteCounter = document.querySelector('.note-counter');
|
const noteCounter = document.querySelector('.note-counter');
|
||||||
const bioTextArea = document.querySelector('#account_note');
|
const bioTextArea = document.querySelector('#account_note');
|
||||||
|
|
||||||
if (noteCounter) {
|
if (noteCounter) {
|
||||||
noteCounter.textContent = 500 - length(bioTextArea.value);
|
noteCounter.textContent = 1024 - length(bioTextArea.value);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bioTextArea) {
|
if (bioTextArea) {
|
||||||
|
|
|
@ -88,8 +88,8 @@ class Account < ApplicationRecord
|
||||||
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
|
validates :username, format: { with: /\A[a-z0-9_]+\z/i }, length: { maximum: 30 }, if: -> { local? && will_save_change_to_username? && actor_type != 'Application' }
|
||||||
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? }
|
validates_with UnreservedUsernameValidator, if: -> { local? && will_save_change_to_username? }
|
||||||
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
|
validates :display_name, length: { maximum: 30 }, if: -> { local? && will_save_change_to_display_name? }
|
||||||
validates :note, note_length: { maximum: 500 }, if: -> { local? && will_save_change_to_note? }
|
validates :note, note_length: { maximum: 1024 }, if: -> { local? && will_save_change_to_note? }
|
||||||
validate :note_has_eight_newlines?, if: -> { local? && will_save_change_to_note? }
|
validate :note_has_ten_newlines?, if: -> { local? && will_save_change_to_note? }
|
||||||
validates :fields, length: { maximum: 4 }, if: -> { local? && will_save_change_to_fields? }
|
validates :fields, length: { maximum: 4 }, if: -> { local? && will_save_change_to_fields? }
|
||||||
|
|
||||||
scope :remote, -> { where.not(domain: nil) }
|
scope :remote, -> { where.not(domain: nil) }
|
||||||
|
@ -384,8 +384,8 @@ class Account < ApplicationRecord
|
||||||
@synchronization_uri_prefix ||= uri[/http(s?):\/\/[^\/]+\//]
|
@synchronization_uri_prefix ||= uri[/http(s?):\/\/[^\/]+\//]
|
||||||
end
|
end
|
||||||
|
|
||||||
def note_has_eight_newlines?
|
def note_has_ten_newlines?
|
||||||
errors.add(:note, 'Bio can\'t have more then 8 newlines') unless note.count("\n") <= 8
|
errors.add(:note, 'Bio can\'t have more then 10 newlines') unless note.count("\n") <= 10
|
||||||
end
|
end
|
||||||
|
|
||||||
class Field < ActiveModelSerializers::Model
|
class Field < ActiveModelSerializers::Model
|
||||||
|
|
Loading…
Reference in New Issue