forked from mastodon/mastodon
-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
262 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
# frozen_string_literal: true | ||
|
||
module Admin | ||
class NgwordHistoriesController < BaseController | ||
before_action :set_histories | ||
|
||
PER_PAGE = 20 | ||
|
||
def index | ||
authorize :ng_words, :show? | ||
end | ||
|
||
private | ||
|
||
def set_histories | ||
@histories = NgwordHistory.order(id: :desc).page(params[:page]).per(PER_PAGE) | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
# frozen_string_literal: true | ||
|
||
# == Schema Information | ||
# | ||
# Table name: ngword_histories | ||
# | ||
# id :bigint(8) not null, primary key | ||
# uri :string not null | ||
# target_type :integer not null | ||
# reason :integer not null | ||
# text :string not null | ||
# keyword :string not null | ||
# created_at :datetime not null | ||
# updated_at :datetime not null | ||
# | ||
class NgwordHistory < ApplicationRecord | ||
include Paginable | ||
|
||
enum target_type: { status: 0, account_note: 1, account_name: 2 }, _suffix: :blocked | ||
enum reason: { ng_words: 0, ng_words_for_stranger_mention: 1 }, _prefix: :within | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
.batch-table__row | ||
%label.batch-table__row__select.batch-checkbox | ||
-# = f.check_box :history_ids, { multiple: true, include_hidden: false }, history.id | ||
.batch-table__row__content | ||
.status__content>< | ||
= html_aware_format(history.text, false) | ||
|
||
.detailed-status__meta | ||
%span.negative-hint= history.keyword | ||
· | ||
- if history.within_ng_words? | ||
= t('admin.ng_words.keywords') | ||
- elsif history.within_ng_words_for_stranger_mention? | ||
= t('admin.ng_words.keywords_for_stranger_mention') | ||
|
||
%br/ | ||
|
||
%time.formatted{ datetime: history.created_at.iso8601, title: l(history.created_at) }= l(history.created_at) | ||
· | ||
- if history.account_note_blocked? | ||
= t('admin.ngword_history.target_types.account_note') | ||
- elsif history.account_name_blocked? | ||
= t('admin.ngword_history.target_types.account_name') | ||
- elsif history.status_blocked? | ||
= t('admin.ngword_history.target_types.status') | ||
· | ||
= history.uri | ||
-# if history.application | ||
= history.application.name | ||
· |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
- content_for :page_title do | ||
= t('admin.ngword_histories.title') | ||
|
||
.filters | ||
.back-link | ||
= link_to admin_ng_words_path do | ||
= fa_icon 'chevron-left fw' | ||
= t('admin.ngword_histories.back_to_ng_words') | ||
|
||
%hr.spacer/ | ||
|
||
.batch-table | ||
.batch-table__toolbar | ||
%label.batch-table__toolbar__select.batch-checkbox-all | ||
= check_box_tag :batch_checkbox_all, nil, false | ||
.batch-table__body | ||
- if @histories.empty? | ||
= nothing_here 'nothing-here--under-tabs' | ||
- else | ||
= render partial: 'admin/ngword_histories/history', collection: @histories | ||
|
||
= paginate @histories |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# frozen_string_literal: true | ||
|
||
class CreateNgwordHistories < ActiveRecord::Migration[7.1] | ||
def change | ||
create_table :ngword_histories do |t| | ||
t.string :uri, null: false | ||
t.integer :target_type, null: false | ||
t.integer :reason, null: false | ||
t.string :text, null: false | ||
t.string :keyword, null: false | ||
|
||
t.timestamps | ||
end | ||
|
||
add_index :ngword_histories, [:uri, :keyword, :created_at], unique: false | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.