]> cat aescling's git repositories - mastodon.git/commitdiff
Merge branch 'main' into glitch-soc/merge-upstream
authorClaire <claire.github-309c@sitedethib.com>
Sat, 26 Feb 2022 08:29:23 +0000 (09:29 +0100)
committerClaire <claire.github-309c@sitedethib.com>
Sat, 26 Feb 2022 08:29:23 +0000 (09:29 +0100)
Conflicts:
- `app/models/account.rb`:
  Not a real conflict, just upstream getting rid of unused constants too close
  to glitch-soc-specific contents.
  Removed unused constants like upstream did.
- `app/models/trends.rb`:
  Conflict because glitch-soc disabled email notifications for trending links.
  Upstream has refactored this quite a bit and added trending posts.
  Took upstream code, but disabling the extra trending stuff will come in
  another commit.
- `app/views/admin/trends/links/index.html.haml`:
  Conflict due to glitch-soc's theming system.
  Ported upstream changes accordingly.

16 files changed:
1  2 
Gemfile
Gemfile.lock
app/javascript/mastodon/features/compose/components/compose_form.js
app/javascript/styles/mastodon/components.scss
app/models/account.rb
app/models/status.rb
app/models/user.rb
app/policies/status_policy.rb
app/services/reblog_service.rb
app/views/admin/follow_recommendations/show.html.haml
app/views/admin/trends/links/index.html.haml
app/views/admin/trends/links/preview_card_providers/index.html.haml
app/views/admin/trends/tags/index.html.haml
config/navigation.rb
config/routes.rb
db/schema.rb

diff --cc Gemfile
Simple merge
diff --cc Gemfile.lock
Simple merge
index 8f6663e7c104aff1bb230ad7da2e72f976ac99bc,dfdf9045ff9951b13ddc94a78a3855e504ffb180..8617b389cd482ecc18fcfaa6d6375021e8d6cffc
@@@ -74,15 -77,6 +77,10 @@@ class Account < ApplicationRecor
    include DomainMaterializable
    include AccountMerging
  
-   TRUST_LEVELS = {
-     untrusted: 0,
-     trusted: 1,
-   }.freeze
 +  MAX_DISPLAY_NAME_LENGTH = (ENV['MAX_DISPLAY_NAME_CHARS'] || 30).to_i
 +  MAX_NOTE_LENGTH = (ENV['MAX_BIO_CHARS'] || 500).to_i
 +  MAX_FIELDS = (ENV['MAX_PROFILE_FIELDS'] || 4).to_i
 +
    enum protocol: [:ostatus, :activitypub]
    enum suspension_origin: [:local, :remote], _prefix: true
  
index 607b70712871cea5a827e9a135b161b504aabfaf,adb92ef9164ffa80ebd8d1c830a2f53581476661..2fe4eedb5a2d0d54315b8d34498825f458297409
  #  account_id             :bigint(8)        not null
  #  application_id         :bigint(8)
  #  in_reply_to_account_id :bigint(8)
 +#  local_only             :boolean
 +#  full_status_text       :text             default(""), not null
  #  poll_id                :bigint(8)
 +#  content_type           :string
  #  deleted_at             :datetime
  #  edited_at              :datetime
+ #  trendable              :boolean
  #
  
  class Status < ApplicationRecord
Simple merge
Simple merge
index 6556fbff7271c6c274e9ffa5d1930deb03ca9ddf,7d2981709b22e023b2ffcf204aa5f08ca3f67b0a..97f9f8e924e222680025d766e6bdb765ddff5797
@@@ -30,10 -30,9 +30,9 @@@ class ReblogService < BaseServic
  
      reblog = account.statuses.create!(reblog: reblogged_status, text: '', visibility: visibility, rate_limit: options[:with_rate_limit])
  
-     Trends.tags.register(reblog)
-     Trends.links.register(reblog)
+     Trends.register!(reblog)
      DistributionWorker.perform_async(reblog.id)
 -    ActivityPub::DistributionWorker.perform_async(reblog.id)
 +    ActivityPub::DistributionWorker.perform_async(reblog.id) unless reblogged_status.local_only?
  
      create_notification(reblog)
      bump_potential_friendship(account, reblog)
index acd2b0466e731d0229e954341d13813659554c76,79f3513d3182bc7e8aa6627ea9d9dc986c421d10..e05f877b098d5a8750fd5bc76529130deb49e443
@@@ -1,18 -1,27 +1,24 @@@
  - content_for :page_title do
    = t('admin.trends.links.title')
  
- .filters
-   .filter-subset
-     %strong= t('admin.trends.trending')
-     %ul
-       %li= filter_link_to t('generic.all'), trending: nil
-       %li= filter_link_to t('admin.trends.only_allowed'), trending: 'allowed'
-   .back-link
-     = link_to admin_trends_links_preview_card_providers_path do
-       = t('admin.trends.preview_card_providers.title')
-       = fa_icon 'chevron-right fw'
 -- content_for :header_tags do
 -  = javascript_pack_tag 'admin', async: true, crossorigin: 'anonymous'
 -
+ = form_tag admin_trends_links_path, method: 'GET', class: 'simple_form' do
+   - Trends::PreviewCardFilter::KEYS.each do |key|
+     = hidden_field_tag key, params[key] if params[key].present?
  
- %hr.spacer/
+   .filters
+     .filter-subset.filter-subset--with-select
+       %strong= t('admin.follow_recommendations.language')
+       .input.select.optional
+         = select_tag :locale, options_for_select(Trends.available_locales.map { |key| [standard_locale_name(key), key] }, params[:locale]), include_blank: true
+     .filter-subset
+       %strong= t('admin.trends.trending')
+       %ul
+         %li= filter_link_to t('generic.all'), trending: nil
+         %li= filter_link_to t('admin.trends.only_allowed'), trending: 'allowed'
+     .back-link
+       = link_to admin_trends_links_preview_card_providers_path do
+         = t('admin.trends.preview_card_providers.title')
+         = fa_icon 'chevron-right fw'
  
  = form_for(@form, url: batch_admin_trends_links_path) do |f|
    = hidden_field_tag :page, params[:page] || 1
Simple merge
Simple merge
diff --cc db/schema.rb
index e27e04b71da248762cf4283f8734077df68c64e9,e54de5b3701eefca73e6376c86b83efd103d0b15..faab9b22b93aee22b4a102cbade93208175f56a4
@@@ -882,11 -886,10 +887,12 @@@ ActiveRecord::Schema.define(version: 20
      t.bigint "account_id", null: false
      t.bigint "application_id"
      t.bigint "in_reply_to_account_id"
 +    t.boolean "local_only"
      t.bigint "poll_id"
 +    t.string "content_type"
      t.datetime "deleted_at"
      t.datetime "edited_at"
+     t.boolean "trendable"
      t.index ["account_id", "id", "visibility", "updated_at"], name: "index_statuses_20190820", order: { id: :desc }, where: "(deleted_at IS NULL)"
      t.index ["deleted_at"], name: "index_statuses_on_deleted_at", where: "(deleted_at IS NOT NULL)"
      t.index ["id", "account_id"], name: "index_statuses_local_20190824", order: { id: :desc }, where: "((local OR (uri IS NULL)) AND (deleted_at IS NULL) AND (visibility = 0) AND (reblog_of_id IS NULL) AND ((NOT reply) OR (in_reply_to_account_id = account_id)))"