Merge commit '3a2a15c6ea4d4603469861ed9be09da12a122e45' into glitch-soc/merge-upstream
Conflicts: - `app/views/settings/preferences/appearance/show.html.haml`: Conflict because glitch-soc does not have a theme selector here.
This commit is contained in:
commit
42a0898f16
|
@ -90,7 +90,7 @@ class Api::V1::AccountsController < Api::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_params
|
def account_params
|
||||||
params.permit(:username, :email, :password, :agreement, :locale, :reason)
|
params.permit(:username, :email, :password, :agreement, :locale, :reason, :time_zone)
|
||||||
end
|
end
|
||||||
|
|
||||||
def check_enabled_registrations
|
def check_enabled_registrations
|
||||||
|
|
|
@ -19,6 +19,6 @@ class Settings::Preferences::BaseController < Settings::BaseController
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
params.require(:user).permit(:locale, chosen_languages: [], settings_attributes: UserSettings.keys)
|
params.require(:user).permit(:locale, :time_zone, chosen_languages: [], settings_attributes: UserSettings.keys)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -144,6 +144,7 @@ class Account < ApplicationRecord
|
||||||
:locale,
|
:locale,
|
||||||
:shows_application?,
|
:shows_application?,
|
||||||
:prefers_noindex?,
|
:prefers_noindex?,
|
||||||
|
:time_zone,
|
||||||
to: :user,
|
to: :user,
|
||||||
prefix: true,
|
prefix: true,
|
||||||
allow_nil: true
|
allow_nil: true
|
||||||
|
|
|
@ -40,6 +40,7 @@
|
||||||
# sign_up_ip :inet
|
# sign_up_ip :inet
|
||||||
# role_id :bigint(8)
|
# role_id :bigint(8)
|
||||||
# settings :text
|
# settings :text
|
||||||
|
# time_zone :string
|
||||||
#
|
#
|
||||||
|
|
||||||
class User < ApplicationRecord
|
class User < ApplicationRecord
|
||||||
|
@ -99,6 +100,7 @@ class User < ApplicationRecord
|
||||||
validates_with BlacklistedEmailValidator, if: -> { ENV['EMAIL_DOMAIN_LISTS_APPLY_AFTER_CONFIRMATION'] == 'true' || !confirmed? }
|
validates_with BlacklistedEmailValidator, if: -> { ENV['EMAIL_DOMAIN_LISTS_APPLY_AFTER_CONFIRMATION'] == 'true' || !confirmed? }
|
||||||
validates_with EmailMxValidator, if: :validate_email_dns?
|
validates_with EmailMxValidator, if: :validate_email_dns?
|
||||||
validates :agreement, acceptance: { allow_nil: false, accept: [true, 'true', '1'] }, on: :create
|
validates :agreement, acceptance: { allow_nil: false, accept: [true, 'true', '1'] }, on: :create
|
||||||
|
validates :time_zone, inclusion: { in: ActiveSupport::TimeZone.all.map { |tz| tz.tzinfo.name } }, allow_blank: true
|
||||||
|
|
||||||
# Honeypot/anti-spam fields
|
# Honeypot/anti-spam fields
|
||||||
attr_accessor :registration_form_time, :website, :confirm_password
|
attr_accessor :registration_form_time, :website, :confirm_password
|
||||||
|
|
|
@ -35,7 +35,7 @@ class AppSignUpService < BaseService
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_params
|
def user_params
|
||||||
@params.slice(:email, :password, :agreement, :locale)
|
@params.slice(:email, :password, :agreement, :locale, :time_zone)
|
||||||
end
|
end
|
||||||
|
|
||||||
def account_params
|
def account_params
|
||||||
|
|
|
@ -42,4 +42,4 @@
|
||||||
= link_to a.remote_url, a.remote_url
|
= link_to a.remote_url, a.remote_url
|
||||||
|
|
||||||
%p.status-footer
|
%p.status-footer
|
||||||
= link_to l(status.created_at), web_url("@#{status.account.pretty_acct}/#{status.id}")
|
= link_to l(status.created_at.in_time_zone(time_zone)), web_url("@#{status.account.pretty_acct}/#{status.id}")
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
%h1= t 'notification_mailer.favourite.title'
|
%h1= t 'notification_mailer.favourite.title'
|
||||||
%p.lead= t('notification_mailer.favourite.body', name: @account.pretty_acct)
|
%p.lead= t('notification_mailer.favourite.body', name: @account.pretty_acct)
|
||||||
|
|
||||||
= render 'status', status: @status
|
= render 'status', status: @status, time_zone: @me.user_time_zone
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
%h1= t 'notification_mailer.mention.title'
|
%h1= t 'notification_mailer.mention.title'
|
||||||
%p.lead= t('notification_mailer.mention.body', name: @status.account.pretty_acct)
|
%p.lead= t('notification_mailer.mention.body', name: @status.account.pretty_acct)
|
||||||
|
|
||||||
= render 'status', status: @status
|
= render 'status', status: @status, time_zone: @me.user_time_zone
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -22,7 +22,7 @@
|
||||||
%h1= t 'notification_mailer.reblog.title'
|
%h1= t 'notification_mailer.reblog.title'
|
||||||
%p.lead= t('notification_mailer.reblog.body', name: @account.pretty_acct)
|
%p.lead= t('notification_mailer.reblog.body', name: @account.pretty_acct)
|
||||||
|
|
||||||
= render 'status', status: @status
|
= render 'status', status: @status, time_zone: @me.user_time_zone
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -6,9 +6,12 @@
|
||||||
|
|
||||||
= simple_form_for current_user, url: settings_preferences_appearance_path, html: { method: :put, id: 'edit_user' } do |f|
|
= simple_form_for current_user, url: settings_preferences_appearance_path, html: { method: :put, id: 'edit_user' } do |f|
|
||||||
.fields-row
|
.fields-row
|
||||||
.fields-group
|
.fields-group.fields-row__column.fields-row__column-6
|
||||||
= f.input :locale, collection: I18n.available_locales, wrapper: :with_label, include_blank: false, label_method: lambda { |locale| native_locale_name(locale) }, selected: I18n.locale, hint: false
|
= f.input :locale, collection: I18n.available_locales, wrapper: :with_label, include_blank: false, label_method: lambda { |locale| native_locale_name(locale) }, selected: I18n.locale, hint: false
|
||||||
|
|
||||||
|
.fields-group.fields-row__column.fields-row__column-6
|
||||||
|
= f.input :time_zone, wrapper: :with_label, collection: ActiveSupport::TimeZone.all.map { |tz| ["(GMT#{tz.formatted_offset}) #{tz.name}", tz.tzinfo.name] }, hint: false
|
||||||
|
|
||||||
- unless I18n.locale == :en
|
- unless I18n.locale == :en
|
||||||
.flash-message.translation-prompt
|
.flash-message.translation-prompt
|
||||||
#{t 'appearance.localization.body'} #{content_tag(:a, t('appearance.localization.guide_link_text'), href: t('appearance.localization.guide_link'), target: '_blank', rel: 'noopener')}
|
#{t 'appearance.localization.body'} #{content_tag(:a, t('appearance.localization.guide_link_text'), href: t('appearance.localization.guide_link'), target: '_blank', rel: 'noopener')}
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
%td.column-cell.text-center
|
%td.column-cell.text-center
|
||||||
%p= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at), strike_date: l(@appeal.strike.created_at)
|
%p= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone))
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
===
|
===
|
||||||
|
|
||||||
<%= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at), strike_date: l(@appeal.strike.created_at) %>
|
<%= t 'user_mailer.appeal_approved.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone)) %>
|
||||||
|
|
||||||
=> <%= root_url %>
|
=> <%= root_url %>
|
||||||
|
|
|
@ -36,7 +36,7 @@
|
||||||
%tbody
|
%tbody
|
||||||
%tr
|
%tr
|
||||||
%td.column-cell.text-center
|
%td.column-cell.text-center
|
||||||
%p= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at), strike_date: l(@appeal.strike.created_at)
|
%p= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone))
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
===
|
===
|
||||||
|
|
||||||
<%= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at), strike_date: l(@appeal.strike.created_at) %>
|
<%= t 'user_mailer.appeal_rejected.explanation', appeal_date: l(@appeal.created_at.in_time_zone(@resource.time_zone)), strike_date: l(@appeal.strike.created_at.in_time_zone(@resource.time_zone)) %>
|
||||||
|
|
||||||
=> <%= root_url %>
|
=> <%= root_url %>
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
%strong= "#{t('sessions.browser')}:"
|
%strong= "#{t('sessions.browser')}:"
|
||||||
%span{ title: @user_agent }= t 'sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s), platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s)
|
%span{ title: @user_agent }= t 'sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: @detection.id.to_s), platform: t("sessions.platforms.#{@detection.platform.id}", default: @detection.platform.id.to_s)
|
||||||
%br/
|
%br/
|
||||||
= l(@timestamp)
|
= l(@timestamp.in_time_zone(@resource.time_zone))
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
<%= t('sessions.ip') %>: <%= @remote_ip %>
|
<%= t('sessions.ip') %>: <%= @remote_ip %>
|
||||||
<%= t('sessions.browser') %>: <%= t('sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: "#{@detection.id}"), platform: t("sessions.platforms.#{@detection.platform.id}", default: "#{@detection.platform.id}")) %>
|
<%= t('sessions.browser') %>: <%= t('sessions.description', browser: t("sessions.browsers.#{@detection.id}", default: "#{@detection.id}"), platform: t("sessions.platforms.#{@detection.platform.id}", default: "#{@detection.platform.id}")) %>
|
||||||
<%= l(@timestamp) %>
|
<%= l(@timestamp.in_time_zone(@resource.time_zone)) %>
|
||||||
|
|
||||||
<%= t 'user_mailer.suspicious_sign_in.further_actions_html', action: t('user_mailer.suspicious_sign_in.change_password') %>
|
<%= t 'user_mailer.suspicious_sign_in.further_actions_html', action: t('user_mailer.suspicious_sign_in.change_password') %>
|
||||||
|
|
||||||
|
|
|
@ -58,7 +58,7 @@
|
||||||
|
|
||||||
- unless @statuses.empty?
|
- unless @statuses.empty?
|
||||||
- @statuses.each_with_index do |status, i|
|
- @statuses.each_with_index do |status, i|
|
||||||
= render 'notification_mailer/status', status: status, i: i + 1, highlighted: true
|
= render 'notification_mailer/status', status: status, i: i + 1, highlighted: true, time_zone: @resource.time_zone
|
||||||
|
|
||||||
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
%table.email-table{ cellspacing: 0, cellpadding: 0 }
|
||||||
%tbody
|
%tbody
|
||||||
|
|
|
@ -297,6 +297,7 @@ en:
|
||||||
usable: Allow posts to use this hashtag
|
usable: Allow posts to use this hashtag
|
||||||
user:
|
user:
|
||||||
role: Role
|
role: Role
|
||||||
|
time_zone: Time zone
|
||||||
user_role:
|
user_role:
|
||||||
color: Badge color
|
color: Badge color
|
||||||
highlighted: Display role as badge on user profiles
|
highlighted: Display role as badge on user profiles
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class AddTimeZoneToUsers < ActiveRecord::Migration[6.1]
|
||||||
|
def change
|
||||||
|
add_column :users, :time_zone, :string
|
||||||
|
end
|
||||||
|
end
|
|
@ -10,7 +10,7 @@
|
||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 2023_06_05_085710) do
|
ActiveRecord::Schema.define(version: 2023_06_05_085711) do
|
||||||
|
|
||||||
# These are extensions that must be enabled in order to support this database
|
# These are extensions that must be enabled in order to support this database
|
||||||
enable_extension "plpgsql"
|
enable_extension "plpgsql"
|
||||||
|
@ -1091,6 +1091,7 @@ ActiveRecord::Schema.define(version: 2023_06_05_085710) do
|
||||||
t.boolean "skip_sign_in_token"
|
t.boolean "skip_sign_in_token"
|
||||||
t.bigint "role_id"
|
t.bigint "role_id"
|
||||||
t.text "settings"
|
t.text "settings"
|
||||||
|
t.string "time_zone"
|
||||||
t.index ["account_id"], name: "index_users_on_account_id"
|
t.index ["account_id"], name: "index_users_on_account_id"
|
||||||
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
t.index ["confirmation_token"], name: "index_users_on_confirmation_token", unique: true
|
||||||
t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id", where: "(created_by_application_id IS NOT NULL)"
|
t.index ["created_by_application_id"], name: "index_users_on_created_by_application_id", where: "(created_by_application_id IS NOT NULL)"
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_domain_block) do
|
Fabricator(:account_domain_block) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
domain 'example.com'
|
domain 'example.com'
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@
|
||||||
|
|
||||||
Fabricator(:account_moderation_note) do
|
Fabricator(:account_moderation_note) do
|
||||||
content 'MyText'
|
content 'MyText'
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_note) do
|
Fabricator(:account_note) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
comment 'User note text'
|
comment 'User note text'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_stat) do
|
Fabricator(:account_stat) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
statuses_count '123'
|
statuses_count '123'
|
||||||
following_count '456'
|
following_count '456'
|
||||||
followers_count '789'
|
followers_count '789'
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_statuses_cleanup_policy) do
|
Fabricator(:account_statuses_cleanup_policy) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:account_warning) do
|
Fabricator(:account_warning) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account(fabricator: :account)
|
target_account(fabricator: :account)
|
||||||
text { Faker::Lorem.paragraph }
|
text { Faker::Lorem.paragraph }
|
||||||
action 'suspend'
|
action 'suspend'
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator('Admin::ActionLog') do
|
Fabricator('Admin::ActionLog') do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
action 'MyString'
|
action 'MyString'
|
||||||
target nil
|
target nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:backup) do
|
Fabricator(:backup) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:block) do
|
Fabricator(:block) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:bookmark) do
|
Fabricator(:bookmark) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,5 +8,5 @@ Fabricator(:bulk_import) do
|
||||||
imported_items 1
|
imported_items 1
|
||||||
finished_at '2022-11-18 14:55:07'
|
finished_at '2022-11-18 14:55:07'
|
||||||
overwrite false
|
overwrite false
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:bulk_import_row) do
|
Fabricator(:bulk_import_row) do
|
||||||
bulk_import
|
bulk_import { Fabricate.build(:bulk_import) }
|
||||||
data ''
|
data ''
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:canonical_email_block) do
|
Fabricator(:canonical_email_block) do
|
||||||
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
email { sequence(:email) { |i| "#{i}#{Faker::Internet.email}" } }
|
||||||
reference_account { Fabricate(:account) }
|
reference_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:custom_filter) do
|
Fabricator(:custom_filter) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
expires_at nil
|
expires_at nil
|
||||||
phrase 'discourse'
|
phrase 'discourse'
|
||||||
context %w(home notifications)
|
context %w(home notifications)
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:custom_filter_keyword) do
|
Fabricator(:custom_filter_keyword) do
|
||||||
custom_filter
|
custom_filter { Fabricate.build(:custom_filter) }
|
||||||
keyword 'discourse'
|
keyword 'discourse'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:custom_filter_status) do
|
Fabricator(:custom_filter_status) do
|
||||||
custom_filter
|
custom_filter { Fabricate.build(:custom_filter) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:device) do
|
Fabricator(:device) do
|
||||||
access_token
|
access_token { Fabricate.build(:access_token) }
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
device_id { Faker::Number.number(digits: 5) }
|
device_id { Faker::Number.number(digits: 5) }
|
||||||
name { Faker::App.name }
|
name { Faker::App.name }
|
||||||
fingerprint_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
fingerprint_key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:encrypted_message) do
|
Fabricator(:encrypted_message) do
|
||||||
device
|
device { Fabricate.build(:device) }
|
||||||
from_account { Fabricate(:account) }
|
from_account { Fabricate.build(:account) }
|
||||||
from_device_id { Faker::Number.number(digits: 5) }
|
from_device_id { Faker::Number.number(digits: 5) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:favourite) do
|
Fabricator(:favourite) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:featured_tag) do
|
Fabricator(:featured_tag) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
tag
|
tag { Fabricate.build(:tag) }
|
||||||
name { sequence(:name) { |i| "Tag#{i}" } }
|
name { sequence(:name) { |i| "Tag#{i}" } }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:follow) do
|
Fabricator(:follow) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:follow_request) do
|
Fabricator(:follow_request) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account, locked: true) }
|
target_account { Fabricate.build(:account, locked: true) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:identity) do
|
Fabricator(:identity) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
provider 'MyString'
|
provider 'MyString'
|
||||||
uid 'MyString'
|
uid 'MyString'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:invite) do
|
Fabricator(:invite) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
expires_at nil
|
expires_at nil
|
||||||
max_uses nil
|
max_uses nil
|
||||||
uses 0
|
uses 0
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:list) do
|
Fabricator(:list) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
title 'MyString'
|
title 'MyString'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:login_activity) do
|
Fabricator(:login_activity) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
authentication_method 'password'
|
authentication_method 'password'
|
||||||
success true
|
success true
|
||||||
failure_reason nil
|
failure_reason nil
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:marker) do
|
Fabricator(:marker) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
timeline 'home'
|
timeline 'home'
|
||||||
last_read_id 0
|
last_read_id 0
|
||||||
lock_version 0
|
lock_version 0
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:media_attachment) do
|
Fabricator(:media_attachment) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
|
|
||||||
file do |attrs|
|
file do |attrs|
|
||||||
case attrs[:type]
|
case attrs[:type]
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:mention) do
|
Fabricator(:mention) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:mute) do
|
Fabricator(:mute) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:notification) do
|
Fabricator(:notification) do
|
||||||
activity fabricator: :status
|
activity fabricator: :status
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:one_time_key) do
|
Fabricator(:one_time_key) do
|
||||||
device
|
device { Fabricate.build(:device) }
|
||||||
key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
|
key_id { Faker::Alphanumeric.alphanumeric(number: 10) }
|
||||||
key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
key { Base64.strict_encode64(Ed25519::SigningKey.generate.verify_key.to_bytes) }
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:poll) do
|
Fabricator(:poll) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status
|
status { Fabricate.build(:status) }
|
||||||
expires_at { 7.days.from_now }
|
expires_at { 7.days.from_now }
|
||||||
options %w(Foo Bar)
|
options %w(Foo Bar)
|
||||||
multiple false
|
multiple false
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:poll_vote) do
|
Fabricator(:poll_vote) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
poll
|
poll
|
||||||
choice 0
|
choice 0
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:report) do
|
Fabricator(:report) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
target_account { Fabricate(:account) }
|
target_account { Fabricate.build(:account) }
|
||||||
comment 'You nasty'
|
comment 'You nasty'
|
||||||
action_taken_at nil
|
action_taken_at nil
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:report_note) do
|
Fabricator(:report_note) do
|
||||||
report
|
report { Fabricate.build(:report) }
|
||||||
account { Fabricate(:account) }
|
account { Fabricate.build(:account) }
|
||||||
content 'Test Content'
|
content 'Test Content'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:scheduled_status) do
|
Fabricator(:scheduled_status) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
scheduled_at { 20.hours.from_now }
|
scheduled_at { 20.hours.from_now }
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:session_activation) do
|
Fabricator(:session_activation) do
|
||||||
user
|
user { Fabricate.build(:user) }
|
||||||
session_id 'MyString'
|
session_id 'MyString'
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:status) do
|
Fabricator(:status) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
text 'Lorem ipsum dolor sit amet'
|
text 'Lorem ipsum dolor sit amet'
|
||||||
|
|
||||||
after_build do |status|
|
after_build do |status|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
Fabricator(:status_pin) do
|
Fabricator(:status_pin) do
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
status { |attrs| Fabricate(:status, account: attrs[:account], visibility: :public) }
|
status { |attrs| Fabricate.build(:status, account: attrs[:account], visibility: :public) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,5 +2,5 @@
|
||||||
|
|
||||||
Fabricator(:tag_follow) do
|
Fabricator(:tag_follow) do
|
||||||
tag
|
tag
|
||||||
account
|
account { Fabricate.build(:account) }
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe MediaAttachment do
|
RSpec.describe MediaAttachment, paperclip_processing: true do
|
||||||
describe 'local?' do
|
describe 'local?' do
|
||||||
subject { media_attachment.local? }
|
subject { media_attachment.local? }
|
||||||
|
|
||||||
|
|
|
@ -94,6 +94,12 @@ RSpec.configure do |config|
|
||||||
stub_jsonld_contexts!
|
stub_jsonld_contexts!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
config.before(:each) do |example|
|
||||||
|
unless example.metadata[:paperclip_processing]
|
||||||
|
allow_any_instance_of(Paperclip::Attachment).to receive(:post_process).and_return(true) # rubocop:disable RSpec/AnyInstance
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
config.after :each do
|
config.after :each do
|
||||||
Rails.cache.clear
|
Rails.cache.clear
|
||||||
redis.del(redis.keys)
|
redis.del(redis.keys)
|
||||||
|
|
|
@ -17,7 +17,7 @@ shared_examples 'AccountAvatar' do |fabricator|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe 'base64-encoded files' do
|
describe 'base64-encoded files', paperclip_processing: true do
|
||||||
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
|
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
|
||||||
let(:account) { Fabricate(fabricator, avatar: base64_attachment) }
|
let(:account) { Fabricate(fabricator, avatar: base64_attachment) }
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
shared_examples 'AccountHeader' do |fabricator|
|
shared_examples 'AccountHeader' do |fabricator|
|
||||||
describe 'base64-encoded files' do
|
describe 'base64-encoded files', paperclip_processing: true do
|
||||||
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
|
let(:base64_attachment) { "data:image/jpeg;base64,#{Base64.encode64(attachment_fixture('attachment.jpg').read)}" }
|
||||||
let(:account) { Fabricate(fabricator, header: base64_attachment) }
|
let(:account) { Fabricate(fabricator, header: base64_attachment) }
|
||||||
|
|
||||||
|
|
|
@ -1230,7 +1230,7 @@ const startServer = async () => {
|
||||||
|
|
||||||
ws.on('message', (data, isBinary) => {
|
ws.on('message', (data, isBinary) => {
|
||||||
if (isBinary) {
|
if (isBinary) {
|
||||||
log.debug('Received binary data, closing connection');
|
log.warn('socket', 'Received binary data, closing connection');
|
||||||
ws.close(1003, 'The mastodon streaming server does not support binary messages');
|
ws.close(1003, 'The mastodon streaming server does not support binary messages');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue