forked from mastodon/mastodon
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #503 from kmycode/upstream-20240125
Upstream 20240125
- Loading branch information
Showing
68 changed files
with
825 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V1::AnnualReportsController < Api::BaseController | ||
before_action -> { doorkeeper_authorize! :read, :'read:accounts' }, only: :index | ||
before_action -> { doorkeeper_authorize! :write, :'write:accounts' }, except: :index | ||
before_action :require_user! | ||
before_action :set_annual_report, except: :index | ||
|
||
def index | ||
with_read_replica do | ||
@presenter = AnnualReportsPresenter.new(GeneratedAnnualReport.where(account_id: current_account.id).pending) | ||
@relationships = StatusRelationshipsPresenter.new(@presenter.statuses, current_account.id) | ||
end | ||
|
||
render json: @presenter, | ||
serializer: REST::AnnualReportsSerializer, | ||
relationships: @relationships | ||
end | ||
|
||
def read | ||
@annual_report.view! | ||
render_empty | ||
end | ||
|
||
private | ||
|
||
def set_annual_report | ||
@annual_report = GeneratedAnnualReport.find_by!(account_id: current_account.id, year: params[:id]) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class Redirect::AccountsController < ApplicationController | ||
private | ||
|
||
def set_resource | ||
@resource = Account.find(params[:id]) | ||
not_found if @resource.local? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
# frozen_string_literal: true | ||
|
||
class Redirect::BaseController < ApplicationController | ||
vary_by 'Accept-Language' | ||
|
||
before_action :set_resource | ||
before_action :set_app_body_class | ||
|
||
def show | ||
@redirect_path = ActivityPub::TagManager.instance.url_for(@resource) | ||
|
||
render 'redirects/show', layout: 'application' | ||
end | ||
|
||
private | ||
|
||
def set_app_body_class | ||
@body_classes = 'app-body' | ||
end | ||
|
||
def set_resource | ||
raise NotImplementedError | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# frozen_string_literal: true | ||
|
||
class Redirect::StatusesController < Redirect::BaseController | ||
private | ||
|
||
def set_resource | ||
@resource = Status.find(params[:id]) | ||
not_found if @resource.local? || !@resource.distributable? | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.