Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge upstream changes #2192

Merged
merged 31 commits into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d02aa27
typo: collapsable -> collapsible (#24521)
nschonni Apr 14, 2023
b0800d6
tootctl: add --approve option to tootctl accounts create (#24533)
danielmbrasil Apr 14, 2023
10f0de4
Refactor race condition reblog service spec (#24526)
mjankowski Apr 14, 2023
f05fb51
Fix status title for statuses without text (#24359)
Apr 14, 2023
955ec25
Add client-side validation for taken username in sign-up form (#24546)
Gargron Apr 16, 2023
e5c0b16
Add progress indicator to sign-up flow (#24545)
Gargron Apr 16, 2023
cf3fa1e
Rewrite GIFV component with React hooks (#24552)
takayamaki Apr 16, 2023
9f8d346
Rewrite AvatarOverlay component with React hooks (#24543)
takayamaki Apr 17, 2023
ca447d3
Update Jest testing to include Typescript (#24555)
nschonni Apr 17, 2023
bc4745f
Fix crash when trying to open the filter modal (#24556)
ClearlyClaire Apr 17, 2023
4601e0d
Add user handle to notification mail recipient address (#24240)
HeitorMC Apr 17, 2023
85b1b45
Fix crash in NotifyService when trying to send an email notification …
ClearlyClaire Apr 17, 2023
ab740f4
Rewrite AnimatedNumber component with React hooks (#24559)
takayamaki Apr 17, 2023
bc75e62
Change moderation search an account using the username with @ (#24242)
HeitorMC Apr 17, 2023
3afa1fd
Fix email confirmation skip option in `tootctl accounts modify USERNA…
danielmbrasil Apr 18, 2023
10ef3d9
Bump ox from 2.14.14 to 2.14.16 (#24577)
dependabot[bot] Apr 18, 2023
a5e9128
Bump http-link-header from 1.1.0 to 1.1.1 (#24575)
dependabot[bot] Apr 18, 2023
88ef71e
Bump pghero from 3.3.1 to 3.3.2 (#24572)
dependabot[bot] Apr 18, 2023
2c72396
Bump json-ld from 3.2.3 to 3.2.4 (#24571)
dependabot[bot] Apr 18, 2023
fe1ac6b
Bump postcss from 8.4.21 to 8.4.22 (#24570)
dependabot[bot] Apr 18, 2023
426e3cc
Bump reselect from 4.1.7 to 4.1.8 (#24565)
dependabot[bot] Apr 18, 2023
1153531
Bump faker from 3.1.1 to 3.2.0 (#24579)
dependabot[bot] Apr 18, 2023
4db8230
Add trend management to admin API (#24257)
rrgeorge Apr 18, 2023
abfdafe
Merge branch 'main' into glitch-soc/merge-upstream
ClearlyClaire Apr 22, 2023
f279727
[Glitch] typo: collapsable -> collapsible
nschonni Apr 14, 2023
a21a875
[Glitch] Fix status title for statuses without text
Apr 14, 2023
2f3dffb
[Glitch] Add progress indicator to sign-up flow
Gargron Apr 16, 2023
bc7b339
[Glitch] Fix crash when trying to open the filter modal
ClearlyClaire Apr 17, 2023
6ea9137
[Glitch] Add client-side validation for taken username in sign-up form
Gargron Apr 16, 2023
799e991
[Glitch] Rewrite GIFV component with React hooks
takayamaki Apr 16, 2023
9ef32ea
[Glitch] Rewrite AnimatedNumber component with React hooks
takayamaki Apr 17, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .github/workflows/test-js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- '.nvmrc'
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
- '**/*.snap'
- '.github/workflows/test-js.yml'

Expand All @@ -19,6 +21,8 @@ on:
- '.nvmrc'
- '**/*.js'
- '**/*.jsx'
- '**/*.ts'
- '**/*.tsx'
- '**/*.snap'
- '.github/workflows/test-js.yml'

Expand Down
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ end
group :test do
gem 'capybara', '~> 3.39'
gem 'climate_control'
gem 'faker', '~> 3.1'
gem 'faker', '~> 3.2'
gem 'json-schema', '~> 3.0'
gem 'rack-test', '~> 2.1'
gem 'rails-controller-testing', '~> 1.0'
Expand Down
18 changes: 9 additions & 9 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ GEM
tzinfo
excon (0.95.0)
fabrication (2.30.0)
faker (3.1.1)
faker (3.2.0)
i18n (>= 1.8.11, < 2)
faraday (1.10.3)
faraday-em_http (~> 1.0)
Expand Down Expand Up @@ -348,19 +348,19 @@ GEM
ipaddress (0.8.3)
jmespath (1.6.2)
json (2.6.3)
json-canonicalization (0.3.0)
json-canonicalization (0.3.1)
json-jwt (1.15.3)
activesupport (>= 4.2)
aes_key_wrap
bindata
httpclient
json-ld (3.2.3)
json-ld (3.2.4)
htmlentities (~> 4.3)
json-canonicalization (~> 0.3)
link_header (~> 0.0, >= 0.0.8)
multi_json (~> 1.15)
rack (~> 2.2)
rdf (~> 3.2, >= 3.2.9)
rack (>= 2.2, < 4)
rdf (~> 3.2, >= 3.2.10)
json-ld-preloaded (3.2.2)
json-ld (~> 3.2)
rdf (~> 3.2)
Expand Down Expand Up @@ -479,15 +479,15 @@ GEM
openssl-signature_algorithm (1.3.0)
openssl (> 2.0)
orm_adapter (0.5.0)
ox (2.14.14)
ox (2.14.16)
parallel (1.22.1)
parser (3.2.2.0)
ast (~> 2.4.1)
parslet (2.0.0)
pastel (0.8.0)
tty-color (~> 0.5)
pg (1.4.6)
pghero (3.3.1)
pghero (3.3.2)
activerecord (>= 6)
pkg-config (1.5.1)
posix-spawn (0.3.15)
Expand Down Expand Up @@ -557,7 +557,7 @@ GEM
thor (~> 1.0)
rainbow (3.1.1)
rake (13.0.6)
rdf (3.2.9)
rdf (3.2.10)
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.5.1)
rdf (~> 3.2)
Expand Down Expand Up @@ -799,7 +799,7 @@ DEPENDENCIES
dotenv-rails (~> 2.8)
ed25519 (~> 1.3)
fabrication (~> 2.30)
faker (~> 3.1)
faker (~> 3.2)
fast_blank (~> 1.0)
fastimage
fog-core (<= 2.4.0)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# frozen_string_literal: true

class Api::V1::Admin::Trends::Links::PreviewCardProvidersController < Api::BaseController
include Authorization

LIMIT = 100

before_action -> { authorize_if_got_token! :'admin:read' }, only: :index
before_action -> { authorize_if_got_token! :'admin:write' }, except: :index
before_action :set_providers, only: :index

after_action :verify_authorized
after_action :insert_pagination_headers, only: :index

PAGINATION_PARAMS = %i(limit).freeze

def index
authorize :preview_card_provider, :index?

render json: @providers, each_serializer: REST::Admin::Trends::Links::PreviewCardProviderSerializer
end

def approve
authorize :preview_card_provider, :review?

provider = PreviewCardProvider.find(params[:id])
provider.update(trendable: true, reviewed_at: Time.now.utc)
render json: provider, serializer: REST::Admin::Trends::Links::PreviewCardProviderSerializer
end

def reject
authorize :preview_card_provider, :review?

provider = PreviewCardProvider.find(params[:id])
provider.update(trendable: false, reviewed_at: Time.now.utc)
render json: provider, serializer: REST::Admin::Trends::Links::PreviewCardProviderSerializer
end

private

def set_providers
@providers = PreviewCardProvider.all.to_a_paginated_by_id(limit_param(LIMIT), params_slice(:max_id, :since_id, :min_id))
end

def insert_pagination_headers
set_pagination_headers(next_path, prev_path)
end

def next_path
api_v1_admin_trends_links_preview_card_providers_url(pagination_params(max_id: pagination_max_id)) if records_continue?
end

def prev_path
api_v1_admin_trends_links_preview_card_providers_url(pagination_params(min_id: pagination_since_id)) unless @providers.empty?
end

def pagination_max_id
@providers.last.id
end

def pagination_since_id
@providers.first.id
end

def records_continue?
@providers.size == limit_param(LIMIT)
end

def pagination_params(core_params)
params.slice(*PAGINATION_PARAMS).permit(*PAGINATION_PARAMS).merge(core_params)
end
end
31 changes: 30 additions & 1 deletion app/controllers/api/v1/admin/trends/links_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
# frozen_string_literal: true

class Api::V1::Admin::Trends::LinksController < Api::V1::Trends::LinksController
before_action -> { authorize_if_got_token! :'admin:read' }
include Authorization

before_action -> { authorize_if_got_token! :'admin:read' }, only: :index
before_action -> { authorize_if_got_token! :'admin:write' }, except: :index

after_action :verify_authorized, except: :index

def index
if current_user&.can?(:manage_taxonomies)
render json: @links, each_serializer: REST::Admin::Trends::LinkSerializer
else
super
end
end

def approve
authorize :preview_card, :review?

link = PreviewCard.find(params[:id])
link.update(trendable: true)
render json: link, serializer: REST::Admin::Trends::LinkSerializer
end

def reject
authorize :preview_card, :review?

link = PreviewCard.find(params[:id])
link.update(trendable: false)
render json: link, serializer: REST::Admin::Trends::LinkSerializer
end

private

Expand Down
31 changes: 30 additions & 1 deletion app/controllers/api/v1/admin/trends/statuses_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,36 @@
# frozen_string_literal: true

class Api::V1::Admin::Trends::StatusesController < Api::V1::Trends::StatusesController
before_action -> { authorize_if_got_token! :'admin:read' }
include Authorization

before_action -> { authorize_if_got_token! :'admin:read' }, only: :index
before_action -> { authorize_if_got_token! :'admin:write' }, except: :index

after_action :verify_authorized, except: :index

def index
if current_user&.can?(:manage_taxonomies)
render json: @statuses, each_serializer: REST::Admin::Trends::StatusSerializer
else
super
end
end

def approve
authorize [:admin, :status], :review?

status = Status.find(params[:id])
status.update(trendable: true)
render json: status, serializer: REST::Admin::Trends::StatusSerializer
end

def reject
authorize [:admin, :status], :review?

status = Status.find(params[:id])
status.update(trendable: false)
render json: status, serializer: REST::Admin::Trends::StatusSerializer
end

private

Expand Down
23 changes: 22 additions & 1 deletion app/controllers/api/v1/admin/trends/tags_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# frozen_string_literal: true

class Api::V1::Admin::Trends::TagsController < Api::V1::Trends::TagsController
before_action -> { authorize_if_got_token! :'admin:read' }
include Authorization

before_action -> { authorize_if_got_token! :'admin:read' }, only: :index
before_action -> { authorize_if_got_token! :'admin:write' }, except: :index

after_action :verify_authorized, except: :index

def index
if current_user&.can?(:manage_taxonomies)
Expand All @@ -11,6 +16,22 @@ def index
end
end

def approve
authorize :tag, :review?

tag = Tag.find(params[:id])
tag.update(trendable: true, reviewed_at: Time.now.utc)
render json: tag, serializer: REST::Admin::TagSerializer
end

def reject
authorize :tag, :review?

tag = Tag.find(params[:id])
tag.update(trendable: false, reviewed_at: Time.now.utc)
render json: tag, serializer: REST::Admin::TagSerializer
end

private

def enabled?
Expand Down
19 changes: 3 additions & 16 deletions app/controllers/auth/setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,30 +11,21 @@ class Auth::SetupController < ApplicationController

skip_before_action :require_functional!

def show
flash.now[:notice] = begin
if @user.pending?
I18n.t('devise.registrations.signed_up_but_pending')
else
I18n.t('devise.registrations.signed_up_but_unconfirmed')
end
end
end
def show; end

def update
# This allows updating the e-mail without entering a password as is required
# on the account settings page; however, we only allow this for accounts
# that were not confirmed yet

if @user.update(user_params)
redirect_to auth_setup_path, notice: I18n.t('devise.confirmations.send_instructions')
@user.resend_confirmation_instructions unless @user.confirmed?
redirect_to auth_setup_path, notice: I18n.t('auth.setup.new_confirmation_instructions_sent')
else
render :show
end
end

helper_method :missing_email?

private

def require_unconfirmed_or_pending!
Expand All @@ -53,10 +44,6 @@ def user_params
params.require(:user).permit(:email)
end

def missing_email?
truthy_param?(:missing_email)
end

def set_pack
use_pack 'auth'
end
Expand Down
4 changes: 4 additions & 0 deletions app/helpers/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ def fa_icon(icon, attributes = {})
content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
end

def check_icon
content_tag(:svg, tag(:path, 'fill-rule': 'evenodd', 'clip-rule': 'evenodd', d: 'M16.704 4.153a.75.75 0 01.143 1.052l-8 10.5a.75.75 0 01-1.127.075l-4.5-4.5a.75.75 0 011.06-1.06l3.894 3.893 7.48-9.817a.75.75 0 011.05-.143z'), xmlns: 'http://www.w3.org/2000/svg', viewBox: '0 0 20 20', fill: 'currentColor')
end

def visibility_icon(status)
if status.public_visibility?
fa_icon('globe', title: I18n.t('statuses.visibilities.public'))
Expand Down
Loading