From 12d35783db1bb302d7540d8d3690ab6eed3dac3b Mon Sep 17 00:00:00 2001 From: Starfall Date: Sun, 1 Mar 2020 14:49:21 -0600 Subject: Revert "Merge branch 'glitch'" Login is broken This reverts commit 22a55edc158352003a3953964c9d332a60c86428, reversing changes made to 5902299384d15249fe4b84b8761d4a49f3c7f6fd. --- app/controllers/accounts_controller.rb | 2 +- app/controllers/api/v1/announcements_controller.rb | 2 +- .../api/v1/statuses/bookmarks_controller.rb | 27 ++++++++++++++-------- .../statuses/favourited_by_accounts_controller.rb | 3 ++- .../api/v1/statuses/favourites_controller.rb | 26 +++++++++++++-------- .../statuses/reblogged_by_accounts_controller.rb | 3 ++- .../api/v1/statuses/reblogs_controller.rb | 27 +++++++++++----------- app/controllers/auth/registrations_controller.rb | 3 ++- .../flavours/glitch/components/error_boundary.js | 22 ++---------------- .../features/compose/components/compose_form.js | 12 +++++----- .../features/compose/components/publisher.js | 8 ++----- .../glitch/features/keyboard_shortcuts/index.js | 4 ---- .../flavours/glitch/util/base_polyfills.js | 3 --- .../flavours/glitch/util/load_polyfills.js | 3 +-- app/javascript/flavours/glitch/util/main.js | 2 +- app/javascript/mastodon/base_polyfills.js | 3 --- .../mastodon/components/error_boundary.js | 25 +++----------------- app/javascript/mastodon/load_polyfills.js | 3 +-- app/javascript/mastodon/main.js | 2 +- app/models/account.rb | 11 +-------- .../activitypub/process_account_service.rb | 7 +++--- app/services/backup_service.rb | 2 -- app/services/follow_service.rb | 5 ++-- app/services/resolve_account_service.rb | 2 +- app/views/admin/accounts/show.html.haml | 6 ++--- app/views/auth/registrations/new.html.haml | 2 +- app/views/authorize_interactions/show.html.haml | 6 ----- 27 files changed, 84 insertions(+), 137 deletions(-) (limited to 'app') diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index ee48da177..c4ee22847 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -9,7 +9,7 @@ class AccountsController < ApplicationController before_action :set_cache_headers before_action :set_body_classes - skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format&.to_sym) } + skip_around_action :set_locale, if: -> { [:json, :rss].include?(request.format) } skip_before_action :require_functional! def show diff --git a/app/controllers/api/v1/announcements_controller.rb b/app/controllers/api/v1/announcements_controller.rb index ee79fc19f..1e692ff75 100644 --- a/app/controllers/api/v1/announcements_controller.rb +++ b/app/controllers/api/v1/announcements_controller.rb @@ -11,7 +11,7 @@ class Api::V1::AnnouncementsController < Api::BaseController end def dismiss - AnnouncementMute.find_or_create_by!(account: current_account, announcement: @announcement) + AnnouncementMute.create!(account: current_account, announcement: @announcement) render_empty end diff --git a/app/controllers/api/v1/statuses/bookmarks_controller.rb b/app/controllers/api/v1/statuses/bookmarks_controller.rb index a7f1eed00..bb9729cf5 100644 --- a/app/controllers/api/v1/statuses/bookmarks_controller.rb +++ b/app/controllers/api/v1/statuses/bookmarks_controller.rb @@ -5,28 +5,35 @@ class Api::V1::Statuses::BookmarksController < Api::BaseController before_action -> { doorkeeper_authorize! :write, :'write:bookmarks' } before_action :require_user! - before_action :set_status respond_to :json def create - current_account.bookmarks.find_or_create_by!(account: current_account, status: @status) + @status = bookmarked_status render json: @status, serializer: REST::StatusSerializer end def destroy - bookmark = current_account.bookmarks.find_by(status: @status) - bookmark&.destroy! + @status = requested_status + @bookmarks_map = { @status.id => false } - render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, bookmarks_map: { @status.id => false }) + bookmark = Bookmark.find_by!(account: current_user.account, status: @status) + bookmark.destroy! + + render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_user&.account_id, bookmarks_map: @bookmarks_map) end private - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found + def bookmarked_status + authorize_with current_user.account, requested_status, :show? + + bookmark = Bookmark.find_or_create_by!(account: current_user.account, status: requested_status) + + bookmark.status.reload + end + + def requested_status + Status.find(params[:status_id]) end end diff --git a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb index 05f4acc33..99eff360e 100644 --- a/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/favourited_by_accounts_controller.rb @@ -69,7 +69,8 @@ class Api::V1::Statuses::FavouritedByAccountsController < Api::BaseController @status = Status.find(params[:status_id]) authorize @status, :show? rescue Mastodon::NotPermittedError - not_found + # Reraise in order to get a 404 instead of a 403 error code + raise ActiveRecord::RecordNotFound end def pagination_params(core_params) diff --git a/app/controllers/api/v1/statuses/favourites_controller.rb b/app/controllers/api/v1/statuses/favourites_controller.rb index f18ace996..cceee9060 100644 --- a/app/controllers/api/v1/statuses/favourites_controller.rb +++ b/app/controllers/api/v1/statuses/favourites_controller.rb @@ -5,26 +5,34 @@ class Api::V1::Statuses::FavouritesController < Api::BaseController before_action -> { doorkeeper_authorize! :write, :'write:favourites' } before_action :require_user! - before_action :set_status respond_to :json def create - FavouriteService.new.call(current_account, @status) + @status = favourited_status render json: @status, serializer: REST::StatusSerializer end def destroy - UnfavouriteWorker.perform_async(current_account.id, @status.id) - render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, favourites_map: { @status.id => false }) + @status = requested_status + @favourites_map = { @status.id => false } + + UnfavouriteWorker.perform_async(current_user.account_id, @status.id) + + render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_user&.account_id, favourites_map: @favourites_map) end private - def set_status - @status = Status.find(params[:status_id]) - authorize @status, :show? - rescue Mastodon::NotPermittedError - not_found + def favourited_status + service_result.status.reload + end + + def service_result + FavouriteService.new.call(current_user.account, requested_status) + end + + def requested_status + Status.find(params[:status_id]) end end diff --git a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb index fa60e7d84..cc285ad23 100644 --- a/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb +++ b/app/controllers/api/v1/statuses/reblogged_by_accounts_controller.rb @@ -66,7 +66,8 @@ class Api::V1::Statuses::RebloggedByAccountsController < Api::BaseController @status = Status.find(params[:status_id]) authorize @status, :show? rescue Mastodon::NotPermittedError - not_found + # Reraise in order to get a 404 instead of a 403 error code + raise ActiveRecord::RecordNotFound end def pagination_params(core_params) diff --git a/app/controllers/api/v1/statuses/reblogs_controller.rb b/app/controllers/api/v1/statuses/reblogs_controller.rb index 67106ccbe..42381a37f 100644 --- a/app/controllers/api/v1/statuses/reblogs_controller.rb +++ b/app/controllers/api/v1/statuses/reblogs_controller.rb @@ -5,34 +5,33 @@ class Api::V1::Statuses::ReblogsController < Api::BaseController before_action -> { doorkeeper_authorize! :write, :'write:statuses' } before_action :require_user! - before_action :set_reblog respond_to :json def create - @status = ReblogService.new.call(current_account, @reblog, reblog_params) + @status = ReblogService.new.call(current_user.account, status_for_reblog, reblog_params) render json: @status, serializer: REST::StatusSerializer end def destroy - @status = current_account.statuses.find_by(reblog_of_id: @reblog.id) + @status = status_for_destroy.reblog + @reblogs_map = { @status.id => false } - if @status - authorize @status, :unreblog? - @status.discard - RemovalWorker.perform_async(@status.id) - end + authorize status_for_destroy, :unreblog? + status_for_destroy.discard + RemovalWorker.perform_async(status_for_destroy.id) - render json: @reblog, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_account.id, reblogs_map: { @reblog.id => false }) + render json: @status, serializer: REST::StatusSerializer, relationships: StatusRelationshipsPresenter.new([@status], current_user&.account_id, reblogs_map: @reblogs_map) end private - def set_reblog - @reblog = Status.find(params[:status_id]) - authorize @reblog, :show? - rescue Mastodon::NotPermittedError - not_found + def status_for_reblog + Status.find params[:status_id] + end + + def status_for_destroy + @status_for_destroy ||= current_user.account.statuses.where(reblog_of_id: params[:status_id]).first! end def reblog_params diff --git a/app/controllers/auth/registrations_controller.rb b/app/controllers/auth/registrations_controller.rb index f6a85d87e..531df7751 100644 --- a/app/controllers/auth/registrations_controller.rb +++ b/app/controllers/auth/registrations_controller.rb @@ -42,6 +42,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController resource.locale = I18n.locale resource.invite_code = params[:invite_code] if resource.invite_code.blank? + resource.agreement = true resource.current_sign_in_ip = request.remote_ip resource.build_account if resource.account.nil? @@ -49,7 +50,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController def configure_sign_up_params devise_parameter_sanitizer.permit(:sign_up) do |u| - u.permit({ account_attributes: [:username], invite_request_attributes: [:text] }, :email, :password, :password_confirmation, :invite_code, :agreement) + u.permit({ account_attributes: [:username], invite_request_attributes: [:text] }, :email, :password, :password_confirmation, :invite_code) end end diff --git a/app/javascript/flavours/glitch/components/error_boundary.js b/app/javascript/flavours/glitch/components/error_boundary.js index 8998802b1..62950a7d3 100644 --- a/app/javascript/flavours/glitch/components/error_boundary.js +++ b/app/javascript/flavours/glitch/components/error_boundary.js @@ -2,7 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { preferencesLink } from 'flavours/glitch/util/backend_links'; -import StackTrace from 'stacktrace-js'; export default class ErrorBoundary extends React.PureComponent { @@ -12,29 +11,15 @@ export default class ErrorBoundary extends React.PureComponent { state = { hasError: false, - errorMessage: undefined, stackTrace: undefined, - mappedStackTrace: undefined, componentStack: undefined, } componentDidCatch(error, info) { this.setState({ hasError: true, - errorMessage: error.toString(), stackTrace: error.stack, componentStack: info && info.componentStack, - mappedStackTrace: undefined, - }); - - StackTrace.fromError(error).then((stackframes) => { - this.setState({ - mappedStackTrace: stackframes.map((sf) => sf.toString()).join('\n'), - }); - }).catch(() => { - this.setState({ - mappedStackTrace: undefined, - }); }); } @@ -44,16 +29,13 @@ export default class ErrorBoundary extends React.PureComponent { } render() { - const { hasError, errorMessage, stackTrace, mappedStackTrace, componentStack } = this.state; + const { hasError, stackTrace, componentStack } = this.state; if (!hasError) return this.props.children; let debugInfo = ''; if (stackTrace) { - debugInfo += 'Stack trace\n-----------\n\n```\n' + errorMessage + '\n' + stackTrace.toString() + '\n```'; - } - if (mappedStackTrace) { - debugInfo += 'Mapped stack trace\n-----------\n\n```\n' + errorMessage + '\n' + mappedStackTrace.toString() + '\n```'; + debugInfo += 'Stack trace\n-----------\n\n```\n' + stackTrace.toString() + '\n```'; } if (componentStack) { if (debugInfo) { diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js index daacbb73f..6e07998ec 100644 --- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js +++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js @@ -93,7 +93,7 @@ class ComposeForm extends ImmutablePureComponent { } } - handleSubmit = (overriddenVisibility = null) => { + handleSubmit = () => { const { textarea: { value }, uploadForm } = this; const { onChange, @@ -106,7 +106,6 @@ class ComposeForm extends ImmutablePureComponent { text, mediaDescriptionConfirmation, onMediaDescriptionConfirm, - onChangeVisibility, } = this.props; // If something changes inside the textarea, then we update the @@ -125,9 +124,6 @@ class ComposeForm extends ImmutablePureComponent { const firstWithoutDescription = media.find(item => !item.get('description')); onMediaDescriptionConfirm(this.context.router ? this.context.router.history : null, firstWithoutDescription.get('id')); } else if (onSubmit) { - if (onChangeVisibility && overriddenVisibility) { - onChangeVisibility(overriddenVisibility); - } onSubmit(this.context.router ? this.context.router.history : null); } } @@ -156,9 +152,13 @@ class ComposeForm extends ImmutablePureComponent { // Handles the secondary submit button. handleSecondarySubmit = () => { const { + onChangeVisibility, sideArm, } = this.props; - this.handleSubmit(sideArm === 'none' ? null : sideArm); + if (sideArm !== 'none' && onChangeVisibility) { + onChangeVisibility(sideArm); + } + this.handleSubmit(); } // Selects a suggestion from the autofill. diff --git a/app/javascript/flavours/glitch/features/compose/components/publisher.js b/app/javascript/flavours/glitch/features/compose/components/publisher.js index 97890f40d..b8d9d98bf 100644 --- a/app/javascript/flavours/glitch/features/compose/components/publisher.js +++ b/app/javascript/flavours/glitch/features/compose/components/publisher.js @@ -38,12 +38,8 @@ class Publisher extends ImmutablePureComponent { sideArm: PropTypes.oneOf(['none', 'direct', 'private', 'unlisted', 'public']), }; - handleSubmit = () => { - this.props.onSubmit(); - }; - render () { - const { countText, disabled, intl, onSecondarySubmit, privacy, sideArm } = this.props; + const { countText, disabled, intl, onSecondarySubmit, onSubmit, privacy, sideArm } = this.props; const diff = maxChars - length(countText || ''); const computedClass = classNames('composer--publisher', { @@ -109,7 +105,7 @@ class Publisher extends ImmutablePureComponent { } }()} title={`${intl.formatMessage(messages.publish)}: ${intl.formatMessage({ id: `privacy.${privacy}.short` })}`} - onClick={this.handleSubmit} + onClick={onSubmit} disabled={disabled || diff < 0} /> diff --git a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js index 0bb71e872..bc7571200 100644 --- a/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js +++ b/app/javascript/flavours/glitch/features/keyboard_shortcuts/index.js @@ -113,10 +113,6 @@ class KeyboardShortcuts extends ImmutablePureComponent { s - - alt+enter - - esc diff --git a/app/javascript/flavours/glitch/util/base_polyfills.js b/app/javascript/flavours/glitch/util/base_polyfills.js index 4b8123dba..ad023eb73 100644 --- a/app/javascript/flavours/glitch/util/base_polyfills.js +++ b/app/javascript/flavours/glitch/util/base_polyfills.js @@ -6,7 +6,6 @@ import assign from 'object-assign'; import values from 'object.values'; import isNaN from 'is-nan'; import { decode as decodeBase64 } from './base64'; -import promiseFinally from 'promise.prototype.finally'; if (!Array.prototype.includes) { includes.shim(); @@ -24,8 +23,6 @@ if (!Number.isNaN) { Number.isNaN = isNaN; } -promiseFinally.shim(); - if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; diff --git a/app/javascript/flavours/glitch/util/load_polyfills.js b/app/javascript/flavours/glitch/util/load_polyfills.js index 73eedc9dc..8cb81c1a6 100644 --- a/app/javascript/flavours/glitch/util/load_polyfills.js +++ b/app/javascript/flavours/glitch/util/load_polyfills.js @@ -18,8 +18,7 @@ function loadPolyfills() { Number.isNaN && Object.assign && Object.values && - window.Symbol && - Promise.prototype.finally + window.Symbol ); // Latest version of Firefox and Safari do not have IntersectionObserver. diff --git a/app/javascript/flavours/glitch/util/main.js b/app/javascript/flavours/glitch/util/main.js index 1fdb9ff2b..b76826481 100644 --- a/app/javascript/flavours/glitch/util/main.js +++ b/app/javascript/flavours/glitch/util/main.js @@ -12,7 +12,7 @@ function main() { if (window.history && history.replaceState) { const { pathname, search, hash } = window.location; const path = pathname + search + hash; - if (!(/^\/web($|\/)/).test(path)) { + if (!(/^\/web[$/]/).test(path)) { history.replaceState(null, document.title, `/web${path}`); } } diff --git a/app/javascript/mastodon/base_polyfills.js b/app/javascript/mastodon/base_polyfills.js index 12096d902..997813a04 100644 --- a/app/javascript/mastodon/base_polyfills.js +++ b/app/javascript/mastodon/base_polyfills.js @@ -6,7 +6,6 @@ import assign from 'object-assign'; import values from 'object.values'; import isNaN from 'is-nan'; import { decode as decodeBase64 } from './utils/base64'; -import promiseFinally from 'promise.prototype.finally'; if (!Array.prototype.includes) { includes.shim(); @@ -24,8 +23,6 @@ if (!Number.isNaN) { Number.isNaN = isNaN; } -promiseFinally.shim(); - if (!HTMLCanvasElement.prototype.toBlob) { const BASE64_MARKER = ';base64,'; diff --git a/app/javascript/mastodon/components/error_boundary.js b/app/javascript/mastodon/components/error_boundary.js index ca3012276..4e1c882e2 100644 --- a/app/javascript/mastodon/components/error_boundary.js +++ b/app/javascript/mastodon/components/error_boundary.js @@ -2,7 +2,6 @@ import React from 'react'; import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { version, source_url } from 'mastodon/initial_state'; -import StackTrace from 'stacktrace-js'; export default class ErrorBoundary extends React.PureComponent { @@ -12,42 +11,24 @@ export default class ErrorBoundary extends React.PureComponent { state = { hasError: false, - errorMessage: undefined, stackTrace: undefined, - mappedStackTrace: undefined, componentStack: undefined, }; componentDidCatch (error, info) { this.setState({ hasError: true, - errorMessage: error.toString(), stackTrace: error.stack, componentStack: info && info.componentStack, - mappedStackTrace: undefined, - }); - - StackTrace.fromError(error).then((stackframes) => { - this.setState({ - mappedStackTrace: stackframes.map((sf) => sf.toString()).join('\n'), - }); - }).catch(() => { - this.setState({ - mappedStackTrace: undefined, - }); + copied: false, }); } handleCopyStackTrace = () => { - const { errorMessage, stackTrace, mappedStackTrace } = this.state; + const { stackTrace } = this.state; const textarea = document.createElement('textarea'); - let contents = [errorMessage, stackTrace]; - if (mappedStackTrace) { - contents.push(mappedStackTrace); - } - - textarea.textContent = contents.join('\n\n\n'); + textarea.textContent = stackTrace; textarea.style.position = 'fixed'; document.body.appendChild(textarea); diff --git a/app/javascript/mastodon/load_polyfills.js b/app/javascript/mastodon/load_polyfills.js index 73eedc9dc..8cb81c1a6 100644 --- a/app/javascript/mastodon/load_polyfills.js +++ b/app/javascript/mastodon/load_polyfills.js @@ -18,8 +18,7 @@ function loadPolyfills() { Number.isNaN && Object.assign && Object.values && - window.Symbol && - Promise.prototype.finally + window.Symbol ); // Latest version of Firefox and Safari do not have IntersectionObserver. diff --git a/app/javascript/mastodon/main.js b/app/javascript/mastodon/main.js index da4884fd3..5d73caa10 100644 --- a/app/javascript/mastodon/main.js +++ b/app/javascript/mastodon/main.js @@ -12,7 +12,7 @@ function main() { if (window.history && history.replaceState) { const { pathname, search, hash } = window.location; const path = pathname + search + hash; - if (!(/^\/web($|\/)/).test(path)) { + if (!(/^\/web[$/]/).test(path)) { history.replaceState(null, document.title, `/web${path}`); } } diff --git a/app/models/account.rb b/app/models/account.rb index 0fcf897c9..e46888415 100644 --- a/app/models/account.rb +++ b/app/models/account.rb @@ -480,16 +480,7 @@ class Account < ApplicationRecord def from_text(text) return [] if text.blank? - text.scan(MENTION_RE).map { |match| match.first.split('@', 2) }.uniq.map do |(username, domain)| - domain = begin - if TagManager.instance.local_domain?(domain) - nil - else - TagManager.instance.normalize_domain(domain) - end - end - EntityCache.instance.mention(username, domain) - end.compact + text.scan(MENTION_RE).map { |match| match.first.split('@', 2) }.uniq.map { |(username, domain)| EntityCache.instance.mention(username, domain) } end private diff --git a/app/services/activitypub/process_account_service.rb b/app/services/activitypub/process_account_service.rb index d5ede0388..cef658e19 100644 --- a/app/services/activitypub/process_account_service.rb +++ b/app/services/activitypub/process_account_service.rb @@ -18,10 +18,9 @@ class ActivityPub::ProcessAccountService < BaseService RedisLock.acquire(lock_options) do |lock| if lock.acquired? - @account = Account.remote.find_by(uri: @uri) if @options[:only_key] - @account ||= Account.find_remote(@username, @domain) - @old_public_key = @account&.public_key - @old_protocol = @account&.protocol + @account = Account.find_remote(@username, @domain) + @old_public_key = @account&.public_key + @old_protocol = @account&.protocol create_account if @account.nil? update_account diff --git a/app/services/backup_service.rb b/app/services/backup_service.rb index 691d024e1..ab6d090a0 100644 --- a/app/services/backup_service.rb +++ b/app/services/backup_service.rb @@ -66,8 +66,6 @@ class BackupService < BaseService def dump_media_attachments!(tar) MediaAttachment.attached.where(account: account).reorder(nil).find_in_batches do |media_attachments| media_attachments.each do |m| - next unless m.file&.path - download_to_tar(tar, m.file, m.file.path) end diff --git a/app/services/follow_service.rb b/app/services/follow_service.rb index 4d19002c4..dc47804c0 100644 --- a/app/services/follow_service.rb +++ b/app/services/follow_service.rb @@ -18,13 +18,14 @@ class FollowService < BaseService if source_account.following?(target_account) # We're already following this account, but we'll call follow! again to # make sure the reblogs status is set correctly. - return source_account.follow!(target_account, reblogs: reblogs) + source_account.follow!(target_account, reblogs: reblogs) + return elsif source_account.requested?(target_account) # This isn't managed by a method in AccountInteractions, so we modify it # ourselves if necessary. req = source_account.follow_requests.find_by(target_account: target_account) req.update!(show_reblogs: reblogs) - return req + return end ActivityTracker.increment('activity:interactions') diff --git a/app/services/resolve_account_service.rb b/app/services/resolve_account_service.rb index 1ad9ed407..12e6544a0 100644 --- a/app/services/resolve_account_service.rb +++ b/app/services/resolve_account_service.rb @@ -99,7 +99,7 @@ class ResolveAccountService < BaseService if lock.acquired? @account = Account.find_remote(@username, @domain) - next if actor_json.nil? + next if (@account.present? && !@account.activitypub?) || actor_json.nil? @account = ActivityPub::ProcessAccountService.new.call(@username, @domain, actor_json) else diff --git a/app/views/admin/accounts/show.html.haml b/app/views/admin/accounts/show.html.haml index a30b78db2..a83f77134 100644 --- a/app/views/admin/accounts/show.html.haml +++ b/app/views/admin/accounts/show.html.haml @@ -27,9 +27,9 @@ = fa_icon 'check' = Formatter.instance.format_field(account, field.value, custom_emojify: true) - - if account.note.present? - %div - .account__header__content.emojify= Formatter.instance.simplified_format(account, custom_emojify: true) + - if account.note.present? + %div + .account__header__content.emojify= Formatter.instance.simplified_format(account, custom_emojify: true) .dashboard__counters{ style: 'margin-top: 10px' } %div diff --git a/app/views/auth/registrations/new.html.haml b/app/views/auth/registrations/new.html.haml index bcd66fb8a..e807c8d86 100644 --- a/app/views/auth/registrations/new.html.haml +++ b/app/views/auth/registrations/new.html.haml @@ -27,7 +27,7 @@ - if approved_registrations? && !@invite.present? .fields-group - = f.simple_fields_for :invite_request, resource.invite_request || resource.build_invite_request do |invite_request_fields| + = f.simple_fields_for :invite_request do |invite_request_fields| = invite_request_fields.input :text, as: :text, wrapper: :with_block_label, required: false = f.input :invite_code, as: :hidden diff --git a/app/views/authorize_interactions/show.html.haml b/app/views/authorize_interactions/show.html.haml index 42c874134..7ca9b98c1 100644 --- a/app/views/authorize_interactions/show.html.haml +++ b/app/views/authorize_interactions/show.html.haml @@ -10,12 +10,6 @@ %strong = t('authorize_follow.already_following') - = render 'post_follow_actions' - - elsif current_account.requested?(@resource) - .flash-message - %strong - = t('authorize_follow.already_requested') - = render 'post_follow_actions' - else = form_tag authorize_interaction_path, method: :post, class: 'simple_form' do -- cgit