forked from berserker/microblog
Add support for language preferences for trending statuses and links (#18288)
parent
678fc4d292
commit
45ebdb72ca
29 changed files with 274 additions and 121 deletions
@ -0,0 +1,17 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# == Schema Information |
||||
# |
||||
# Table name: preview_card_trends |
||||
# |
||||
# id :bigint(8) not null, primary key |
||||
# preview_card_id :bigint(8) not null |
||||
# score :float default(0.0), not null |
||||
# rank :integer default(0), not null |
||||
# allowed :boolean default(FALSE), not null |
||||
# language :string |
||||
# |
||||
class PreviewCardTrend < ApplicationRecord |
||||
belongs_to :preview_card |
||||
scope :allowed, -> { where(allowed: true) } |
||||
end |
@ -0,0 +1,21 @@ |
||||
# frozen_string_literal: true |
||||
|
||||
# == Schema Information |
||||
# |
||||
# Table name: status_trends |
||||
# |
||||
# id :bigint(8) not null, primary key |
||||
# status_id :bigint(8) not null |
||||
# account_id :bigint(8) not null |
||||
# score :float default(0.0), not null |
||||
# rank :integer default(0), not null |
||||
# allowed :boolean default(FALSE), not null |
||||
# language :string |
||||
# |
||||
|
||||
class StatusTrend < ApplicationRecord |
||||
belongs_to :status |
||||
belongs_to :account |
||||
|
||||
scope :allowed, -> { where(allowed: true) } |
||||
end |
@ -0,0 +1,12 @@ |
||||
class CreateStatusTrends < ActiveRecord::Migration[6.1] |
||||
def change |
||||
create_table :status_trends do |t| |
||||
t.references :status, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } |
||||
t.references :account, null: false, foreign_key: { on_delete: :cascade } |
||||
t.float :score, null: false, default: 0 |
||||
t.integer :rank, null: false, default: 0 |
||||
t.boolean :allowed, null: false, default: false |
||||
t.string :language |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,11 @@ |
||||
class CreatePreviewCardTrends < ActiveRecord::Migration[6.1] |
||||
def change |
||||
create_table :preview_card_trends do |t| |
||||
t.references :preview_card, null: false, foreign_key: { on_delete: :cascade }, index: { unique: true } |
||||
t.float :score, null: false, default: 0 |
||||
t.integer :rank, null: false, default: 0 |
||||
t.boolean :allowed, null: false, default: false |
||||
t.string :language |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,4 @@ |
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe PreviewCardTrend, type: :model do |
||||
end |
@ -0,0 +1,4 @@ |
||||
require 'rails_helper' |
||||
|
||||
RSpec.describe StatusTrend, type: :model do |
||||
end |
Loading…
Reference in new issue