diff --git a/.github/workflows/build-container-image.yml b/.github/workflows/build-container-image.yml index 1b15d19885..897bb9caaa 100644 --- a/.github/workflows/build-container-image.yml +++ b/.github/workflows/build-container-image.yml @@ -8,7 +8,9 @@ on: type: boolean push_to_images: type: string - version_suffix: + version_prerelease: + type: string + version_metadata: type: string flavor: type: string @@ -83,7 +85,9 @@ jobs: - uses: docker/build-push-action@v4 with: context: . - build-args: MASTODON_VERSION_SUFFIX=${{ inputs.version_suffix }} + build-args: | + MASTODON_VERSION_PRERELEASE=${{ inputs.version_prerelease }} + MASTODON_VERSION_METADATA=${{ inputs.version_metadata }} platforms: ${{ inputs.platforms }} provenance: false builder: ${{ steps.buildx.outputs.name || steps.buildx-native.outputs.name }} diff --git a/.github/workflows/build-nightly.yml b/.github/workflows/build-nightly.yml index a3ae671d67..2600cf924b 100644 --- a/.github/workflows/build-nightly.yml +++ b/.github/workflows/build-nightly.yml @@ -16,9 +16,9 @@ jobs: env: TZ: Etc/UTC run: | - echo mastodon_version_suffix=nightly.$(date +'%Y-%m-%d')>> $GITHUB_OUTPUT + echo mastodon_version_prerelease=nightly.$(date +'%Y-%m-%d')>> $GITHUB_OUTPUT outputs: - suffix: ${{ steps.version_vars.outputs.mastodon_version_suffix }} + prerelease: ${{ steps.version_vars.outputs.mastodon_version_prerelease }} build-image: needs: compute-suffix @@ -28,8 +28,7 @@ jobs: use_native_arm64_builder: false push_to_images: | ghcr.io/${{ github.repository_owner }}/mastodon - # The `-` is important here, result will be v4.1.2-nightly.2022-03-05 - version_suffix: -${{ needs.compute-suffix.outputs.suffix }} + version_prerelease: ${{ needs.compute-suffix.outputs.prerelease }} labels: | org.opencontainers.image.description=Nightly build image used for testing purposes flavor: | @@ -37,5 +36,5 @@ jobs: tags: | type=raw,value=edge type=raw,value=nightly - type=schedule,pattern=${{ needs.compute-suffix.outputs.suffix }} + type=schedule,pattern=${{ needs.compute-suffix.outputs.prerelease }} secrets: inherit diff --git a/.github/workflows/build-push-pr.yml b/.github/workflows/build-push-pr.yml index f78e5ebada..cf11d66533 100644 --- a/.github/workflows/build-push-pr.yml +++ b/.github/workflows/build-push-pr.yml @@ -21,9 +21,9 @@ jobs: uses: actions/checkout@v3 - id: version_vars run: | - echo mastodon_version_suffix=+pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT + echo mastodon_version_metadata=pr-${{ github.event.pull_request.number }}-$(git rev-parse --short HEAD) >> $GITHUB_OUTPUT outputs: - suffix: ${{ steps.version_vars.outputs.mastodon_version_suffix }} + metadata: ${{ steps.version_vars.outputs.mastodon_version_metadata }} build-image: needs: compute-suffix @@ -33,7 +33,7 @@ jobs: use_native_arm64_builder: false push_to_images: | ghcr.io/${{ github.repository_owner }}/mastodon - version_suffix: ${{ needs.compute-suffix.outputs.suffix }} + version_metadata: ${{ needs.compute-suffix.outputs.metadata }} flavor: | latest=auto tags: | diff --git a/Dockerfile b/Dockerfile index cb5096581c..cdabc4c7c8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -42,8 +42,8 @@ RUN apt-get update && \ FROM node:${NODE_VERSION} # Use those args to specify your own version flags & suffixes -ARG MASTODON_VERSION_FLAGS="" -ARG MASTODON_VERSION_SUFFIX="" +ARG MASTODON_VERSION_PRERELEASE="" +ARG MASTODON_VERSION_METADATA="" ARG UID="991" ARG GID="991" @@ -89,8 +89,8 @@ ENV RAILS_ENV="production" \ NODE_ENV="production" \ RAILS_SERVE_STATIC_FILES="true" \ BIND="0.0.0.0" \ - MASTODON_VERSION_FLAGS="${MASTODON_VERSION_FLAGS}" \ - MASTODON_VERSION_SUFFIX="${MASTODON_VERSION_SUFFIX}" + MASTODON_VERSION_PRERELEASE="${MASTODON_VERSION_PRERELEASE}" \ + MASTODON_VERSION_METADATA="${MASTODON_VERSION_METADATA}" # Set the run user USER mastodon diff --git a/app/javascript/mastodon/actions/compose.js b/app/javascript/mastodon/actions/compose.js index 5f7b8e949f..e68afcbf9d 100644 --- a/app/javascript/mastodon/actions/compose.js +++ b/app/javascript/mastodon/actions/compose.js @@ -84,6 +84,7 @@ const messages = defineMessages({ uploadErrorPoll: { id: 'upload_error.poll', defaultMessage: 'File upload not allowed with polls.' }, open: { id: 'compose.published.open', defaultMessage: 'Open' }, published: { id: 'compose.published.body', defaultMessage: 'Post published.' }, + saved: { id: 'compose.saved.body', defaultMessage: 'Post saved.' }, }); export const ensureComposeIsVisible = (getState, routerHistory) => { @@ -246,7 +247,7 @@ export function submitCompose(routerHistory) { } dispatch(showAlert({ - message: messages.published, + message: statusId === null ? messages.published : messages.saved, action: messages.open, dismissAfter: 10000, onClick: () => routerHistory.push(`/@${response.data.account.username}/${response.data.id}`), diff --git a/app/javascript/mastodon/locales/en.json b/app/javascript/mastodon/locales/en.json index d4cd8c7945..5eeaf8044b 100644 --- a/app/javascript/mastodon/locales/en.json +++ b/app/javascript/mastodon/locales/en.json @@ -137,6 +137,7 @@ "compose.language.search": "Search languages...", "compose.published.body": "Post published.", "compose.published.open": "Open", + "compose.saved.body": "Post saved.", "compose_form.direct_message_warning_learn_more": "Learn more", "compose_form.encryption_warning": "Posts on Mastodon are not end-to-end encrypted. Do not share any sensitive information over Mastodon.", "compose_form.hashtag_warning": "This post won't be listed under any hashtag as it is not public. Only public posts can be searched by hashtag.", diff --git a/app/models/concerns/account_statuses_search.rb b/app/models/concerns/account_statuses_search.rb index 563a871051..626bf38900 100644 --- a/app/models/concerns/account_statuses_search.rb +++ b/app/models/concerns/account_statuses_search.rb @@ -31,7 +31,7 @@ module AccountStatusesSearch def add_to_public_statuses_index! return unless Chewy.enabled? - statuses.indexable.find_in_batches do |batch| + statuses.without_reblogs.where(visibility: :public).find_in_batches do |batch| PublicStatusesIndex.import(query: batch) end end diff --git a/app/workers/add_to_public_statuses_index_worker.rb b/app/workers/add_to_public_statuses_index_worker.rb index 409e5e7086..33529a4c1d 100644 --- a/app/workers/add_to_public_statuses_index_worker.rb +++ b/app/workers/add_to_public_statuses_index_worker.rb @@ -3,6 +3,8 @@ class AddToPublicStatusesIndexWorker include Sidekiq::Worker + sidekiq_options queue: 'pull' + def perform(account_id) account = Account.find(account_id) diff --git a/lib/mastodon/version.rb b/lib/mastodon/version.rb index 26ffaf0388..9052fe3c1b 100644 --- a/lib/mastodon/version.rb +++ b/lib/mastodon/version.rb @@ -16,12 +16,16 @@ module Mastodon 0 end - def flags - ENV['MASTODON_VERSION_FLAGS'].presence || '-beta2' + def default_prerelease + 'beta2' end - def suffix - "+glitch#{ENV.fetch('MASTODON_VERSION_SUFFIX', '')}" + def prerelease + ENV['MASTODON_VERSION_PRERELEASE'].presence || default_prerelease + end + + def build_metadata + ['glitch', ENV.fetch('MASTODON_VERSION_METADATA', nil)].compact.join('.') end def to_a @@ -29,7 +33,10 @@ module Mastodon end def to_s - [to_a.join('.'), flags, suffix].join + components = [to_a.join('.')] + components << "-#{prerelease}" if prerelease.present? + components << "+#{build_metadata}" if build_metadata.present? + components.join end def repository