Compare commits

...

52 Commits

Author SHA1 Message Date
Thor 134b19e593 Merge remote-tracking branch 'origin/main' into local 1 year ago
Thor 0687ef7d13 Merge remote-tracking branch 'upstream/main' into main 1 year ago
Thor 5b48c98c08 Merge remote-tracking branch 'origin/main' into local 1 year ago
Thor d9618e12c5 Explicit Chewy imports for statuses 1 year ago
Thor 644333ff0e Merge remote-tracking branch 'origin/main' into local 1 year ago
Thor cdf30cf5db Allow full-text search on federated content 1 year ago
Thor ac10ef5e52 Merge remote-tracking branch 'upstream/main' into main 1 year ago
Thor 11f39db9e0 Merge remote-tracking branch 'origin/main' into local 1 year ago
Thor 6b224840bc Merge remote-tracking branch 'upstream/main' into main 1 year ago
Thor abfbb2d3f2 Make 'tootctl media remove-orphans' retry file listings 1 year ago
Thor 491d398c90 Merge remote-tracking branch 'origin/main' into local 1 year ago
Thor 100b278a99 Merge remote-tracking branch 'upstream/main' into main 1 year ago
Thor c661961f21 Merge remote-tracking branch 'origin/main' into local 2 years ago
Thor 22e9559aa2 Merge remote-tracking branch 'upstream/main' into main 2 years ago
Thor 8be9ee756a Merge remote-tracking branch 'upstream/main' into main 2 years ago
Thor 9d07ca3615 Merge branch 'main' into HEAD 2 years ago
Thor b4853ea584 Merge remote-tracking branch 'upstream/main' into main 2 years ago
Thor c86fea0fc9 Merge branch 'main' of saga.berserker.town:berserker/microblog into local 2 years ago
root ecc8e19071 Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Thor bcc417ed71 Merge remote-tracking branch 'origin/main' into local 2 years ago
Thor f196a3d4d9 Merge remote-tracking branch 'upstream/main' into main 2 years ago
Thor e1b6588154 Deletion rate limit increase 2 years ago
Thor 5b897704ff Merge remote-tracking branch 'origin/main' into local 2 years ago
Thor d8da65025d Correct strings file for new automated status deletion thresholds 2 years ago
Thor 0a7b3af414 Add local translations once again 2 years ago
Thor 166ffc1354 Merge branch 'main' of saga.berserker.town:berserker/microblog into local 2 years ago
Thor 27c4b4e7ee Restore local translations 2 years ago
Thor 0d2e4b6294 Weeded out another locally modified strings file 2 years ago
Thor 244a5e21ea Merge branch 'dev' into main 2 years ago
Thor 22f653c17b Merge branch 'main' of https://github.com/glitch-soc/mastodon into dev 2 years ago
Thor 36e533eaab Merge branch 'main' of https://github.com/glitch-soc/mastodon into dev 2 years ago
Thor eb8fa57261 Add more automated post deletion age thresholds 2 years ago
Thor affab99b47 Revert to upstream translations (keep on local branch instead) 2 years ago
Thor 6b0dc8407e Enable edit support 2 years ago
Thor 7f3114e4cb Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Thor 74bb52bd7e Fix sticker alignment bug 2 years ago
Thor 6a50920252 Remove margin on emojis in detailed statuses 2 years ago
Thor 7a325063af Fix big emoji sizes for detailed statuses 2 years ago
Thor e9272004de Revert more vanilla features to upstream 2 years ago
Thor 2271f10292 Revert vanilla components.scss to upstream 2 years ago
Thor 96c9b527f6 Revert vanilla compose.js to upstream 2 years ago
Thor ca90a99560 Revert redundant vanilla patches to upstream 2 years ago
Thor 775e4c4be9 Add sticker support 2 years ago
Thor ad6397f1bb Bigger emojis 2 years ago
Thor 89a476f0bc Remove duplicate JS code for media gallery 2 years ago
Thor bc8d4d0c78 Merge branch 'main' of github.com:berserker-town/glitch-soc into main 2 years ago
Thor e998b1e630 Increase media attachment limit to 20 2 years ago
Thor c4bb82b49e Add support for 20 media attachments 2 years ago
Thor 655573f9c5 Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Thor d4219bd203 HiDPI image patch 2 years ago
Thor f487fe0951 Merge branch 'main' of https://github.com/glitch-soc/mastodon into main 2 years ago
Mastodon 65e9b5c2e6 Rename the local timeline to the Tavern 2 years ago
  1. 12
      app/chewy/statuses_index.rb
  2. 4
      app/javascript/flavours/glitch/actions/compose.js
  3. 55
      app/javascript/flavours/glitch/components/media_gallery.jsx
  4. 2
      app/javascript/flavours/glitch/features/community_timeline/index.jsx
  5. 2
      app/javascript/flavours/glitch/features/compose/components/header.jsx
  6. 2
      app/javascript/flavours/glitch/features/compose/containers/options_container.js
  7. 2
      app/javascript/flavours/glitch/features/getting_started/index.jsx
  8. 4
      app/javascript/flavours/glitch/features/ui/components/onboarding_modal.jsx
  9. 2
      app/javascript/flavours/glitch/features/ui/index.jsx
  10. 19
      app/javascript/flavours/glitch/styles/components/status.scss
  11. 3
      app/javascript/flavours/glitch/utils/resize_image.js
  12. 44
      app/javascript/mastodon/locales/defaultMessages.json
  13. 12
      app/javascript/mastodon/locales/en.json
  14. 6
      app/lib/activitypub/activity/create.rb
  15. 29
      app/lib/importer/statuses_index_importer.rb
  16. 4
      app/models/account_statuses_cleanup_policy.rb
  17. 5
      app/models/media_attachment.rb
  18. 22
      app/models/status.rb
  19. 2
      app/services/activitypub/process_account_service.rb
  20. 4
      app/services/activitypub/process_status_update_service.rb
  21. 4
      app/services/post_status_service.rb
  22. 2
      app/services/search_service.rb
  23. 4
      app/services/update_status_service.rb
  24. 3
      config/initializers/rack_attack.rb
  25. 5
      config/locales/en.yml
  26. 14
      lib/mastodon/media_cli.rb

@ -38,27 +38,27 @@ class StatusesIndex < Chewy::Index
index_scope ::Status.unscoped.kept.without_reblogs.includes(:media_attachments, :preloadable_poll)
crutch :mentions do |collection|
data = ::Mention.where(status_id: collection.map(&:id)).where(account: Account.local, silent: false).pluck(:status_id, :account_id)
data = ::Mention.where(status_id: collection.map(&:id)).where(silent: false).pluck(:status_id, :account_id)
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
end
crutch :favourites do |collection|
data = ::Favourite.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id)
data = ::Favourite.where(status_id: collection.map(&:id)).pluck(:status_id, :account_id)
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
end
crutch :reblogs do |collection|
data = ::Status.where(reblog_of_id: collection.map(&:id)).where(account: Account.local).pluck(:reblog_of_id, :account_id)
data = ::Status.where(reblog_of_id: collection.map(&:id)).pluck(:reblog_of_id, :account_id)
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
end
crutch :bookmarks do |collection|
data = ::Bookmark.where(status_id: collection.map(&:id)).where(account: Account.local).pluck(:status_id, :account_id)
data = ::Bookmark.where(status_id: collection.map(&:id)).pluck(:status_id, :account_id)
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
end
crutch :votes do |collection|
data = ::PollVote.joins(:poll).where(poll: { status_id: collection.map(&:id) }).where(account: Account.local).pluck(:status_id, :account_id)
data = ::PollVote.joins(:poll).where(poll: { status_id: collection.map(&:id) }).pluck(:status_id, :account_id)
data.each.with_object({}) { |(id, name), result| (result[id] ||= []).push(name) }
end
@ -69,7 +69,5 @@ class StatusesIndex < Chewy::Index
field :text, type: 'text', value: ->(status) { status.searchable_text } do
field :stemmed, type: 'text', analyzer: 'content'
end
field :searchable_by, type: 'long', value: ->(status, crutches) { status.searchable_by(crutches) }
end
end

@ -296,7 +296,7 @@ export function doodleSet(options) {
export function uploadCompose(files) {
return function (dispatch, getState) {
const uploadLimit = 4;
const uploadLimit = 20;
const media = getState().getIn(['compose', 'media_attachments']);
const pending = getState().getIn(['compose', 'pending_media_attachments']);
const progress = new Array(files.length).fill(0);
@ -315,7 +315,7 @@ export function uploadCompose(files) {
dispatch(uploadComposeRequest());
for (const [i, f] of Array.from(files).entries()) {
if (media.size + i > 3) break;
if (media.size + i > 19) break;
resizeImage(f).then(file => {
const data = new FormData();

@ -101,52 +101,45 @@ class Item extends React.PureComponent {
render () {
const { attachment, lang, index, size, standalone, letterbox, displayWidth, visible } = this.props;
let width = 50;
let width = 100;
let height = 100;
let top = 'auto';
let left = 'auto';
let bottom = 'auto';
let right = 'auto';
if (size === 1) {
width = 100;
}
let root = Math.sqrt(size);
let numCols = Math.ceil(root);
let numRows = Math.ceil(size / numCols);
if (size === 4 || (size === 3 && index > 0)) {
height = 50;
let col = index % numCols;
let row = Math.floor(index / numCols);
if(row === numRows - 1) {
width = 100 / (1 + ((size - 1) % numCols));
} else {
width = 100 / numCols;
}
if (size === 2) {
if (index === 0) {
height = 100 / numRows;
if(numCols > 1) {
if(col === 0) {
right = '2px';
} else if(col === numCols - 1) {
left = '2px';;
} else {
left = '2px';
}
} else if (size === 3) {
if (index === 0) {
right = '2px';
} else if (index > 0) {
left = '2px';
}
}
if (index === 1) {
if(numRows > 1) {
if(row === 0) {
bottom = '2px';
} else if (index > 1) {
} else if(row === numRows - 1) {
top = '2px';
}
} else if (size === 4) {
if (index === 0 || index === 2) {
right = '2px';
}
if (index === 1 || index === 3) {
left = '2px';
}
if (index < 2) {
bottom = '2px';
} else {
top = '2px';
bottom = '2px';
}
}
@ -229,7 +222,7 @@ class Item extends React.PureComponent {
}
return (
<div className={classNames('media-gallery__item', { standalone, letterbox })} key={attachment.get('id')} style={{ left: left, top: top, right: right, bottom: bottom, width: `${width}%`, height: `${height}%` }}>
<div className={classNames('media-gallery__item', { standalone, letterbox })} key={attachment.get('id')} style={{ 'padding-left': left, 'padding-top': top, 'padding-right': right, 'padding-bottom': bottom, width: `${width}%`, height: `${height}%` }}>
<Blurhash
hash={attachment.get('blurhash')}
dummy={!useBlurhash}
@ -347,7 +340,7 @@ class MediaGallery extends React.PureComponent {
render () {
const { media, lang, intl, sensitive, letterbox, fullwidth, defaultWidth, autoplay } = this.props;
const { visible } = this.state;
const size = media.take(4).size;
const size = media.take(20).size; // Attachment limit patch
const uncached = media.every(attachment => attachment.get('type') === 'unknown');
const width = this.state.width || defaultWidth;
@ -369,7 +362,7 @@ class MediaGallery extends React.PureComponent {
if (this.isStandaloneEligible()) {
children = <Item standalone autoplay={autoplay} onClick={this.handleClick} attachment={media.get(0)} lang={lang} displayWidth={width} visible={visible} />;
} else {
children = media.take(4).map((attachment, i) => <Item key={attachment.get('id')} autoplay={autoplay} onClick={this.handleClick} attachment={attachment} index={i} lang={lang} size={size} letterbox={letterbox} displayWidth={width} visible={visible || uncached} />);
children = media.take(20).map((attachment, i) => <Item key={attachment.get('id')} autoplay={autoplay} onClick={this.handleClick} attachment={attachment} index={i} lang={lang} size={size} letterbox={letterbox} displayWidth={width} visible={visible || uncached} />); // Attachment limit patch
}
if (uncached) {

@ -14,7 +14,7 @@ import { domain } from 'flavours/glitch/initial_state';
import DismissableBanner from 'flavours/glitch/components/dismissable_banner';
const messages = defineMessages({
title: { id: 'column.community', defaultMessage: 'Local timeline' },
title: { id: 'column.community', defaultMessage: 'The Tavern' },
});
const mapStateToProps = (state, { columnId }) => {

@ -16,7 +16,7 @@ import { signOutLink } from 'flavours/glitch/utils/backend_links';
// Messages.
const messages = defineMessages({
community: {
defaultMessage: 'Local timeline',
defaultMessage: 'The Tavern',
id: 'navigation_bar.community_timeline',
},
home_timeline: {

@ -17,7 +17,7 @@ function mapStateToProps (state) {
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']).toArray().join(','),
resetFileKey: state.getIn(['compose', 'resetFileKey']),
hasPoll: !!poll,
allowMedia: !poll && (media ? media.size + pending_media < 4 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 4),
allowMedia: !poll && (media ? media.size + pending_media < 20 && !media.some(item => ['video', 'audio'].includes(item.get('type'))) : pending_media < 20),
hasMedia: media && !!media.size,
allowPoll: !(media && !!media.size),
showContentTypeChoice: state.getIn(['local_settings', 'show_content_type_choice']),

@ -26,7 +26,7 @@ const messages = defineMessages({
public_timeline: { id: 'navigation_bar.public_timeline', defaultMessage: 'Federated timeline' },
navigation_subheading: { id: 'column_subheading.navigation', defaultMessage: 'Navigation' },
settings_subheading: { id: 'column_subheading.settings', defaultMessage: 'Settings' },
community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'Local timeline' },
community_timeline: { id: 'navigation_bar.community_timeline', defaultMessage: 'The Tavern' },
explore: { id: 'navigation_bar.explore', defaultMessage: 'Explore' },
direct: { id: 'navigation_bar.direct', defaultMessage: 'Direct messages' },
bookmarks: { id: 'navigation_bar.bookmarks', defaultMessage: 'Bookmarks' },

@ -17,7 +17,7 @@ const noop = () => { };
const messages = defineMessages({
home_title: { id: 'column.home', defaultMessage: 'Home' },
notifications_title: { id: 'column.notifications', defaultMessage: 'Notifications' },
local_title: { id: 'column.community', defaultMessage: 'Local timeline' },
local_title: { id: 'column.community', defaultMessage: 'The Tavern' },
federated_title: { id: 'column.public', defaultMessage: 'Federated timeline' },
});
@ -114,7 +114,7 @@ const PageFour = ({ domain, intl }) => (
</div>
</div>
<p><FormattedMessage id='onboarding.page_five.public_timelines' defaultMessage='The local timeline shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.' values={{ domain }} /></p>
<p><FormattedMessage id='onboarding.page_five.public_timelines' defaultMessage='The Tavern shows public posts from everyone on {domain}. The federated timeline shows public posts from everyone who people on {domain} follow. These are the Public Timelines, a great way to discover new people.' values={{ domain }} /></p>
</div>
</div>
);

@ -75,7 +75,7 @@ const mapStateToProps = state => ({
layout: state.getIn(['meta', 'layout']),
hasComposingText: state.getIn(['compose', 'text']).trim().length !== 0,
hasMediaAttachments: state.getIn(['compose', 'media_attachments']).size > 0,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 4,
canUploadMore: !state.getIn(['compose', 'media_attachments']).some(x => ['audio', 'video'].includes(x.get('type'))) && state.getIn(['compose', 'media_attachments']).size < 20,
layout: state.getIn(['meta', 'layout']),
layout_local_setting: state.getIn(['local_settings', 'layout']),
isWide: state.getIn(['local_settings', 'stretch']),

@ -62,9 +62,16 @@
}
.emojione {
width: 20px;
height: 20px;
margin: -3px 0 0;
width: 32px;
height: 32px;
margin: 0;
}
img.emojione[alt^=":sticker_"] {
width: 128px;
height: 128px;
display: block;
margin: 0 auto;
}
p,
@ -572,9 +579,9 @@
line-height: 24px;
.emojione {
width: 24px;
height: 24px;
margin: -1px 0 0;
width: 32px;
height: 32px;
margin: 0;
}
}

@ -1,6 +1,7 @@
import EXIF from 'exif-js';
const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
//const MAX_IMAGE_PIXELS = 2073600; // 1920x1080px
const MAX_IMAGE_PIXELS = 8294400; // 3840x2160px (HiDPI patch)
const _browser_quirks = {};

@ -1367,7 +1367,7 @@
{
"descriptors": [
{
"defaultMessage": "Local timeline",
"defaultMessage": "The Tavern",
"id": "column.community"
},
{
@ -1375,7 +1375,7 @@
"id": "dismissable_banner.community_timeline"
},
{
"defaultMessage": "The local timeline is empty. Write something publicly to get the ball rolling!",
"defaultMessage": "The Tavern is empty. Write something publicly to get the ball rolling!",
"id": "empty_column.community"
}
],
@ -1858,7 +1858,7 @@
"id": "navigation_bar.public_timeline"
},
{
"defaultMessage": "Local timeline",
"defaultMessage": "The Tavern",
"id": "navigation_bar.community_timeline"
},
{
@ -2436,7 +2436,7 @@
"id": "column_subheading.settings"
},
{
"defaultMessage": "Local timeline",
"defaultMessage": "The Tavern",
"id": "navigation_bar.community_timeline"
},
{
@ -2529,7 +2529,7 @@
"id": "hashtag.column_settings.tag_toggle"
},
{
"defaultMessage": "Local only",
"defaultMessage": "Tavern only",
"id": "community.column_settings.local_only"
}
],
@ -2770,7 +2770,7 @@
"id": "keyboard_shortcuts.notifications"
},
{
"defaultMessage": "to open local timeline",
"defaultMessage": "to open the Tavern",
"id": "keyboard_shortcuts.local"
},
{
@ -4207,7 +4207,7 @@
"id": "explore.title"
},
{
"defaultMessage": "Local",
"defaultMessage": "The Tavern",
"id": "tabs_bar.local_timeline"
},
{
@ -4282,6 +4282,34 @@
{
"descriptors": [
{
<<<<<<< HEAD
"defaultMessage": "Home",
"id": "tabs_bar.home"
},
{
"defaultMessage": "Notifications",
"id": "tabs_bar.notifications"
},
{
"defaultMessage": "The Tavern",
"id": "tabs_bar.local_timeline"
},
{
"defaultMessage": "Federated",
"id": "tabs_bar.federated_timeline"
},
{
"defaultMessage": "Search",
"id": "tabs_bar.search"
}
],
"path": "app/javascript/mastodon/features/ui/components/tabs_bar.json"
},
{
"descriptors": [
{
=======
>>>>>>> origin/main
"defaultMessage": "Drag & drop to upload",
"id": "upload_area.title"
}
@ -4359,4 +4387,4 @@
],
"path": "app/javascript/mastodon/features/video/index.json"
}
]
]

@ -101,7 +101,7 @@
"column.about": "About",
"column.blocks": "Blocked users",
"column.bookmarks": "Bookmarks",
"column.community": "Local timeline",
"column.community": "The Tavern",
"column.direct": "Private mentions",
"column.directory": "Browse profiles",
"column.domain_blocks": "Blocked domains",
@ -121,7 +121,7 @@
"column_header.show_settings": "Show settings",
"column_header.unpin": "Unpin",
"column_subheading.settings": "Settings",
"community.column_settings.local_only": "Local only",
"community.column_settings.local_only": "Tavern only",
"community.column_settings.media_only": "Media Only",
"community.column_settings.remote_only": "Remote only",
"compose.language.change": "Change language",
@ -215,7 +215,7 @@
"empty_column.account_unavailable": "Profile unavailable",
"empty_column.blocks": "You haven't blocked any users yet.",
"empty_column.bookmarked_statuses": "You don't have any bookmarked posts yet. When you bookmark one, it will show up here.",
"empty_column.community": "The local timeline is empty. Write something publicly to get the ball rolling!",
"empty_column.community": "The Tavern is empty. Write something publicly to get the ball rolling!",
"empty_column.direct": "You don't have any private mentions yet. When you send or receive one, it will show up here.",
"empty_column.domain_blocks": "There are no blocked domains yet.",
"empty_column.explore_statuses": "Nothing is trending right now. Check back later!",
@ -324,7 +324,7 @@
"keyboard_shortcuts.home": "Open home timeline",
"keyboard_shortcuts.hotkey": "Hotkey",
"keyboard_shortcuts.legend": "Display this legend",
"keyboard_shortcuts.local": "Open local timeline",
"keyboard_shortcuts.local": "Enter the Tavern",
"keyboard_shortcuts.mention": "Mention author",
"keyboard_shortcuts.muted": "Open muted users list",
"keyboard_shortcuts.my_profile": "Open your profile",
@ -374,7 +374,7 @@
"navigation_bar.about": "About",
"navigation_bar.blocks": "Blocked users",
"navigation_bar.bookmarks": "Bookmarks",
"navigation_bar.community_timeline": "Local timeline",
"navigation_bar.community_timeline": "The Tavern",
"navigation_bar.compose": "Compose new post",
"navigation_bar.direct": "Private mentions",
"navigation_bar.discover": "Discover",
@ -611,7 +611,7 @@
"suggestions.header": "You might be interested in…",
"tabs_bar.federated_timeline": "Federated",
"tabs_bar.home": "Home",
"tabs_bar.local_timeline": "Local",
"tabs_bar.local_timeline": "The Tavern",
"tabs_bar.notifications": "Notifications",
"time_remaining.days": "{number, plural, one {# day} other {# days}} left",
"time_remaining.hours": "{number, plural, one {# hour} other {# hours}} left",

@ -85,6 +85,8 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
attach_tags(@status)
end
StatusesIndex.import! @status if Chewy.enabled?
resolve_thread(@status)
fetch_replies(@status)
distribute
@ -123,7 +125,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
visibility: @status_parser.visibility,
thread: replied_to_status,
conversation: conversation_from_uri(@object['conversation']),
media_attachment_ids: process_attachments.take(4).map(&:id),
media_attachment_ids: process_attachments.take(20).map(&:id),
poll: process_poll,
}
end
@ -255,7 +257,7 @@ class ActivityPub::Activity::Create < ActivityPub::Activity
as_array(@object['attachment']).each do |attachment|
media_attachment_parser = ActivityPub::Parser::MediaAttachmentParser.new(attachment)
next if media_attachment_parser.remote_url.blank? || media_attachments.size >= 4
next if media_attachment_parser.remote_url.blank? || media_attachments.size >= 20
begin
media_attachment = MediaAttachment.create(

@ -17,28 +17,9 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter
Chewy::Index::Import::BulkBuilder.new(index, to_index: Status.includes(:media_attachments, :preloadable_poll).where(id: status_ids)).bulk_body
end
indexed = 0
indexed = bulk.length
deleted = 0
# We can't use the delete_if proc to do the filtering because delete_if
# is called before rendering the data and we need to filter based
# on the results of the filter, so this filtering happens here instead
bulk.map! do |entry|
new_entry = if entry[:index] && entry.dig(:index, :data, 'searchable_by').blank?
{ delete: entry[:index].except(:data) }
else
entry
end
if new_entry[:index]
indexed += 1
else
deleted += 1
end
new_entry
end
Chewy::Index::Import::BulkRequest.new(index).perform(bulk)
[indexed, deleted]
@ -66,11 +47,11 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter
end
def local_mentions_scope
Mention.where(account: Account.local, silent: false).select(:id, :status_id)
Mention.where(silent: false).select(:id, :status_id)
end
def local_favourites_scope
Favourite.where(account: Account.local).select(:id, :status_id)
Favourite.select(:id, :status_id)
end
def local_bookmarks_scope
@ -78,10 +59,10 @@ class Importer::StatusesIndexImporter < Importer::BaseImporter
end
def local_votes_scope
Poll.joins(:votes).where(votes: { account: Account.local }).select('polls.id, polls.status_id')
Poll.joins(:votes).select('polls.id, polls.status_id')
end
def local_statuses_scope
Status.local.select('"statuses"."id", COALESCE("statuses"."reblog_of_id", "statuses"."id") AS status_id')
Status.select('"statuses"."id", COALESCE("statuses"."reblog_of_id", "statuses"."id") AS status_id')
end
end

@ -23,6 +23,10 @@ class AccountStatusesCleanupPolicy < ApplicationRecord
include Redisable
ALLOWED_MIN_STATUS_AGE = [
1.day.seconds,
2.days.seconds,
3.days.seconds,
5.days.seconds,
1.week.seconds,
2.weeks.seconds,
1.month.seconds,

@ -74,7 +74,8 @@ class MediaAttachment < ApplicationRecord
}.freeze,
small: {
pixels: 230_400, # 640x360px
# pixels: 230_400, # 640x360px
pixels: 640_000, # 800x800px (HiDPI patch)
file_geometry_parser: FastGeometryParser,
blurhash: BLURHASH_OPTIONS,
}.freeze,
@ -135,7 +136,7 @@ class MediaAttachment < ApplicationRecord
convert_options: {
output: {
'loglevel' => 'fatal',
vf: 'scale=\'min(400\, iw):min(400\, ih)\':force_original_aspect_ratio=decrease',
vf: 'scale=\'min(800\, iw):min(800\, ih)\':force_original_aspect_ratio=decrease',
}.freeze,
}.freeze,
format: 'png',

@ -149,28 +149,6 @@ class Status < ApplicationRecord
"v2:#{super}"
end
def searchable_by(preloaded = nil)
ids = []
ids << account_id if local?
if preloaded.nil?
ids += mentions.joins(:account).merge(Account.local).active.pluck(:account_id)
ids += favourites.joins(:account).merge(Account.local).pluck(:account_id)
ids += reblogs.joins(:account).merge(Account.local).pluck(:account_id)
ids += bookmarks.joins(:account).merge(Account.local).pluck(:account_id)
ids += poll.votes.joins(:account).merge(Account.local).pluck(:account_id) if poll.present?
else
ids += preloaded.mentions[id] || []
ids += preloaded.favourites[id] || []
ids += preloaded.reblogs[id] || []
ids += preloaded.bookmarks[id] || []
ids += preloaded.votes[id] || []
end
ids.uniq
end
def searchable_text
[
spoiler_text,

@ -90,6 +90,8 @@ class ActivityPub::ProcessAccountService < BaseService
set_fetchable_attributes! unless @options[:only_key] || @account.suspended?
@account.save_with_optional_media!
AccountsIndex.import! @account if Chewy.enabled?
end
def set_immediate_protocol_attributes!

@ -54,6 +54,8 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
broadcast_updates!
end
StatusesIndex.import! @status if Chewy.enabled?
forward_activity! if significant_changes? && @status_parser.edited_at > last_edit_date
end
@ -72,7 +74,7 @@ class ActivityPub::ProcessStatusUpdateService < BaseService
as_array(@json['attachment']).each do |attachment|
media_attachment_parser = ActivityPub::Parser::MediaAttachmentParser.new(attachment)
next if media_attachment_parser.remote_url.blank? || @next_media_attachments.size > 4
next if media_attachment_parser.remote_url.blank? || @next_media_attachments.size > 20
begin
media_attachment = previous_media_attachments.find { |previous_media_attachment| previous_media_attachment.remote_url == media_attachment_parser.remote_url }

@ -144,9 +144,9 @@ class PostStatusService < BaseService
return
end
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll].present?
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 20 || @options[:poll].present? # Attachment limit patch
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i))
@media = @account.media_attachments.where(status_id: nil).where(id: @options[:media_ids].take(20).map(&:to_i)) # Attachment limit patch
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if @media.size > 1 && @media.find(&:audio_or_video?)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_ready') if @media.any?(&:not_processed?)

@ -35,7 +35,7 @@ class SearchService < BaseService
end
def perform_statuses_search!
definition = parsed_query.apply(StatusesIndex.filter(term: { searchable_by: @account.id }))
definition = parsed_query.apply(StatusesIndex)
definition = definition.filter(term: { account_id: @options[:account_id] }) if @options[:account_id].present?

@ -70,9 +70,9 @@ class UpdateStatusService < BaseService
def validate_media!
return [] if @options[:media_ids].blank? || !@options[:media_ids].is_a?(Enumerable)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 4 || @options[:poll].present?
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.too_many') if @options[:media_ids].size > 20 || @options[:poll].present? # Attachment limit patch
media_attachments = @status.account.media_attachments.where(status_id: [nil, @status.id]).where(scheduled_status_id: nil).where(id: @options[:media_ids].take(4).map(&:to_i)).to_a
media_attachments = @status.account.media_attachments.where(status_id: [nil, @status.id]).where(scheduled_status_id: nil).where(id: @options[:media_ids].take(20).map(&:to_i)).to_a # Attachment limit patch
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.images_and_video') if media_attachments.size > 1 && media_attachments.find(&:audio_or_video?)
raise Mastodon::ValidationError, I18n.t('media_attachments.validations.not_ready') if media_attachments.any?(&:not_processed?)

@ -101,7 +101,8 @@ class Rack::Attack
API_DELETE_REBLOG_REGEX = /\A\/api\/v1\/statuses\/[\d]+\/unreblog\z/.freeze
API_DELETE_STATUS_REGEX = /\A\/api\/v1\/statuses\/[\d]+\z/.freeze
throttle('throttle_api_delete', limit: 30, period: 30.minutes) do |req|
#throttle('throttle_api_delete', limit: 30, period: 30.minutes) do |req|
throttle('throttle_api_delete', limit: 300, period: 5.minutes) do |req| # deletion rate limit patch
req.authenticated_user_id if (req.post? && req.path.match?(API_DELETE_REBLOG_REGEX)) || (req.delete? && req.path.match?(API_DELETE_STATUS_REGEX))
end

@ -1581,6 +1581,11 @@ en:
keep_self_fav: Keep posts you favourited
keep_self_fav_hint: Doesn't delete your own posts if you have favourited them
min_age:
'86400': 1 day
'172800': 2 days
'259200': 3 days
'432000': 5 days
'604800': 1 week
'1209600': 2 weeks
'15778476': 6 months
'2629746': 1 month

@ -115,11 +115,15 @@ module Mastodon
loop do
objects = begin
bucket.objects(start_after: last_key, prefix: prefix).limit(1000).map { |x| x }
rescue => e
progress.log(pastel.red("Error fetching list of files: #{e}"))
progress.log("If you want to continue from this point, add --start-after=#{last_key} to your command") if last_key
break
begin
bucket.objects(start_after: last_key, prefix: prefix).limit(1000).map { |x| x }
rescue => e
progress.log(pastel.red("Error fetching list of files: #{e}"))
progress.log("Sleeping for 5 seconds")
sleep 5
progress.log("Retrying")
retry
end
end
break if objects.empty?

Loading…
Cancel
Save