}
}
- return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > 500 || (isOnlyWhitespace && !anyMedia));
+ getFulltextForCharacterCounting = () => {
+ return [this.props.spoiler? this.props.spoilerText: '', countableText(this.props.text)].join('');
+ }
+
+ canSubmit = () => {
+ const { isSubmitting, isChangingUpload, isUploading, anyMedia } = this.props;
+ const fulltext = this.getFulltextForCharacterCounting();
+ const isOnlyWhitespace = fulltext.length !== 0 && fulltext.trim().length === 0;
+
++ return !(isSubmitting || isUploading || isChangingUpload || length(fulltext) > maxChars || (isOnlyWhitespace && !anyMedia));
+ }
+
handleSubmit = () => {
if (this.props.text !== this.autosuggestTextarea.textarea.value) {
// Something changed the text inside the textarea (e.g. browser extensions like Grammarly)
<PrivacyDropdownContainer />
<SpoilerButtonContainer />
</div>
- <div className='character-counter__wrapper'><CharacterCounter max={maxChars} text={text} /></div>
- <div className='character-counter__wrapper'><CharacterCounter max={500} text={this.getFulltextForCharacterCounting()} /></div>
++ <div className='character-counter__wrapper'><CharacterCounter max={maxChars} text={this.getFulltextForCharacterCounting()} /></div>
</div>
<div className='compose-form__publish'>
RedisLock.acquire(lock_options) do |lock|
if lock.acquired?
- remove_from_self if status.account.local?
+ remove_from_self if @account.local?
remove_from_followers
remove_from_lists
- remove_from_affected
- remove_reblogs
- remove_from_hashtags
- remove_from_public
- remove_from_media if status.media_attachments.any?
- remove_from_direct if status.direct_visibility?
- remove_from_spam_check
- remove_media
+
+ # There is no reason to send out Undo activities when the
+ # cause is that the original object has been removed, since
+ # original object being removed implicitly removes reblogs
+ # of it. The Delete activity of the original is forwarded
+ # separately.
+ if @account.local? && !@options[:original_removed]
+ remove_from_remote_followers
+ remove_from_remote_reach
+ end
+
+ # Since reblogs don't mention anyone, don't get reblogged,
+ # favourited and don't contain their own media attachments
+ # or hashtags, this can be skipped
+ unless @status.reblog?
+ remove_from_mentions
+ remove_reblogs
+ remove_from_hashtags
+ remove_from_public
+ remove_from_media if @status.media_attachments.any?
++ remove_from_direct if status.direct_visibility?
+ remove_from_spam_check
+ remove_media
+ end
@status.destroy! if @options[:immediate] || !@status.reported?
else
return unless @status.public_visibility?
redis.publish('timeline:public:media', @payload)
- if @status.local?
- redis.publish('timeline:public:local:media', @payload)
- else
- redis.publish('timeline:public:remote:media', @payload)
- end
+ redis.publish(@status.local? ? 'timeline:public:local:media' : 'timeline:public:remote:media', @payload)
end
+ def remove_from_direct
+ @mentions.each do |mention|
+ FeedManager.instance.unpush_from_direct(mention.account, @status) if mention.account.local?
+ end
+ end
+
def remove_media
return if @options[:redraft] || (!@options[:immediate] && @status.reported?)