Skip to content

Commit

Permalink
Merge pull request #2544 from ClearlyClaire/glitch-soc/merge-upstream
Browse files Browse the repository at this point in the history
Merge upstream changes up to a2624ff
  • Loading branch information
ClearlyClaire authored Dec 29, 2023
2 parents 19e1465 + c5b0e6d commit 6fe978f
Show file tree
Hide file tree
Showing 200 changed files with 3,688 additions and 1,130 deletions.
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
20.9
20.10
42 changes: 0 additions & 42 deletions .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,48 +45,6 @@ Metrics/PerceivedComplexity:
RSpec/ExampleLength:
Max: 22

RSpec/LetSetup:
Exclude:
- 'spec/controllers/api/v1/accounts/statuses_controller_spec.rb'
- 'spec/controllers/api/v1/filters_controller_spec.rb'
- 'spec/controllers/api/v2/admin/accounts_controller_spec.rb'
- 'spec/controllers/api/v2/filters/keywords_controller_spec.rb'
- 'spec/controllers/api/v2/filters/statuses_controller_spec.rb'
- 'spec/controllers/auth/confirmations_controller_spec.rb'
- 'spec/controllers/auth/passwords_controller_spec.rb'
- 'spec/controllers/auth/sessions_controller_spec.rb'
- 'spec/controllers/follower_accounts_controller_spec.rb'
- 'spec/controllers/following_accounts_controller_spec.rb'
- 'spec/controllers/oauth/authorized_applications_controller_spec.rb'
- 'spec/controllers/oauth/tokens_controller_spec.rb'
- 'spec/controllers/settings/imports_controller_spec.rb'
- 'spec/lib/activitypub/activity/delete_spec.rb'
- 'spec/lib/vacuum/applications_vacuum_spec.rb'
- 'spec/lib/vacuum/preview_cards_vacuum_spec.rb'
- 'spec/models/account_spec.rb'
- 'spec/models/account_statuses_cleanup_policy_spec.rb'
- 'spec/models/canonical_email_block_spec.rb'
- 'spec/models/status_spec.rb'
- 'spec/models/user_spec.rb'
- 'spec/services/account_statuses_cleanup_service_spec.rb'
- 'spec/services/activitypub/fetch_featured_collection_service_spec.rb'
- 'spec/services/activitypub/fetch_remote_status_service_spec.rb'
- 'spec/services/activitypub/process_account_service_spec.rb'
- 'spec/services/activitypub/process_collection_service_spec.rb'
- 'spec/services/batched_remove_status_service_spec.rb'
- 'spec/services/block_domain_service_spec.rb'
- 'spec/services/bulk_import_service_spec.rb'
- 'spec/services/delete_account_service_spec.rb'
- 'spec/services/import_service_spec.rb'
- 'spec/services/notify_service_spec.rb'
- 'spec/services/remove_status_service_spec.rb'
- 'spec/services/report_service_spec.rb'
- 'spec/services/resolve_account_service_spec.rb'
- 'spec/services/suspend_account_service_spec.rb'
- 'spec/services/unallow_domain_service_spec.rb'
- 'spec/services/unsuspend_account_service_spec.rb'
- 'spec/workers/scheduler/user_cleanup_scheduler_spec.rb'

RSpec/MultipleExpectations:
Max: 8

Expand Down
28 changes: 14 additions & 14 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -131,20 +131,20 @@ GEM
attr_required (1.0.1)
awrence (1.2.1)
aws-eventstream (1.3.0)
aws-partitions (1.857.0)
aws-sdk-core (3.188.0)
aws-eventstream (~> 1, >= 1.0.2)
aws-partitions (1.860.0)
aws-sdk-core (3.189.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.651.0)
aws-sigv4 (~> 1.5)
aws-sigv4 (~> 1.8)
jmespath (~> 1, >= 1.6.1)
aws-sdk-kms (1.73.0)
aws-sdk-kms (1.74.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sigv4 (~> 1.1)
aws-sdk-s3 (1.140.0)
aws-sdk-core (~> 3, >= 3.188.0)
aws-sdk-s3 (1.141.0)
aws-sdk-core (~> 3, >= 3.189.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.6)
aws-sigv4 (1.7.0)
aws-sigv4 (~> 1.8)
aws-sigv4 (1.8.0)
aws-eventstream (~> 1, >= 1.0.2)
azure-storage-blob (2.0.3)
azure-storage-common (~> 2.0)
Expand Down Expand Up @@ -220,7 +220,7 @@ GEM
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.3.4)
debug (1.9.0)
debug (1.9.1)
irb (~> 1.10)
reline (>= 0.3.8)
debug_inspector (1.1.0)
Expand Down Expand Up @@ -376,8 +376,8 @@ GEM
rainbow (>= 2.2.2, < 4.0)
terminal-table (>= 1.5.1)
idn-ruby (0.1.5)
io-console (0.6.0)
irb (1.10.1)
io-console (0.7.1)
irb (1.11.0)
rdoc
reline (>= 0.3.8)
jmespath (1.6.2)
Expand Down Expand Up @@ -540,7 +540,7 @@ GEM
activesupport (>= 7.0.0)
rack
railties (>= 7.0.0)
psych (5.1.1.1)
psych (5.1.2)
stringio
public_suffix (5.0.4)
puma (6.4.0)
Expand Down Expand Up @@ -614,7 +614,7 @@ GEM
link_header (~> 0.0, >= 0.0.8)
rdf-normalize (0.6.1)
rdf (~> 3.2)
rdoc (6.6.1)
rdoc (6.6.2)
psych (>= 4.0.0)
redcarpet (3.6.0)
redis (4.8.1)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/admin/follow_recommendations_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def show
authorize :follow_recommendation, :show?

@form = Form::AccountBatch.new
@accounts = filtered_follow_recommendations
@accounts = filtered_follow_recommendations.page(params[:page])
end

def update
Expand Down
13 changes: 7 additions & 6 deletions app/controllers/api/v1/suggestions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,23 @@
class Api::V1::SuggestionsController < Api::BaseController
include Authorization

before_action -> { doorkeeper_authorize! :read }
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_suggestions

def index
suggestions = suggestions_source.get(current_account, limit: limit_param(DEFAULT_ACCOUNTS_LIMIT))
render json: suggestions.map(&:account), each_serializer: REST::AccountSerializer
render json: @suggestions.get(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:offset].to_i).map(&:account), each_serializer: REST::AccountSerializer
end

def destroy
suggestions_source.remove(current_account, params[:id])
@suggestions.remove(params[:id])
render_empty
end

private

def suggestions_source
AccountSuggestions::PastInteractionsSource.new
def set_suggestions
@suggestions = AccountSuggestions.new(current_account)
end
end
12 changes: 9 additions & 3 deletions app/controllers/api/v2/suggestions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,23 @@
class Api::V2::SuggestionsController < Api::BaseController
include Authorization

before_action -> { doorkeeper_authorize! :read }
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_suggestions

def index
render json: @suggestions, each_serializer: REST::SuggestionSerializer
render json: @suggestions.get(limit_param(DEFAULT_ACCOUNTS_LIMIT), params[:offset].to_i), each_serializer: REST::SuggestionSerializer
end

def destroy
@suggestions.remove(params[:id])
render_empty
end

private

def set_suggestions
@suggestions = AccountSuggestions.get(current_account, limit_param(DEFAULT_ACCOUNTS_LIMIT))
@suggestions = AccountSuggestions.new(current_account)
end
end
22 changes: 18 additions & 4 deletions app/javascript/mastodon/features/account/components/header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ import FollowRequestNoteContainer from '../containers/follow_request_note_contai
const messages = defineMessages({
unfollow: { id: 'account.unfollow', defaultMessage: 'Unfollow' },
follow: { id: 'account.follow', defaultMessage: 'Follow' },
followBack: { id: 'account.follow_back', defaultMessage: 'Follow back' },
mutual: { id: 'account.mutual', defaultMessage: 'Mutual' },
cancel_follow_request: { id: 'account.cancel_follow_request', defaultMessage: 'Withdraw follow request' },
requested: { id: 'account.requested', defaultMessage: 'Awaiting approval. Click to cancel follow request' },
unblock: { id: 'account.unblock', defaultMessage: 'Unblock @{name}' },
Expand Down Expand Up @@ -82,6 +84,20 @@ const titleFromAccount = account => {
return `${prefix} (@${acct})`;
};

const messageForFollowButton = relationship => {
if(!relationship) return messages.follow;

if (relationship.get('following') && relationship.get('followed_by')) {
return messages.mutual;
} else if (!relationship.get('following') && relationship.get('followed_by')) {
return messages.followBack;
} else if (relationship.get('following')) {
return messages.unfollow;
} else {
return messages.follow;
}
};

const dateFormatOptions = {
month: 'short',
day: 'numeric',
Expand Down Expand Up @@ -253,9 +269,7 @@ class Header extends ImmutablePureComponent {
let info = [];
let menu = [];

if (me !== account.get('id') && account.getIn(['relationship', 'followed_by'])) {
info.push(<span key='followed_by' className='relationship-tag'><FormattedMessage id='account.follows_you' defaultMessage='Follows you' /></span>);
} else if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
if (me !== account.get('id') && account.getIn(['relationship', 'blocking'])) {
info.push(<span key='blocked' className='relationship-tag'><FormattedMessage id='account.blocked' defaultMessage='Blocked' /></span>);
}

Expand All @@ -281,7 +295,7 @@ class Header extends ImmutablePureComponent {
} else if (account.getIn(['relationship', 'requested'])) {
actionBtn = <Button text={intl.formatMessage(messages.cancel_follow_request)} title={intl.formatMessage(messages.requested)} onClick={this.props.onFollow} />;
} else if (!account.getIn(['relationship', 'blocking'])) {
actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames({ 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(account.getIn(['relationship', 'following']) ? messages.unfollow : messages.follow)} onClick={signedIn ? this.props.onFollow : this.props.onInteractionModal} />;
actionBtn = <Button disabled={account.getIn(['relationship', 'blocked_by'])} className={classNames({ 'button--destructive': account.getIn(['relationship', 'following']) })} text={intl.formatMessage(messageForFollowButton(account.get('relationship')))} onClick={signedIn ? this.props.onFollow : this.props.onInteractionModal} />;
} else if (account.getIn(['relationship', 'blocking'])) {
actionBtn = <Button text={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.props.onBlock} />;
}
Expand Down
6 changes: 4 additions & 2 deletions app/javascript/mastodon/features/onboarding/profile.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ const messages = defineMessages({
uploadAvatar: { id: 'onboarding.profile.upload_avatar', defaultMessage: 'Upload profile picture' },
});

const nullIfMissing = path => path.endsWith('missing.png') ? null : path;

export const Profile = () => {
const account = useAppSelector(state => state.getIn(['accounts', me]));
const [displayName, setDisplayName] = useState(account.get('display_name'));
Expand Down Expand Up @@ -61,8 +63,8 @@ export const Profile = () => {
setHeader(e.target?.files?.[0]);
}, [setHeader]);

const avatarPreview = useMemo(() => avatar ? URL.createObjectURL(avatar) : account.get('avatar'), [avatar, account]);
const headerPreview = useMemo(() => header ? URL.createObjectURL(header) : account.get('header'), [header, account]);
const avatarPreview = useMemo(() => avatar ? URL.createObjectURL(avatar) : nullIfMissing(account.get('avatar')), [avatar, account]);
const headerPreview = useMemo(() => header ? URL.createObjectURL(header) : nullIfMissing(account.get('header')), [header, account]);

const handleSubmit = useCallback(() => {
setIsSaving(true);
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/af.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
"account.followers.empty": "Hierdie gebruiker het nog nie volgers nie.",
"account.following": "Volg",
"account.follows.empty": "Die gebruiker volg nog niemand.",
"account.follows_you": "Volg jou",
"account.go_to_profile": "Gaan na profiel",
"account.hide_reblogs": "Versteek plasings wat deur @{name} aangestuur is",
"account.joined_short": "Aangesluit",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/an.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
"account.following": "Seguindo",
"account.following_counter": "{count, plural, one {{counter} Following} other {{counter} Seguindo}}",
"account.follows.empty": "Este usuario encara no sigue a dengún.",
"account.follows_you": "Te sigue",
"account.go_to_profile": "Ir ta lo perfil",
"account.hide_reblogs": "Amagar retutz de @{name}",
"account.joined_short": "S'unió",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/ar.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"account.following": "الاشتراكات",
"account.following_counter": "{count, plural, zero{لا يُتابِع أحدًا} one {يُتابِعُ واحد} two{يُتابِعُ اِثنان} few{يُتابِعُ {counter}} many{يُتابِعُ {counter}} other {يُتابِعُ {counter}}}",
"account.follows.empty": "لا يُتابع هذا المُستخدمُ أيَّ أحدٍ حتى الآن.",
"account.follows_you": "يُتابِعُك",
"account.go_to_profile": "اذهب إلى الملف الشخصي",
"account.hide_reblogs": "إخفاء المعاد نشرها مِن @{name}",
"account.in_memoriam": "في الذكرى.",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/ast.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"account.following": "Siguiendo",
"account.following_counter": "{count, plural,one {Sigue a {counter}} other {Sigue a {counter}}}",
"account.follows.empty": "Esti perfil nun sigue a naide.",
"account.follows_you": "Síguete",
"account.go_to_profile": "Dir al perfil",
"account.hide_reblogs": "Anubrir los artículos compartíos de @{name}",
"account.in_memoriam": "N'alcordanza.",
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/mastodon/locales/be.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"account.featured_tags.last_status_never": "Няма допісаў",
"account.featured_tags.title": "Тэгі, выбраныя {name}",
"account.follow": "Падпісацца",
"account.follow_back": "Падпісацца ў адказ",
"account.followers": "Падпісчыкі",
"account.followers.empty": "Ніхто пакуль не падпісаны на гэтага карыстальніка.",
"account.followers_counter": "{count, plural, one {{counter} падпісчык} few {{counter} падпісчыкі} many {{counter} падпісчыкаў} other {{counter} падпісчыка}}",
"account.following": "Падпіскі",
"account.following_counter": "{count, plural, one {{counter} падпіска} few {{counter} падпіскі} many {{counter} падпісак} other {{counter} падпіскі}}",
"account.follows.empty": "Карыстальнік ні на каго не падпісаны.",
"account.follows_you": "Падпісаны на вас",
"account.go_to_profile": "Перайсці да профілю",
"account.hide_reblogs": "Схаваць пашырэнні ад @{name}",
"account.in_memoriam": "У памяць.",
Expand All @@ -53,6 +53,7 @@
"account.mute_notifications_short": "Не апавяшчаць",
"account.mute_short": "Ігнараваць",
"account.muted": "Ігнаруецца",
"account.mutual": "Узаемныя",
"account.no_bio": "Апісанне адсутнічае.",
"account.open_original_page": "Адкрыць арыгінальную старонку",
"account.posts": "Допісы",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/bg.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"account.following": "Последвано",
"account.following_counter": "{count, plural, one {{counter} последван} other {{counter} последвани}}",
"account.follows.empty": "Потребителят още никого не следва.",
"account.follows_you": "Следва ви",
"account.go_to_profile": "Към профила",
"account.hide_reblogs": "Скриване на подсилвания от @{name}",
"account.in_memoriam": "В памет на.",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/bn.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"account.following": "অনুসরণ করা হচ্ছে",
"account.following_counter": "{count, plural,one {{counter} জনকে অনুসরণ} other {{counter} জনকে অনুসরণ}}",
"account.follows.empty": "এই সদস্য কাউকে এখনো ফলো করেন না.",
"account.follows_you": "আপনাকে ফলো করে",
"account.go_to_profile": "প্রোফাইলে যান",
"account.hide_reblogs": "@{name}'র সমর্থনগুলি লুকিয়ে ফেলুন",
"account.in_memoriam": "স্মৃতিতে.",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/br.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"account.following": "Koumanantoù",
"account.following_counter": "{count, plural, one{{counter} C'houmanant} two{{counter} Goumanant} other {{counter} a Goumanant}}",
"account.follows.empty": "An implijer·ez-mañ na heul den ebet.",
"account.follows_you": "Ho heuilh",
"account.go_to_profile": "Gwelet ar profil",
"account.hide_reblogs": "Kuzh skignadennoù gant @{name}",
"account.joined_short": "Amañ abaoe",
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/mastodon/locales/ca.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@
"account.featured_tags.last_status_never": "No hi ha tuts",
"account.featured_tags.title": "etiquetes destacades de {name}",
"account.follow": "Segueix",
"account.follow_back": "Segueix",
"account.followers": "Seguidors",
"account.followers.empty": "A aquest usuari encara no el segueix ningú.",
"account.followers_counter": "{count, plural, one {{counter} seguidor} other {{counter} Seguidors}}",
"account.following": "Seguint",
"account.following_counter": "{count, plural, other {{counter} Seguint-ne}}",
"account.follows.empty": "Aquest usuari encara no segueix ningú.",
"account.follows_you": "Et segueix",
"account.go_to_profile": "Vés al perfil",
"account.hide_reblogs": "Amaga els impulsos de @{name}",
"account.in_memoriam": "En Memòria.",
Expand All @@ -53,6 +53,7 @@
"account.mute_notifications_short": "Silencia les notificacions",
"account.mute_short": "Silencia",
"account.muted": "Silenciat",
"account.mutual": "Mutu",
"account.no_bio": "No s'ha proporcionat cap descripció.",
"account.open_original_page": "Obre la pàgina original",
"account.posts": "Tuts",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/ckb.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
"account.following": "بەدوادا",
"account.following_counter": "{count, plural, one {{counter} شوێنکەوتوو} other {{counter} شوێنکەوتوو}}",
"account.follows.empty": "ئەم بەکارهێنەرە تا ئێستا شوێن کەس نەکەوتووە.",
"account.follows_you": "شوێنت دەکەوێت",
"account.go_to_profile": "بڕۆ بۆ پڕۆفایلی",
"account.hide_reblogs": "داشاردنی بووستەکان لە @{name}",
"account.joined_short": "بەشداری کردووە",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/co.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"account.followers_counter": "{count, plural, one {{counter} Abbunatu} other {{counter} Abbunati}}",
"account.following_counter": "{count, plural, one {{counter} Abbunamentu} other {{counter} Abbunamenti}}",
"account.follows.empty": "St'utilizatore ùn seguita nisunu.",
"account.follows_you": "Vi seguita",
"account.hide_reblogs": "Piattà spartere da @{name}",
"account.link_verified_on": "A prupietà di stu ligame hè stata verificata u {date}",
"account.locked_info": "U statutu di vita privata di u contu hè chjosu. U pruprietariu esamina manualmente e dumande d'abbunamentu.",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"account.following": "Sledujete",
"account.following_counter": "{count, plural, one {{counter} Sledovaný} few {{counter} Sledovaní} many {{counter} Sledovaných} other {{counter} Sledovaných}}",
"account.follows.empty": "Tento uživatel zatím nikoho nesleduje.",
"account.follows_you": "Sleduje vás",
"account.go_to_profile": "Přejít na profil",
"account.hide_reblogs": "Skrýt boosty od @{name}",
"account.in_memoriam": "In Memoriam.",
Expand Down
1 change: 0 additions & 1 deletion app/javascript/mastodon/locales/cy.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@
"account.following": "Yn dilyn",
"account.following_counter": "{count, plural, one {Yn dilyn: {counter}} other {Yn dilyn: {counter}}}",
"account.follows.empty": "Nid yw'r defnyddiwr hwn yn dilyn unrhyw un eto.",
"account.follows_you": "Yn eich dilyn chi",
"account.go_to_profile": "Mynd i'r proffil",
"account.hide_reblogs": "Cuddio hybiau gan @{name}",
"account.in_memoriam": "Er Cof.",
Expand Down
Loading

0 comments on commit 6fe978f

Please sign in to comment.