Merge commit '5694e24bbf9afccbbf1b44d3a405a4e2bc0ff08d' into glitch-soc/merge-upstream

Conflicts:
- `.github/workflows/build-nightly.yml`:
  Upstream changed the environment variables used for defining the version
  number. This change occurs close to lines that were modified in glitch-soc
  to account for the different repositories to push to.
  Ported upstream changes.
- `.github/workflows/build-push-pr.yml`:
  Upstream changed the environment variables used for defining the version
  number. This change occurs close to lines that were modified in glitch-soc
  to account for the different repositories to push to.
  Ported upstream changes.
- `lib/mastodon/version.rb`:
  Upstream changed how the version string is built from environment variables.
  Adapted the logic to account for the `+glitch` in glitch-soc.
This commit is contained in:
Claire 2023-09-02 11:56:09 +02:00
commit 3c7dbf3a16
9 changed files with 35 additions and 21 deletions

View File

@ -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 }}

View File

@ -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

View File

@ -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: |

View File

@ -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

View File

@ -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}`),

View File

@ -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.",

View File

@ -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

View File

@ -3,6 +3,8 @@
class AddToPublicStatusesIndexWorker
include Sidekiq::Worker
sidekiq_options queue: 'pull'
def perform(account_id)
account = Account.find(account_id)

View File

@ -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