forked from mastodon/mastodon
-
Notifications
You must be signed in to change notification settings - Fork 4
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 #68 from MozillaSocial/upstream-v4.2.8-main-changes
Reset to upstream v4.2.8 with select changes
- Loading branch information
Showing
29 changed files
with
1,640 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
name: Glean probe-scraper | ||
on: [push, pull_request] | ||
jobs: | ||
glean-probe-scraper: | ||
uses: mozilla/probe-scraper/.github/workflows/glean.yaml@main |
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,110 @@ | ||
# Any copyright is dedicated to the Public Domain. | ||
# https://creativecommons.org/publicdomain/zero/1.0/ | ||
|
||
--- | ||
$schema: moz://mozilla.org/schemas/glean/metrics/2-0-0 | ||
|
||
identifiers: | ||
fxa_account_id: | ||
type: string | ||
description: > | ||
The user's FxA account ID, if available. | ||
bugs: | ||
- TBD | ||
data_reviews: | ||
- TBD | ||
notification_emails: | ||
- mozillasocial-data-eng@mozilla.com | ||
expires: never | ||
lifetime: application | ||
send_in_pings: | ||
- events | ||
|
||
mastodon_account_id: | ||
type: string | ||
description: > | ||
The user's numeric account ID from Mastodon. | ||
bugs: | ||
- TBD | ||
data_reviews: | ||
- TBD | ||
notification_emails: | ||
- mozillasocial-data-eng@mozilla.com | ||
expires: never | ||
lifetime: application | ||
send_in_pings: | ||
- events | ||
|
||
mastodon_account_handle: | ||
type: string | ||
description: > | ||
The user's full account handle, with domain. | ||
For example, `account_name@mozilla.social`. | ||
bugs: | ||
- TBD | ||
data_reviews: | ||
- TBD | ||
notification_emails: | ||
- mozillasocial-data-eng@mozilla.com | ||
expires: never | ||
lifetime: application | ||
send_in_pings: | ||
- events | ||
|
||
adjust_device_id: | ||
type: string | ||
description: > | ||
The Adjust device ID for this user, if available. | ||
bugs: | ||
- TBD | ||
data_reviews: | ||
- TBD | ||
notification_emails: | ||
- mozillasocial-data-eng@mozilla.com | ||
expires: never | ||
lifetime: application | ||
send_in_pings: | ||
- events | ||
|
||
user_agent: | ||
type: string | ||
description: > | ||
The device user agent string. | ||
bugs: | ||
- TBD | ||
data_reviews: | ||
- TBD | ||
notification_emails: | ||
- mozillasocial-data-eng@mozilla.com | ||
expires: never | ||
lifetime: application | ||
send_in_pings: | ||
- events | ||
|
||
backend: | ||
object_update: | ||
type: event | ||
description: > | ||
Event triggered by the backend to record the change in state | ||
of an object (e.g. API requests to the mozilla.social Mastodon | ||
server). | ||
In the future, we could potentially use this event to track | ||
changes in state to core Mastodon objects (e.g. accounts and | ||
posts). | ||
bugs: | ||
- TBD | ||
data_reviews: | ||
- TBD | ||
notification_emails: | ||
- mozillasocial-data-eng@mozilla.com | ||
expires: never | ||
extra_keys: | ||
object_type: | ||
description: > | ||
A simple name to describe the object whose state changed. | ||
For example, `api_request`. | ||
type: string | ||
object_state: | ||
description: > | ||
A JSON representation of the latest state of the object. | ||
type: string |
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,49 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V1::Admin::StatusActionsController < Api::BaseController | ||
# modeled on api/v1/admin/account_actions_controller.rb | ||
|
||
include Authorization | ||
|
||
# only support a subset of StatusBatchAction types | ||
ALLOWED_TYPES = %w( | ||
delete | ||
sensitive | ||
).freeze | ||
|
||
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:statuses' } | ||
before_action :set_status | ||
|
||
after_action :verify_authorized | ||
|
||
def create | ||
authorize [:admin, @status], :update? | ||
raise ActiveRecord::RecordInvalid unless valid_type? | ||
|
||
status_batch_action = Admin::StatusBatchAction.new(resource_params) | ||
status_batch_action.status_ids = [@status.id] | ||
status_batch_action.current_account = current_account | ||
status_batch_action.save! | ||
|
||
render_empty | ||
end | ||
|
||
private | ||
|
||
def valid_type? | ||
params[:type] && ALLOWED_TYPES.include?(params[:type]) | ||
end | ||
|
||
def set_status | ||
@status = Status.find(params[:status_id]) | ||
end | ||
|
||
def resource_params | ||
params.permit( | ||
:type, | ||
:report_id, | ||
:text, | ||
:send_email_notification | ||
) | ||
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,58 @@ | ||
# frozen_string_literal: true | ||
|
||
class Api::V1::Admin::StatusesController < Api::BaseController | ||
# modeled on api/v1/admin/accounts_controller.rb | ||
|
||
include Authorization | ||
include AccountableConcern | ||
|
||
before_action -> { authorize_if_got_token! :'admin:read', :'admin:read:statuses' }, only: [:show] | ||
before_action -> { authorize_if_got_token! :'admin:write', :'admin:write:statuses' }, except: [:show] | ||
before_action :set_status | ||
|
||
after_action :verify_authorized | ||
|
||
def show | ||
authorize [:admin, @status], :show? | ||
render json: @status, serializer: REST::StatusSerializer | ||
end | ||
|
||
def destroy | ||
# modeled on handle_delete from status_batch_action.rb | ||
authorize [:admin, @status], :destroy? | ||
ApplicationRecord.transaction do | ||
@status.discard_with_reblogs | ||
log_action :destroy, @status | ||
Tombstone.find_or_create_by(uri: @status.uri, account: @status.account, by_moderator: true) | ||
|
||
if @status.with_media? | ||
# Immediately remove public copy of media instead of waiting for | ||
# the vacuum_orphaned_records job to take care of it later on | ||
Admin::MediaAttachmentDeletionWorker.perform_async(@status.media_attachments.map(&:id)) | ||
end | ||
end | ||
|
||
json = render_to_body json: @status, serializer: REST::StatusSerializer, source_requested: true | ||
|
||
RemovalWorker.perform_async(@status.id, { 'preserve' => @status.account.local?, 'immediate' => !@status.account.local? }) | ||
|
||
render json: json | ||
end | ||
|
||
def unsensitive | ||
# modeled on undo_mark_statuses_as_sensitive from approve_appeal_service.rb | ||
authorize [:admin, @status], :update? | ||
representative_account = Account.representative | ||
ApplicationRecord.transaction do | ||
UpdateStatusService.new.call(@status, representative_account.id, sensitive: false) if @status.with_media? | ||
log_action :unsensitive, @status | ||
end | ||
render json: @status, serializer: REST::StatusSerializer | ||
end | ||
|
||
private | ||
|
||
def set_status | ||
@status = Status.find(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,19 @@ | ||
# frozen_string_literal: true | ||
|
||
class TermsController < ApplicationController | ||
include WebAppControllerConcern | ||
|
||
skip_before_action :require_functional! | ||
|
||
before_action :set_instance_presenter | ||
|
||
def show | ||
expires_in 0, public: true if current_account.nil? | ||
end | ||
|
||
private | ||
|
||
def set_instance_presenter | ||
@instance_presenter = InstancePresenter.new | ||
end | ||
end |
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.