mirror of
https://github.com/glitch-soc/mastodon.git
synced 2025-12-16 09:18:46 +00:00
Compare commits
192 Commits
no-dm-opti
...
local-only
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
920d25f8c9 | ||
|
|
578438b360 | ||
|
|
358fd2121a | ||
|
|
cb11b0ee5a | ||
|
|
bdaaddeff9 | ||
|
|
e202efdf8a | ||
|
|
5325c2ab3e | ||
|
|
9e8fa3caee | ||
|
|
e677dda07c | ||
|
|
82b2e224a2 | ||
|
|
40afadfb01 | ||
|
|
a29432f0cd | ||
|
|
e0a573a2ce | ||
|
|
e9a5bde9a0 | ||
|
|
61ed5b972c | ||
|
|
37254c4f5d | ||
|
|
098c7d27fe | ||
|
|
3d3b403359 | ||
|
|
25b0d7538e | ||
|
|
a3b2ea599d | ||
|
|
573414f728 | ||
|
|
aa273a2718 | ||
|
|
6abb0950c6 | ||
|
|
e35a350119 | ||
|
|
e5a9831a56 | ||
|
|
0d3ffa691e | ||
|
|
5ad45552b3 | ||
|
|
dc313f27bb | ||
|
|
10f800ab46 | ||
|
|
7cad926401 | ||
|
|
3487460f00 | ||
|
|
82236a3703 | ||
|
|
72314d26ae | ||
|
|
cc75d47926 | ||
|
|
8bf4cc72b6 | ||
|
|
ad941f5a21 | ||
|
|
0aeec0390b | ||
|
|
fef6625496 | ||
|
|
775c3056b6 | ||
|
|
ccf4f170de | ||
|
|
90e7da16a0 | ||
|
|
ad75ec8b5b | ||
|
|
57fcc21a86 | ||
|
|
6855baa0c5 | ||
|
|
07b4427865 | ||
|
|
a8deb6648b | ||
|
|
20a6584d2d | ||
|
|
155e211dd0 | ||
|
|
81923f88ba | ||
|
|
5706fe18c2 | ||
|
|
71965cbef2 | ||
|
|
0128b86d30 | ||
|
|
0370ba7b0a | ||
|
|
c986218c3a | ||
|
|
0c8b1eb577 | ||
|
|
cfa3f55221 | ||
|
|
f9f6918148 | ||
|
|
65d083338d | ||
|
|
2a61b9f000 | ||
|
|
cfea28216f | ||
|
|
19257d91bf | ||
|
|
fe180f18ff | ||
|
|
1486fd64cc | ||
|
|
504c3d650f | ||
|
|
be33247235 | ||
|
|
a057ed5cfe | ||
|
|
b93ad3d0e8 | ||
|
|
c0c4526283 | ||
|
|
04eaa1943f | ||
|
|
c95af71da5 | ||
|
|
14c4a33cd9 | ||
|
|
30d2ea03b0 | ||
|
|
1356ed72cd | ||
|
|
481fac7c84 | ||
|
|
0a52e37648 | ||
|
|
44992df257 | ||
|
|
2efffe77dc | ||
|
|
c5a4eda694 | ||
|
|
3ec47e732b | ||
|
|
c588fcf4bc | ||
|
|
8aa527434c | ||
|
|
7d024a6b68 | ||
|
|
d8206d1931 | ||
|
|
771b950feb | ||
|
|
feed07227b | ||
|
|
0cd5f2a61f | ||
|
|
e56323a4dd | ||
|
|
204688e803 | ||
|
|
9d5ecdbf41 | ||
|
|
1138d0c321 | ||
|
|
ed7231947c | ||
|
|
bdca1614d5 | ||
|
|
dabf66e676 | ||
|
|
08b0861b96 | ||
|
|
01a3461bef | ||
|
|
288f1293ef | ||
|
|
0c46058a43 | ||
|
|
c1410af368 | ||
|
|
24f36ca912 | ||
|
|
84d5bfb35e | ||
|
|
f080a9fac7 | ||
|
|
d420e2f047 | ||
|
|
279231c5dd | ||
|
|
a98b0a47ef | ||
|
|
6bd18e43ba | ||
|
|
5ef65aab8f | ||
|
|
cfbb95605b | ||
|
|
08519cd4f4 | ||
|
|
434c70fd98 | ||
|
|
0466aa8d08 | ||
|
|
072ab191cc | ||
|
|
eec5d350fd | ||
|
|
26c9b9fa27 | ||
|
|
64b839b769 | ||
|
|
cd107e92cb | ||
|
|
6b7085a33e | ||
|
|
1c728df92e | ||
|
|
b28cd6769c | ||
|
|
8394430081 | ||
|
|
d08d0f9f33 | ||
|
|
6a82939adb | ||
|
|
98aa96b8d6 | ||
|
|
3caec1ecc2 | ||
|
|
066458a659 | ||
|
|
2950de86c6 | ||
|
|
7a8711ccac | ||
|
|
7d4ebeecbd | ||
|
|
0e56797792 | ||
|
|
282f48ddd1 | ||
|
|
ef53c972b1 | ||
|
|
eb2b971a52 | ||
|
|
6e3f176b8e | ||
|
|
a4710f9af8 | ||
|
|
fcc0795a40 | ||
|
|
0f8140d26a | ||
|
|
8606e53384 | ||
|
|
fbd2a0127c | ||
|
|
c5a688d70e | ||
|
|
7284e36fbd | ||
|
|
22cdbca82c | ||
|
|
a489e5d5cd | ||
|
|
baf9ea8018 | ||
|
|
abe95b614b | ||
|
|
e7d55df38d | ||
|
|
a72d03f43c | ||
|
|
4bce376fdc | ||
|
|
a865b62efc | ||
|
|
84cebad49d | ||
|
|
931e66e572 | ||
|
|
cdae7e4c8b | ||
|
|
3a52c90de1 | ||
|
|
17e26f8afe | ||
|
|
02d71c6a11 | ||
|
|
4a5401a58e | ||
|
|
28423dd046 | ||
|
|
b165950ca7 | ||
|
|
47157e07b2 | ||
|
|
2526ef10c2 | ||
|
|
f44c8fd130 | ||
|
|
99242b92bc | ||
|
|
ec3b449baa | ||
|
|
2f4c5f504f | ||
|
|
f08e6e9ab5 | ||
|
|
86b4d5439c | ||
|
|
c36b9cc5a6 | ||
|
|
70ce2a2095 | ||
|
|
b0db4dad79 | ||
|
|
776867ea73 | ||
|
|
dad0a09675 | ||
|
|
bca9e2e57a | ||
|
|
369f40bb9f | ||
|
|
65e0bbd958 | ||
|
|
717b7d555c | ||
|
|
753535c3c7 | ||
|
|
9cdd81e9dd | ||
|
|
96126a5b01 | ||
|
|
832a7f9a05 | ||
|
|
7fcf15adf3 | ||
|
|
a1fc626e57 | ||
|
|
9a6fc03332 | ||
|
|
7445f17571 | ||
|
|
67d625c42d | ||
|
|
ddb61decce | ||
|
|
935c1944e2 | ||
|
|
744447b3c0 | ||
|
|
0c4ca3e549 | ||
|
|
c083816c24 | ||
|
|
432761f375 | ||
|
|
de56209951 | ||
|
|
133f5b3b53 | ||
|
|
c63e6c9a2c | ||
|
|
9302369aa5 |
0
CODEOWNERS → .github/CODEOWNERS
vendored
0
CODEOWNERS → .github/CODEOWNERS
vendored
3
Gemfile
3
Gemfile
@@ -14,12 +14,13 @@ gem 'pg', '~> 0.20'
|
|||||||
gem 'pghero', '~> 1.7'
|
gem 'pghero', '~> 1.7'
|
||||||
gem 'dotenv-rails', '~> 2.2'
|
gem 'dotenv-rails', '~> 2.2'
|
||||||
|
|
||||||
gem 'fog-aws', '~> 1.4', require: false
|
gem 'aws-sdk', '~> 2.10', require: false
|
||||||
gem 'fog-core', '~> 1.45'
|
gem 'fog-core', '~> 1.45'
|
||||||
gem 'fog-local', '~> 0.4', require: false
|
gem 'fog-local', '~> 0.4', require: false
|
||||||
gem 'fog-openstack', '~> 0.1', require: false
|
gem 'fog-openstack', '~> 0.1', require: false
|
||||||
gem 'paperclip', '~> 5.1'
|
gem 'paperclip', '~> 5.1'
|
||||||
gem 'paperclip-av-transcoder', '~> 0.6'
|
gem 'paperclip-av-transcoder', '~> 0.6'
|
||||||
|
gem 'posix-spawn'
|
||||||
|
|
||||||
gem 'active_model_serializers', '~> 0.10'
|
gem 'active_model_serializers', '~> 0.10'
|
||||||
gem 'addressable', '~> 2.5'
|
gem 'addressable', '~> 2.5'
|
||||||
|
|||||||
21
Gemfile.lock
21
Gemfile.lock
@@ -57,6 +57,14 @@ GEM
|
|||||||
encryptor (~> 3.0.0)
|
encryptor (~> 3.0.0)
|
||||||
av (0.9.0)
|
av (0.9.0)
|
||||||
cocaine (~> 0.5.3)
|
cocaine (~> 0.5.3)
|
||||||
|
aws-sdk (2.10.100)
|
||||||
|
aws-sdk-resources (= 2.10.100)
|
||||||
|
aws-sdk-core (2.10.100)
|
||||||
|
aws-sigv4 (~> 1.0)
|
||||||
|
jmespath (~> 1.0)
|
||||||
|
aws-sdk-resources (2.10.100)
|
||||||
|
aws-sdk-core (= 2.10.100)
|
||||||
|
aws-sigv4 (1.0.2)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
better_errors (2.4.0)
|
better_errors (2.4.0)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
@@ -152,11 +160,6 @@ GEM
|
|||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
fast_blank (1.0.0)
|
fast_blank (1.0.0)
|
||||||
ffi (1.9.18)
|
ffi (1.9.18)
|
||||||
fog-aws (1.4.1)
|
|
||||||
fog-core (~> 1.38)
|
|
||||||
fog-json (~> 1.0)
|
|
||||||
fog-xml (~> 0.1)
|
|
||||||
ipaddress (~> 0.8)
|
|
||||||
fog-core (1.45.0)
|
fog-core (1.45.0)
|
||||||
builder
|
builder
|
||||||
excon (~> 0.58)
|
excon (~> 0.58)
|
||||||
@@ -170,9 +173,6 @@ GEM
|
|||||||
fog-core (>= 1.40)
|
fog-core (>= 1.40)
|
||||||
fog-json (>= 1.0)
|
fog-json (>= 1.0)
|
||||||
ipaddress (>= 0.8)
|
ipaddress (>= 0.8)
|
||||||
fog-xml (0.1.3)
|
|
||||||
fog-core
|
|
||||||
nokogiri (>= 1.5.11, < 2.0.0)
|
|
||||||
formatador (0.2.5)
|
formatador (0.2.5)
|
||||||
fuubar (2.2.0)
|
fuubar (2.2.0)
|
||||||
rspec-core (~> 3.0)
|
rspec-core (~> 3.0)
|
||||||
@@ -228,6 +228,7 @@ GEM
|
|||||||
idn-ruby (0.1.0)
|
idn-ruby (0.1.0)
|
||||||
ipaddress (0.8.3)
|
ipaddress (0.8.3)
|
||||||
iso-639 (0.2.8)
|
iso-639 (0.2.8)
|
||||||
|
jmespath (1.3.1)
|
||||||
json (2.1.0)
|
json (2.1.0)
|
||||||
json-ld (2.1.7)
|
json-ld (2.1.7)
|
||||||
multi_json (~> 1.12)
|
multi_json (~> 1.12)
|
||||||
@@ -324,6 +325,7 @@ GEM
|
|||||||
pghero (1.7.0)
|
pghero (1.7.0)
|
||||||
activerecord
|
activerecord
|
||||||
pkg-config (1.2.8)
|
pkg-config (1.2.8)
|
||||||
|
posix-spawn (0.3.13)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
pry (0.11.3)
|
pry (0.11.3)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
@@ -544,6 +546,7 @@ DEPENDENCIES
|
|||||||
active_record_query_trace (~> 1.5)
|
active_record_query_trace (~> 1.5)
|
||||||
addressable (~> 2.5)
|
addressable (~> 2.5)
|
||||||
annotate (~> 2.7)
|
annotate (~> 2.7)
|
||||||
|
aws-sdk (~> 2.10)
|
||||||
better_errors (~> 2.4)
|
better_errors (~> 2.4)
|
||||||
binding_of_caller (~> 0.7)
|
binding_of_caller (~> 0.7)
|
||||||
bootsnap
|
bootsnap
|
||||||
@@ -566,7 +569,6 @@ DEPENDENCIES
|
|||||||
fabrication (~> 2.18)
|
fabrication (~> 2.18)
|
||||||
faker (~> 1.7)
|
faker (~> 1.7)
|
||||||
fast_blank (~> 1.0)
|
fast_blank (~> 1.0)
|
||||||
fog-aws (~> 1.4)
|
|
||||||
fog-core (~> 1.45)
|
fog-core (~> 1.45)
|
||||||
fog-local (~> 0.4)
|
fog-local (~> 0.4)
|
||||||
fog-openstack (~> 0.1)
|
fog-openstack (~> 0.1)
|
||||||
@@ -601,6 +603,7 @@ DEPENDENCIES
|
|||||||
pg (~> 0.20)
|
pg (~> 0.20)
|
||||||
pghero (~> 1.7)
|
pghero (~> 1.7)
|
||||||
pkg-config (~> 1.2)
|
pkg-config (~> 1.2)
|
||||||
|
posix-spawn
|
||||||
pry-rails (~> 0.3)
|
pry-rails (~> 0.3)
|
||||||
puma (~> 3.10)
|
puma (~> 3.10)
|
||||||
pundit (~> 1.1)
|
pundit (~> 1.1)
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ class AccountsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def default_statuses
|
def default_statuses
|
||||||
@account.statuses.where(visibility: [:public, :unlisted])
|
@account.statuses.not_local_only.where(visibility: [:public, :unlisted])
|
||||||
end
|
end
|
||||||
|
|
||||||
def only_media_scope
|
def only_media_scope
|
||||||
|
|||||||
@@ -89,7 +89,8 @@ module Admin
|
|||||||
:username,
|
:username,
|
||||||
:display_name,
|
:display_name,
|
||||||
:email,
|
:email,
|
||||||
:ip
|
:ip,
|
||||||
|
:staff
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -92,7 +92,9 @@ module Admin
|
|||||||
def filter_params
|
def filter_params
|
||||||
params.permit(
|
params.permit(
|
||||||
:local,
|
:local,
|
||||||
:remote
|
:remote,
|
||||||
|
:by_domain,
|
||||||
|
:shortcode
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -72,19 +72,4 @@ class Api::BaseController < ApplicationController
|
|||||||
def render_empty
|
def render_empty
|
||||||
render json: {}, status: 200
|
render json: {}, status: 200
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_maps(statuses) # rubocop:disable Style/AccessorMethodName
|
|
||||||
if current_account.nil?
|
|
||||||
@reblogs_map = {}
|
|
||||||
@favourites_map = {}
|
|
||||||
@mutes_map = {}
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
status_ids = statuses.compact.flat_map { |s| [s.id, s.reblog_of_id] }.uniq
|
|
||||||
conversation_ids = statuses.compact.map(&:conversation_id).compact.uniq
|
|
||||||
@reblogs_map = Status.reblogs_map(status_ids, current_account)
|
|
||||||
@favourites_map = Status.favourites_map(status_ids, current_account)
|
|
||||||
@mutes_map = Status.mutes_map(conversation_ids, current_account)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
20
app/controllers/api/v1/accounts/lists_controller.rb
Normal file
20
app/controllers/api/v1/accounts/lists_controller.rb
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::Accounts::ListsController < Api::BaseController
|
||||||
|
before_action -> { doorkeeper_authorize! :read }
|
||||||
|
before_action :require_user!
|
||||||
|
before_action :set_account
|
||||||
|
|
||||||
|
respond_to :json
|
||||||
|
|
||||||
|
def index
|
||||||
|
@lists = @account.lists.where(account: current_account)
|
||||||
|
render json: @lists, each_serializer: REST::ListSerializer
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_account
|
||||||
|
@account = Account.find(params[:account_id])
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,18 +1,14 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::ListsController < Api::BaseController
|
class Api::V1::ListsController < Api::BaseController
|
||||||
LISTS_LIMIT = 50
|
|
||||||
|
|
||||||
before_action -> { doorkeeper_authorize! :read }, only: [:index, :show]
|
before_action -> { doorkeeper_authorize! :read }, only: [:index, :show]
|
||||||
before_action -> { doorkeeper_authorize! :write }, except: [:index, :show]
|
before_action -> { doorkeeper_authorize! :write }, except: [:index, :show]
|
||||||
|
|
||||||
before_action :require_user!
|
before_action :require_user!
|
||||||
before_action :set_list, except: [:index, :create]
|
before_action :set_list, except: [:index, :create]
|
||||||
|
|
||||||
after_action :insert_pagination_headers, only: :index
|
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@lists = List.where(account: current_account).paginate_by_max_id(limit_param(LISTS_LIMIT), params[:max_id], params[:since_id])
|
@lists = List.where(account: current_account).all
|
||||||
render json: @lists, each_serializer: REST::ListSerializer
|
render json: @lists, each_serializer: REST::ListSerializer
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -44,36 +40,4 @@ class Api::V1::ListsController < Api::BaseController
|
|||||||
def list_params
|
def list_params
|
||||||
params.permit(:title)
|
params.permit(:title)
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_pagination_headers
|
|
||||||
set_pagination_headers(next_path, prev_path)
|
|
||||||
end
|
|
||||||
|
|
||||||
def next_path
|
|
||||||
if records_continue?
|
|
||||||
api_v1_lists_url pagination_params(max_id: pagination_max_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def prev_path
|
|
||||||
unless @lists.empty?
|
|
||||||
api_v1_lists_url pagination_params(since_id: pagination_since_id)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def pagination_max_id
|
|
||||||
@lists.last.id
|
|
||||||
end
|
|
||||||
|
|
||||||
def pagination_since_id
|
|
||||||
@lists.first.id
|
|
||||||
end
|
|
||||||
|
|
||||||
def records_continue?
|
|
||||||
@lists.size == limit_param(LISTS_LIMIT)
|
|
||||||
end
|
|
||||||
|
|
||||||
def pagination_params(core_params)
|
|
||||||
params.permit(:limit).merge(core_params)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class Api::V1::StatusesController < Api::BaseController
|
|||||||
@status = PostStatusService.new.call(current_user.account,
|
@status = PostStatusService.new.call(current_user.account,
|
||||||
status_params[:status],
|
status_params[:status],
|
||||||
status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]),
|
status_params[:in_reply_to_id].blank? ? nil : Status.find(status_params[:in_reply_to_id]),
|
||||||
|
local_only: status_params[:local_only],
|
||||||
media_ids: status_params[:media_ids],
|
media_ids: status_params[:media_ids],
|
||||||
sensitive: status_params[:sensitive],
|
sensitive: status_params[:sensitive],
|
||||||
spoiler_text: status_params[:spoiler_text],
|
spoiler_text: status_params[:spoiler_text],
|
||||||
@@ -72,7 +73,7 @@ class Api::V1::StatusesController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def status_params
|
def status_params
|
||||||
params.permit(:status, :in_reply_to_id, :sensitive, :spoiler_text, :visibility, media_ids: [])
|
params.permit(:status, :in_reply_to_id, :local_only, :sensitive, :spoiler_text, :visibility, media_ids: [])
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_params(core_params)
|
def pagination_params(core_params)
|
||||||
|
|||||||
@@ -28,6 +28,8 @@ class Api::Web::PushSubscriptionsController < Api::BaseController
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
data.deep_merge!(params[:data]) if params[:data]
|
||||||
|
|
||||||
web_subscription = ::Web::PushSubscription.create!(
|
web_subscription = ::Web::PushSubscription.create!(
|
||||||
endpoint: params[:subscription][:endpoint],
|
endpoint: params[:subscription][:endpoint],
|
||||||
key_p256dh: params[:subscription][:keys][:p256dh],
|
key_p256dh: params[:subscription][:keys][:p256dh],
|
||||||
|
|||||||
@@ -62,6 +62,7 @@ class ApplicationController < ActionController::Base
|
|||||||
pack: pack_name,
|
pack: pack_name,
|
||||||
preload: nil,
|
preload: nil,
|
||||||
skin: nil,
|
skin: nil,
|
||||||
|
supported_locales: data['locales'],
|
||||||
}
|
}
|
||||||
if data['pack'][pack_name].is_a?(Hash)
|
if data['pack'][pack_name].is_a?(Hash)
|
||||||
pack_data[:common] = nil if data['pack'][pack_name]['use_common'] == false
|
pack_data[:common] = nil if data['pack'][pack_name]['use_common'] == false
|
||||||
@@ -93,6 +94,7 @@ class ApplicationController < ActionController::Base
|
|||||||
pack: nil,
|
pack: nil,
|
||||||
preload: nil,
|
preload: nil,
|
||||||
skin: nil,
|
skin: nil,
|
||||||
|
supported_locales: data['locales'],
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -103,15 +105,15 @@ class ApplicationController < ActionController::Base
|
|||||||
if data['fallback'].nil?
|
if data['fallback'].nil?
|
||||||
return nil_pack(data, pack_name, skin)
|
return nil_pack(data, pack_name, skin)
|
||||||
elsif data['fallback'].is_a?(String) && Themes.instance.flavour(data['fallback'])
|
elsif data['fallback'].is_a?(String) && Themes.instance.flavour(data['fallback'])
|
||||||
return resolve_pack(Themes.instance.flavour(data['fallback']), pack_name, skin)
|
return resolve_pack(Themes.instance.flavour(data['fallback']), pack_name)
|
||||||
elsif data['fallback'].is_a?(Array)
|
elsif data['fallback'].is_a?(Array)
|
||||||
data['fallback'].each do |fallback|
|
data['fallback'].each do |fallback|
|
||||||
return resolve_pack(Themes.instance.flavour(fallback), pack_name, skin) if Themes.instance.flavour(fallback)
|
return resolve_pack(Themes.instance.flavour(fallback), pack_name) if Themes.instance.flavour(fallback)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
return nil_pack(data, pack_name, skin)
|
return nil_pack(data, pack_name, skin)
|
||||||
end
|
end
|
||||||
return data.key?('name') && data['name'] != Setting.default_settings['flavour'] ? resolve_pack(Themes.instance.flavour(Setting.default_settings['flavour']), pack_name, skin) : nil_pack(data, pack_name, skin)
|
return data.key?('name') && data['name'] != Setting.default_settings['flavour'] ? resolve_pack(Themes.instance.flavour(Setting.default_settings['flavour']), pack_name) : nil_pack(data, pack_name, skin)
|
||||||
end
|
end
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -44,7 +44,8 @@ module RateLimitHeaders
|
|||||||
end
|
end
|
||||||
|
|
||||||
def api_throttle_data
|
def api_throttle_data
|
||||||
request.env['rack.attack.throttle_data']['api']
|
most_limited_type, = request.env['rack.attack.throttle_data'].min_by { |_, v| v[:limit] }
|
||||||
|
request.env['rack.attack.throttle_data'][most_limited_type]
|
||||||
end
|
end
|
||||||
|
|
||||||
def request_time
|
def request_time
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
|||||||
|
|
||||||
before_action :store_current_location
|
before_action :store_current_location
|
||||||
before_action :authenticate_resource_owner!
|
before_action :authenticate_resource_owner!
|
||||||
|
before_action :set_pack
|
||||||
|
|
||||||
include Localized
|
include Localized
|
||||||
|
|
||||||
@@ -13,4 +14,8 @@ class Oauth::AuthorizationsController < Doorkeeper::AuthorizationsController
|
|||||||
def store_current_location
|
def store_current_location
|
||||||
store_location_for(:user, request.url)
|
store_location_for(:user, request.url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_pack
|
||||||
|
use_pack 'auth'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
|
|||||||
|
|
||||||
before_action :store_current_location
|
before_action :store_current_location
|
||||||
before_action :authenticate_resource_owner!
|
before_action :authenticate_resource_owner!
|
||||||
|
before_action :set_pack
|
||||||
|
|
||||||
include Localized
|
include Localized
|
||||||
|
|
||||||
@@ -13,4 +14,8 @@ class Oauth::AuthorizedApplicationsController < Doorkeeper::AuthorizedApplicatio
|
|||||||
def store_current_location
|
def store_current_location
|
||||||
store_location_for(:user, request.url)
|
store_location_for(:user, request.url)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def set_pack
|
||||||
|
use_pack 'settings'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
35
app/controllers/settings/flavours_controller.rb
Normal file
35
app/controllers/settings/flavours_controller.rb
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Settings::FlavoursController < Settings::BaseController
|
||||||
|
|
||||||
|
def index
|
||||||
|
redirect_to action: 'show', flavour: current_flavour
|
||||||
|
end
|
||||||
|
|
||||||
|
def show
|
||||||
|
unless Themes.instance.flavours.include?(params[:flavour]) or params[:flavour] == current_flavour
|
||||||
|
redirect_to action: 'show', flavour: current_flavour
|
||||||
|
end
|
||||||
|
|
||||||
|
@listing = Themes.instance.flavours
|
||||||
|
@selected = params[:flavour]
|
||||||
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
user_settings.update(user_settings_params(params[:flavour]).to_h)
|
||||||
|
redirect_to action: 'show', flavour: params[:flavour]
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def user_settings
|
||||||
|
UserSettingsDecorator.new(current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_settings_params(flavour)
|
||||||
|
params.require(:user).merge({ setting_flavour: flavour }).permit(
|
||||||
|
:setting_flavour,
|
||||||
|
:setting_skin
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -28,6 +28,7 @@ class Settings::MigrationsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def migration_account_changed?
|
def migration_account_changed?
|
||||||
current_account.moved_to_account_id != @migration.account&.id
|
current_account.moved_to_account_id != @migration.account&.id &&
|
||||||
|
current_account.id != @migration.account&.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -33,13 +33,12 @@ class Settings::PreferencesController < Settings::BaseController
|
|||||||
:setting_default_sensitive,
|
:setting_default_sensitive,
|
||||||
:setting_unfollow_modal,
|
:setting_unfollow_modal,
|
||||||
:setting_boost_modal,
|
:setting_boost_modal,
|
||||||
|
:setting_favourite_modal,
|
||||||
:setting_delete_modal,
|
:setting_delete_modal,
|
||||||
:setting_auto_play_gif,
|
:setting_auto_play_gif,
|
||||||
:setting_reduce_motion,
|
:setting_reduce_motion,
|
||||||
:setting_system_font_ui,
|
:setting_system_font_ui,
|
||||||
:setting_noindex,
|
:setting_noindex,
|
||||||
:setting_flavour,
|
|
||||||
:setting_skin,
|
|
||||||
notification_emails: %i(follow follow_request reblog favourite mention digest),
|
notification_emails: %i(follow follow_request reblog favourite mention digest),
|
||||||
interactions: %i(must_be_follower must_be_following)
|
interactions: %i(must_be_follower must_be_following)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1,11 +1,12 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
module Admin::FilterHelper
|
module Admin::FilterHelper
|
||||||
ACCOUNT_FILTERS = %i(local remote by_domain silenced suspended recent username display_name email ip).freeze
|
ACCOUNT_FILTERS = %i(local remote by_domain silenced suspended recent username display_name email ip staff).freeze
|
||||||
REPORT_FILTERS = %i(resolved account_id target_account_id).freeze
|
REPORT_FILTERS = %i(resolved account_id target_account_id).freeze
|
||||||
INVITE_FILTER = %i(available expired).freeze
|
INVITE_FILTER = %i(available expired).freeze
|
||||||
|
CUSTOM_EMOJI_FILTERS = %i(local remote by_domain shortcode).freeze
|
||||||
|
|
||||||
FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER
|
FILTERS = ACCOUNT_FILTERS + REPORT_FILTERS + INVITE_FILTER + CUSTOM_EMOJI_FILTERS
|
||||||
|
|
||||||
def filter_link_to(text, link_to_params, link_class_params = link_to_params)
|
def filter_link_to(text, link_to_params, link_class_params = link_to_params)
|
||||||
new_url = filtered_url_for(link_to_params)
|
new_url = filtered_url_for(link_to_params)
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ module SettingsHelper
|
|||||||
eo: 'Esperanto',
|
eo: 'Esperanto',
|
||||||
es: 'Español',
|
es: 'Español',
|
||||||
fa: 'فارسی',
|
fa: 'فارسی',
|
||||||
|
gl: 'Galego',
|
||||||
fi: 'Suomi',
|
fi: 'Suomi',
|
||||||
fr: 'Français',
|
fr: 'Français',
|
||||||
he: 'עברית',
|
he: 'עברית',
|
||||||
|
|||||||
@@ -37,7 +37,3 @@ delegate(document, '#account_header', 'change', ({ target }) => {
|
|||||||
|
|
||||||
header.style.backgroundImage = `url(${url})`;
|
header.style.backgroundImage = `url(${url})`;
|
||||||
});
|
});
|
||||||
|
|
||||||
delegate(document, '#user_setting_flavour, #user_setting_skin', 'change', ({ target }) => {
|
|
||||||
target.form.submit();
|
|
||||||
});
|
|
||||||
|
|||||||
313
app/javascript/flavours/glitch/actions/lists.js
Normal file
313
app/javascript/flavours/glitch/actions/lists.js
Normal file
@@ -0,0 +1,313 @@
|
|||||||
|
import api from 'flavours/glitch/util/api';
|
||||||
|
|
||||||
|
export const LIST_FETCH_REQUEST = 'LIST_FETCH_REQUEST';
|
||||||
|
export const LIST_FETCH_SUCCESS = 'LIST_FETCH_SUCCESS';
|
||||||
|
export const LIST_FETCH_FAIL = 'LIST_FETCH_FAIL';
|
||||||
|
|
||||||
|
export const LISTS_FETCH_REQUEST = 'LISTS_FETCH_REQUEST';
|
||||||
|
export const LISTS_FETCH_SUCCESS = 'LISTS_FETCH_SUCCESS';
|
||||||
|
export const LISTS_FETCH_FAIL = 'LISTS_FETCH_FAIL';
|
||||||
|
|
||||||
|
export const LIST_EDITOR_TITLE_CHANGE = 'LIST_EDITOR_TITLE_CHANGE';
|
||||||
|
export const LIST_EDITOR_RESET = 'LIST_EDITOR_RESET';
|
||||||
|
export const LIST_EDITOR_SETUP = 'LIST_EDITOR_SETUP';
|
||||||
|
|
||||||
|
export const LIST_CREATE_REQUEST = 'LIST_CREATE_REQUEST';
|
||||||
|
export const LIST_CREATE_SUCCESS = 'LIST_CREATE_SUCCESS';
|
||||||
|
export const LIST_CREATE_FAIL = 'LIST_CREATE_FAIL';
|
||||||
|
|
||||||
|
export const LIST_UPDATE_REQUEST = 'LIST_UPDATE_REQUEST';
|
||||||
|
export const LIST_UPDATE_SUCCESS = 'LIST_UPDATE_SUCCESS';
|
||||||
|
export const LIST_UPDATE_FAIL = 'LIST_UPDATE_FAIL';
|
||||||
|
|
||||||
|
export const LIST_DELETE_REQUEST = 'LIST_DELETE_REQUEST';
|
||||||
|
export const LIST_DELETE_SUCCESS = 'LIST_DELETE_SUCCESS';
|
||||||
|
export const LIST_DELETE_FAIL = 'LIST_DELETE_FAIL';
|
||||||
|
|
||||||
|
export const LIST_ACCOUNTS_FETCH_REQUEST = 'LIST_ACCOUNTS_FETCH_REQUEST';
|
||||||
|
export const LIST_ACCOUNTS_FETCH_SUCCESS = 'LIST_ACCOUNTS_FETCH_SUCCESS';
|
||||||
|
export const LIST_ACCOUNTS_FETCH_FAIL = 'LIST_ACCOUNTS_FETCH_FAIL';
|
||||||
|
|
||||||
|
export const LIST_EDITOR_SUGGESTIONS_CHANGE = 'LIST_EDITOR_SUGGESTIONS_CHANGE';
|
||||||
|
export const LIST_EDITOR_SUGGESTIONS_READY = 'LIST_EDITOR_SUGGESTIONS_READY';
|
||||||
|
export const LIST_EDITOR_SUGGESTIONS_CLEAR = 'LIST_EDITOR_SUGGESTIONS_CLEAR';
|
||||||
|
|
||||||
|
export const LIST_EDITOR_ADD_REQUEST = 'LIST_EDITOR_ADD_REQUEST';
|
||||||
|
export const LIST_EDITOR_ADD_SUCCESS = 'LIST_EDITOR_ADD_SUCCESS';
|
||||||
|
export const LIST_EDITOR_ADD_FAIL = 'LIST_EDITOR_ADD_FAIL';
|
||||||
|
|
||||||
|
export const LIST_EDITOR_REMOVE_REQUEST = 'LIST_EDITOR_REMOVE_REQUEST';
|
||||||
|
export const LIST_EDITOR_REMOVE_SUCCESS = 'LIST_EDITOR_REMOVE_SUCCESS';
|
||||||
|
export const LIST_EDITOR_REMOVE_FAIL = 'LIST_EDITOR_REMOVE_FAIL';
|
||||||
|
|
||||||
|
export const fetchList = id => (dispatch, getState) => {
|
||||||
|
if (getState().getIn(['lists', id])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
dispatch(fetchListRequest(id));
|
||||||
|
|
||||||
|
api(getState).get(`/api/v1/lists/${id}`)
|
||||||
|
.then(({ data }) => dispatch(fetchListSuccess(data)))
|
||||||
|
.catch(err => dispatch(fetchListFail(id, err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchListRequest = id => ({
|
||||||
|
type: LIST_FETCH_REQUEST,
|
||||||
|
id,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListSuccess = list => ({
|
||||||
|
type: LIST_FETCH_SUCCESS,
|
||||||
|
list,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListFail = (id, error) => ({
|
||||||
|
type: LIST_FETCH_FAIL,
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchLists = () => (dispatch, getState) => {
|
||||||
|
dispatch(fetchListsRequest());
|
||||||
|
|
||||||
|
api(getState).get('/api/v1/lists')
|
||||||
|
.then(({ data }) => dispatch(fetchListsSuccess(data)))
|
||||||
|
.catch(err => dispatch(fetchListsFail(err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchListsRequest = () => ({
|
||||||
|
type: LISTS_FETCH_REQUEST,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListsSuccess = lists => ({
|
||||||
|
type: LISTS_FETCH_SUCCESS,
|
||||||
|
lists,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListsFail = error => ({
|
||||||
|
type: LISTS_FETCH_FAIL,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const submitListEditor = shouldReset => (dispatch, getState) => {
|
||||||
|
const listId = getState().getIn(['listEditor', 'listId']);
|
||||||
|
const title = getState().getIn(['listEditor', 'title']);
|
||||||
|
|
||||||
|
if (listId === null) {
|
||||||
|
dispatch(createList(title, shouldReset));
|
||||||
|
} else {
|
||||||
|
dispatch(updateList(listId, title, shouldReset));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
export const setupListEditor = listId => (dispatch, getState) => {
|
||||||
|
dispatch({
|
||||||
|
type: LIST_EDITOR_SETUP,
|
||||||
|
list: getState().getIn(['lists', listId]),
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatch(fetchListAccounts(listId));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const changeListEditorTitle = value => ({
|
||||||
|
type: LIST_EDITOR_TITLE_CHANGE,
|
||||||
|
value,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const createList = (title, shouldReset) => (dispatch, getState) => {
|
||||||
|
dispatch(createListRequest());
|
||||||
|
|
||||||
|
api(getState).post('/api/v1/lists', { title }).then(({ data }) => {
|
||||||
|
dispatch(createListSuccess(data));
|
||||||
|
|
||||||
|
if (shouldReset) {
|
||||||
|
dispatch(resetListEditor());
|
||||||
|
}
|
||||||
|
}).catch(err => dispatch(createListFail(err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const createListRequest = () => ({
|
||||||
|
type: LIST_CREATE_REQUEST,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const createListSuccess = list => ({
|
||||||
|
type: LIST_CREATE_SUCCESS,
|
||||||
|
list,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const createListFail = error => ({
|
||||||
|
type: LIST_CREATE_FAIL,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const updateList = (id, title, shouldReset) => (dispatch, getState) => {
|
||||||
|
dispatch(updateListRequest(id));
|
||||||
|
|
||||||
|
api(getState).put(`/api/v1/lists/${id}`, { title }).then(({ data }) => {
|
||||||
|
dispatch(updateListSuccess(data));
|
||||||
|
|
||||||
|
if (shouldReset) {
|
||||||
|
dispatch(resetListEditor());
|
||||||
|
}
|
||||||
|
}).catch(err => dispatch(updateListFail(id, err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const updateListRequest = id => ({
|
||||||
|
type: LIST_UPDATE_REQUEST,
|
||||||
|
id,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const updateListSuccess = list => ({
|
||||||
|
type: LIST_UPDATE_SUCCESS,
|
||||||
|
list,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const updateListFail = (id, error) => ({
|
||||||
|
type: LIST_UPDATE_FAIL,
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const resetListEditor = () => ({
|
||||||
|
type: LIST_EDITOR_RESET,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const deleteList = id => (dispatch, getState) => {
|
||||||
|
dispatch(deleteListRequest(id));
|
||||||
|
|
||||||
|
api(getState).delete(`/api/v1/lists/${id}`)
|
||||||
|
.then(() => dispatch(deleteListSuccess(id)))
|
||||||
|
.catch(err => dispatch(deleteListFail(id, err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const deleteListRequest = id => ({
|
||||||
|
type: LIST_DELETE_REQUEST,
|
||||||
|
id,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const deleteListSuccess = id => ({
|
||||||
|
type: LIST_DELETE_SUCCESS,
|
||||||
|
id,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const deleteListFail = (id, error) => ({
|
||||||
|
type: LIST_DELETE_FAIL,
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListAccounts = listId => (dispatch, getState) => {
|
||||||
|
dispatch(fetchListAccountsRequest(listId));
|
||||||
|
|
||||||
|
api(getState).get(`/api/v1/lists/${listId}/accounts`, { params: { limit: 0 } })
|
||||||
|
.then(({ data }) => dispatch(fetchListAccountsSuccess(listId, data)))
|
||||||
|
.catch(err => dispatch(fetchListAccountsFail(listId, err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchListAccountsRequest = id => ({
|
||||||
|
type: LIST_ACCOUNTS_FETCH_REQUEST,
|
||||||
|
id,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListAccountsSuccess = (id, accounts, next) => ({
|
||||||
|
type: LIST_ACCOUNTS_FETCH_SUCCESS,
|
||||||
|
id,
|
||||||
|
accounts,
|
||||||
|
next,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListAccountsFail = (id, error) => ({
|
||||||
|
type: LIST_ACCOUNTS_FETCH_FAIL,
|
||||||
|
id,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const fetchListSuggestions = q => (dispatch, getState) => {
|
||||||
|
const params = {
|
||||||
|
q,
|
||||||
|
resolve: false,
|
||||||
|
limit: 4,
|
||||||
|
following: true,
|
||||||
|
};
|
||||||
|
|
||||||
|
api(getState).get('/api/v1/accounts/search', { params })
|
||||||
|
.then(({ data }) => dispatch(fetchListSuggestionsReady(q, data)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fetchListSuggestionsReady = (query, accounts) => ({
|
||||||
|
type: LIST_EDITOR_SUGGESTIONS_READY,
|
||||||
|
query,
|
||||||
|
accounts,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const clearListSuggestions = () => ({
|
||||||
|
type: LIST_EDITOR_SUGGESTIONS_CLEAR,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const changeListSuggestions = value => ({
|
||||||
|
type: LIST_EDITOR_SUGGESTIONS_CHANGE,
|
||||||
|
value,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const addToListEditor = accountId => (dispatch, getState) => {
|
||||||
|
dispatch(addToList(getState().getIn(['listEditor', 'listId']), accountId));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const addToList = (listId, accountId) => (dispatch, getState) => {
|
||||||
|
dispatch(addToListRequest(listId, accountId));
|
||||||
|
|
||||||
|
api(getState).post(`/api/v1/lists/${listId}/accounts`, { account_ids: [accountId] })
|
||||||
|
.then(() => dispatch(addToListSuccess(listId, accountId)))
|
||||||
|
.catch(err => dispatch(addToListFail(listId, accountId, err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const addToListRequest = (listId, accountId) => ({
|
||||||
|
type: LIST_EDITOR_ADD_REQUEST,
|
||||||
|
listId,
|
||||||
|
accountId,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const addToListSuccess = (listId, accountId) => ({
|
||||||
|
type: LIST_EDITOR_ADD_SUCCESS,
|
||||||
|
listId,
|
||||||
|
accountId,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const addToListFail = (listId, accountId, error) => ({
|
||||||
|
type: LIST_EDITOR_ADD_FAIL,
|
||||||
|
listId,
|
||||||
|
accountId,
|
||||||
|
error,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const removeFromListEditor = accountId => (dispatch, getState) => {
|
||||||
|
dispatch(removeFromList(getState().getIn(['listEditor', 'listId']), accountId));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const removeFromList = (listId, accountId) => (dispatch, getState) => {
|
||||||
|
dispatch(removeFromListRequest(listId, accountId));
|
||||||
|
|
||||||
|
api(getState).delete(`/api/v1/lists/${listId}/accounts`, { params: { account_ids: [accountId] } })
|
||||||
|
.then(() => dispatch(removeFromListSuccess(listId, accountId)))
|
||||||
|
.catch(err => dispatch(removeFromListFail(listId, accountId, err)));
|
||||||
|
};
|
||||||
|
|
||||||
|
export const removeFromListRequest = (listId, accountId) => ({
|
||||||
|
type: LIST_EDITOR_REMOVE_REQUEST,
|
||||||
|
listId,
|
||||||
|
accountId,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const removeFromListSuccess = (listId, accountId) => ({
|
||||||
|
type: LIST_EDITOR_REMOVE_SUCCESS,
|
||||||
|
listId,
|
||||||
|
accountId,
|
||||||
|
});
|
||||||
|
|
||||||
|
export const removeFromListFail = (listId, accountId, error) => ({
|
||||||
|
type: LIST_EDITOR_REMOVE_FAIL,
|
||||||
|
listId,
|
||||||
|
accountId,
|
||||||
|
error,
|
||||||
|
});
|
||||||
@@ -52,3 +52,4 @@ export const connectMediaStream = () => connectTimelineStream('community', 'publ
|
|||||||
export const connectPublicStream = () => connectTimelineStream('public', 'public');
|
export const connectPublicStream = () => connectTimelineStream('public', 'public');
|
||||||
export const connectHashtagStream = (tag) => connectTimelineStream(`hashtag:${tag}`, `hashtag&tag=${tag}`);
|
export const connectHashtagStream = (tag) => connectTimelineStream(`hashtag:${tag}`, `hashtag&tag=${tag}`);
|
||||||
export const connectDirectStream = () => connectTimelineStream('direct', 'direct');
|
export const connectDirectStream = () => connectTimelineStream('direct', 'direct');
|
||||||
|
export const connectListStream = (id) => connectTimelineStream(`list:${id}`, `list&list=${id}`);
|
||||||
|
|||||||
@@ -119,6 +119,7 @@ export const refreshDirectTimeline = () => refreshTimeline('direct', '/api
|
|||||||
export const refreshAccountTimeline = accountId => refreshTimeline(`account:${accountId}`, `/api/v1/accounts/${accountId}/statuses`);
|
export const refreshAccountTimeline = accountId => refreshTimeline(`account:${accountId}`, `/api/v1/accounts/${accountId}/statuses`);
|
||||||
export const refreshAccountMediaTimeline = accountId => refreshTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { only_media: true });
|
export const refreshAccountMediaTimeline = accountId => refreshTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { only_media: true });
|
||||||
export const refreshHashtagTimeline = hashtag => refreshTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`);
|
export const refreshHashtagTimeline = hashtag => refreshTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`);
|
||||||
|
export const refreshListTimeline = id => refreshTimeline(`list:${id}`, `/api/v1/timelines/list/${id}`);
|
||||||
|
|
||||||
export function refreshTimelineFail(timeline, error, skipLoading) {
|
export function refreshTimelineFail(timeline, error, skipLoading) {
|
||||||
return {
|
return {
|
||||||
@@ -160,6 +161,7 @@ export const expandDirectTimeline = () => expandTimeline('direct', '/api/v
|
|||||||
export const expandAccountTimeline = accountId => expandTimeline(`account:${accountId}`, `/api/v1/accounts/${accountId}/statuses`);
|
export const expandAccountTimeline = accountId => expandTimeline(`account:${accountId}`, `/api/v1/accounts/${accountId}/statuses`);
|
||||||
export const expandAccountMediaTimeline = accountId => expandTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { only_media: true });
|
export const expandAccountMediaTimeline = accountId => expandTimeline(`account:${accountId}:media`, `/api/v1/accounts/${accountId}/statuses`, { only_media: true });
|
||||||
export const expandHashtagTimeline = hashtag => expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`);
|
export const expandHashtagTimeline = hashtag => expandTimeline(`hashtag:${hashtag}`, `/api/v1/timelines/tag/${hashtag}`);
|
||||||
|
export const expandListTimeline = id => expandTimeline(`list:${id}`, `/api/v1/timelines/list/${id}`);
|
||||||
|
|
||||||
export function expandTimelineRequest(timeline) {
|
export function expandTimelineRequest(timeline) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
@@ -81,7 +81,7 @@ export default class Account extends ImmutablePureComponent {
|
|||||||
buttons = <IconButton active icon='unlock-alt' title={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />;
|
buttons = <IconButton active icon='unlock-alt' title={intl.formatMessage(messages.unblock, { name: account.get('username') })} onClick={this.handleBlock} />;
|
||||||
} else if (muting) {
|
} else if (muting) {
|
||||||
let hidingNotificationsButton;
|
let hidingNotificationsButton;
|
||||||
if (muting.get('notifications')) {
|
if (account.getIn(['relationship', 'muting_notifications'])) {
|
||||||
hidingNotificationsButton = <IconButton active icon='bell' title={intl.formatMessage(messages.unmute_notifications, { name: account.get('username') })} onClick={this.handleUnmuteNotifications} />;
|
hidingNotificationsButton = <IconButton active icon='bell' title={intl.formatMessage(messages.unmute_notifications, { name: account.get('username') })} onClick={this.handleUnmuteNotifications} />;
|
||||||
} else {
|
} else {
|
||||||
hidingNotificationsButton = <IconButton active icon='bell-slash' title={intl.formatMessage(messages.mute_notifications, { name: account.get('username') })} onClick={this.handleMuteNotifications} />;
|
hidingNotificationsButton = <IconButton active icon='bell-slash' title={intl.formatMessage(messages.mute_notifications, { name: account.get('username') })} onClick={this.handleMuteNotifications} />;
|
||||||
@@ -93,7 +93,7 @@ export default class Account extends ImmutablePureComponent {
|
|||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
buttons = <IconButton icon={following ? 'user-times' : 'user-plus'} title={intl.formatMessage(following ? messages.unfollow : messages.follow)} onClick={this.handleFollow} active={following ? true : false} />;
|
buttons = <IconButton icon={following ? 'user-times' : 'user-plus'} title={intl.formatMessage(following ? messages.unfollow : messages.follow)} onClick={this.handleFollow} active={following} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -209,6 +209,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
onBlur={this.onBlur}
|
onBlur={this.onBlur}
|
||||||
onPaste={this.onPaste}
|
onPaste={this.onPaste}
|
||||||
style={style}
|
style={style}
|
||||||
|
aria-autocomplete='list'
|
||||||
/>
|
/>
|
||||||
</label>
|
</label>
|
||||||
|
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ export default class Status extends ImmutablePureComponent {
|
|||||||
'settings',
|
'settings',
|
||||||
'prepend',
|
'prepend',
|
||||||
'boostModal',
|
'boostModal',
|
||||||
|
'favouriteModal',
|
||||||
'muted',
|
'muted',
|
||||||
'collapse',
|
'collapse',
|
||||||
'notification',
|
'notification',
|
||||||
@@ -204,8 +205,8 @@ export default class Status extends ImmutablePureComponent {
|
|||||||
this.props.onReply(this.props.status, this.context.router.history);
|
this.props.onReply(this.props.status, this.context.router.history);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyFavourite = () => {
|
handleHotkeyFavourite = (e) => {
|
||||||
this.props.onFavourite(this.props.status);
|
this.props.onFavourite(this.props.status, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleHotkeyBoost = e => {
|
handleHotkeyBoost = e => {
|
||||||
|
|||||||
@@ -71,8 +71,8 @@ export default class StatusActionBar extends ImmutablePureComponent {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFavouriteClick = () => {
|
handleFavouriteClick = (e) => {
|
||||||
this.props.onFavourite(this.props.status);
|
this.props.onFavourite(this.props.status, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleReblogClick = (e) => {
|
handleReblogClick = (e) => {
|
||||||
|
|||||||
@@ -20,7 +20,7 @@ import { initMuteModal } from 'flavours/glitch/actions/mutes';
|
|||||||
import { initReport } from 'flavours/glitch/actions/reports';
|
import { initReport } from 'flavours/glitch/actions/reports';
|
||||||
import { openModal } from 'flavours/glitch/actions/modal';
|
import { openModal } from 'flavours/glitch/actions/modal';
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
import { boostModal, deleteModal } from 'flavours/glitch/util/initial_state';
|
import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/util/initial_state';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
|
deleteConfirm: { id: 'confirmations.delete.confirm', defaultMessage: 'Delete' },
|
||||||
@@ -78,11 +78,19 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
onFavourite (status) {
|
onModalFavourite (status) {
|
||||||
|
dispatch(favourite(status));
|
||||||
|
},
|
||||||
|
|
||||||
|
onFavourite (status, e) {
|
||||||
if (status.get('favourited')) {
|
if (status.get('favourited')) {
|
||||||
dispatch(unfavourite(status));
|
dispatch(unfavourite(status));
|
||||||
} else {
|
} else {
|
||||||
dispatch(favourite(status));
|
if (e.shiftKey || !favouriteModal) {
|
||||||
|
this.onModalFavourite(status);
|
||||||
|
} else {
|
||||||
|
dispatch(openModal('FAVOURITE', { status, onFavourite: this.onModalFavourite }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -63,9 +63,8 @@ export default class ActionBar extends React.PureComponent {
|
|||||||
if (account.get('id') === me) {
|
if (account.get('id') === me) {
|
||||||
menu.push({ text: intl.formatMessage(messages.edit_profile), href: '/settings/profile' });
|
menu.push({ text: intl.formatMessage(messages.edit_profile), href: '/settings/profile' });
|
||||||
} else {
|
} else {
|
||||||
const following = account.getIn(['relationship', 'following']);
|
if (account.getIn(['relationship', 'following'])) {
|
||||||
if (following) {
|
if (account.getIn(['relationship', 'showing_reblogs'])) {
|
||||||
if (following.get('reblogs')) {
|
|
||||||
menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
|
menu.push({ text: intl.formatMessage(messages.hideReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
|
||||||
} else {
|
} else {
|
||||||
menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
|
menu.push({ text: intl.formatMessage(messages.showReblogs, { name: account.get('username') }), action: this.props.onReblogToggle });
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||||||
},
|
},
|
||||||
|
|
||||||
onReblogToggle (account) {
|
onReblogToggle (account) {
|
||||||
if (account.getIn(['relationship', 'following', 'reblogs'])) {
|
if (account.getIn(['relationship', 'showing_reblogs'])) {
|
||||||
dispatch(followAccount(account.get('id'), false));
|
dispatch(followAccount(account.get('id'), false));
|
||||||
} else {
|
} else {
|
||||||
dispatch(followAccount(account.get('id'), true));
|
dispatch(followAccount(account.get('id'), true));
|
||||||
|
|||||||
@@ -112,7 +112,7 @@ export default class Compose extends React.PureComponent {
|
|||||||
|
|
||||||
<Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
|
<Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
|
||||||
{({ x }) =>
|
{({ x }) =>
|
||||||
<div className='drawer__inner darker' style={{ transform: `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>
|
<div className='drawer__inner darker scrollable optionally-scrollable' style={{ transform: `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>
|
||||||
<SearchResultsContainer />
|
<SearchResultsContainer />
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,6 +29,8 @@ const messages = defineMessages({
|
|||||||
info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' },
|
info: { id: 'navigation_bar.info', defaultMessage: 'Extended information' },
|
||||||
show_me_around: { id: 'getting_started.onboarding', defaultMessage: 'Show me around' },
|
show_me_around: { id: 'getting_started.onboarding', defaultMessage: 'Show me around' },
|
||||||
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' },
|
pins: { id: 'navigation_bar.pins', defaultMessage: 'Pinned toots' },
|
||||||
|
lists: { id: 'navigation_bar.lists', defaultMessage: 'Lists' },
|
||||||
|
keyboard_shortcuts: { id: 'navigation_bar.keyboard_shortcuts', defaultMessage: 'Keyboard shortcuts' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
@@ -87,6 +89,7 @@ export default class GettingStarted extends ImmutablePureComponent {
|
|||||||
navItems = navItems.concat([
|
navItems = navItems.concat([
|
||||||
<ColumnLink key='5' icon='star' text={intl.formatMessage(messages.favourites)} to='/favourites' />,
|
<ColumnLink key='5' icon='star' text={intl.formatMessage(messages.favourites)} to='/favourites' />,
|
||||||
<ColumnLink key='6' icon='thumb-tack' text={intl.formatMessage(messages.pins)} to='/pinned' />,
|
<ColumnLink key='6' icon='thumb-tack' text={intl.formatMessage(messages.pins)} to='/pinned' />,
|
||||||
|
<ColumnLink key='10' icon='bars' text={intl.formatMessage(messages.lists)} to='/lists' />,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (myAccount.get('locked')) {
|
if (myAccount.get('locked')) {
|
||||||
|
|||||||
@@ -0,0 +1,77 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { makeGetAccount } from 'flavours/glitch/selectors';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import Avatar from 'flavours/glitch/components/avatar';
|
||||||
|
import DisplayName from 'flavours/glitch/components/display_name';
|
||||||
|
import IconButton from 'flavours/glitch/components/icon_button';
|
||||||
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
|
import { removeFromListEditor, addToListEditor } from 'flavours/glitch/actions/lists';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
remove: { id: 'lists.account.remove', defaultMessage: 'Remove from list' },
|
||||||
|
add: { id: 'lists.account.add', defaultMessage: 'Add to list' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const makeMapStateToProps = () => {
|
||||||
|
const getAccount = makeGetAccount();
|
||||||
|
|
||||||
|
const mapStateToProps = (state, { accountId, added }) => ({
|
||||||
|
account: getAccount(state, accountId),
|
||||||
|
added: typeof added === 'undefined' ? state.getIn(['listEditor', 'accounts', 'items']).includes(accountId) : added,
|
||||||
|
});
|
||||||
|
|
||||||
|
return mapStateToProps;
|
||||||
|
};
|
||||||
|
|
||||||
|
const mapDispatchToProps = (dispatch, { accountId }) => ({
|
||||||
|
onRemove: () => dispatch(removeFromListEditor(accountId)),
|
||||||
|
onAdd: () => dispatch(addToListEditor(accountId)),
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(makeMapStateToProps, mapDispatchToProps)
|
||||||
|
@injectIntl
|
||||||
|
export default class Account extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
account: ImmutablePropTypes.map.isRequired,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
onRemove: PropTypes.func.isRequired,
|
||||||
|
onAdd: PropTypes.func.isRequired,
|
||||||
|
added: PropTypes.bool,
|
||||||
|
};
|
||||||
|
|
||||||
|
static defaultProps = {
|
||||||
|
added: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { account, intl, onRemove, onAdd, added } = this.props;
|
||||||
|
|
||||||
|
let button;
|
||||||
|
|
||||||
|
if (added) {
|
||||||
|
button = <IconButton icon='times' title={intl.formatMessage(messages.remove)} onClick={onRemove} />;
|
||||||
|
} else {
|
||||||
|
button = <IconButton icon='plus' title={intl.formatMessage(messages.add)} onClick={onAdd} />;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='account'>
|
||||||
|
<div className='account__wrapper'>
|
||||||
|
<div className='account__display-name'>
|
||||||
|
<div className='account__avatar-wrapper'><Avatar account={account} size={36} /></div>
|
||||||
|
<DisplayName account={account} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='account__relationship'>
|
||||||
|
{button}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
|
import { fetchListSuggestions, clearListSuggestions, changeListSuggestions } from '../../../actions/lists';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
search: { id: 'lists.search', defaultMessage: 'Search among people you follow' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
value: state.getIn(['listEditor', 'suggestions', 'value']),
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
onSubmit: value => dispatch(fetchListSuggestions(value)),
|
||||||
|
onClear: () => dispatch(clearListSuggestions()),
|
||||||
|
onChange: value => dispatch(changeListSuggestions(value)),
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(mapStateToProps, mapDispatchToProps)
|
||||||
|
@injectIntl
|
||||||
|
export default class Search extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
value: PropTypes.string.isRequired,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
onClear: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChange = e => {
|
||||||
|
this.props.onChange(e.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleKeyUp = e => {
|
||||||
|
if (e.keyCode === 13) {
|
||||||
|
this.props.onSubmit(this.props.value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClear = () => {
|
||||||
|
this.props.onClear();
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { value, intl } = this.props;
|
||||||
|
const hasValue = value.length > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='list-editor__search search'>
|
||||||
|
<label>
|
||||||
|
<span style={{ display: 'none' }}>{intl.formatMessage(messages.search)}</span>
|
||||||
|
|
||||||
|
<input
|
||||||
|
className='search__input'
|
||||||
|
type='text'
|
||||||
|
value={value}
|
||||||
|
onChange={this.handleChange}
|
||||||
|
onKeyUp={this.handleKeyUp}
|
||||||
|
placeholder={intl.formatMessage(messages.search)}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div role='button' tabIndex='0' className='search__icon' onClick={this.handleClear}>
|
||||||
|
<i className={classNames('fa fa-search', { active: !hasValue })} />
|
||||||
|
<i aria-label={intl.formatMessage(messages.search)} className={classNames('fa fa-times-circle', { active: hasValue })} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
80
app/javascript/flavours/glitch/features/list_editor/index.js
Normal file
80
app/javascript/flavours/glitch/features/list_editor/index.js
Normal file
@@ -0,0 +1,80 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { injectIntl } from 'react-intl';
|
||||||
|
import { setupListEditor, clearListSuggestions, resetListEditor } from 'flavours/glitch/actions/lists';
|
||||||
|
import Account from './components/account';
|
||||||
|
import Search from './components/search';
|
||||||
|
import Motion from 'flavours/glitch/util/optional_motion';
|
||||||
|
import spring from 'react-motion/lib/spring';
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
title: state.getIn(['listEditor', 'title']),
|
||||||
|
accountIds: state.getIn(['listEditor', 'accounts', 'items']),
|
||||||
|
searchAccountIds: state.getIn(['listEditor', 'suggestions', 'items']),
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
onInitialize: listId => dispatch(setupListEditor(listId)),
|
||||||
|
onClear: () => dispatch(clearListSuggestions()),
|
||||||
|
onReset: () => dispatch(resetListEditor()),
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(mapStateToProps, mapDispatchToProps)
|
||||||
|
@injectIntl
|
||||||
|
export default class ListEditor extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
listId: PropTypes.string.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
onInitialize: PropTypes.func.isRequired,
|
||||||
|
onClear: PropTypes.func.isRequired,
|
||||||
|
onReset: PropTypes.func.isRequired,
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
accountIds: ImmutablePropTypes.list.isRequired,
|
||||||
|
searchAccountIds: ImmutablePropTypes.list.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
const { onInitialize, listId } = this.props;
|
||||||
|
onInitialize(listId);
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
const { onReset } = this.props;
|
||||||
|
onReset();
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { title, accountIds, searchAccountIds, onClear } = this.props;
|
||||||
|
const showSearch = searchAccountIds.size > 0;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='modal-root__modal list-editor'>
|
||||||
|
<h4>{title}</h4>
|
||||||
|
|
||||||
|
<Search />
|
||||||
|
|
||||||
|
<div className='drawer__pager'>
|
||||||
|
<div className='drawer__inner list-editor__accounts'>
|
||||||
|
{accountIds.map(accountId => <Account key={accountId} accountId={accountId} added />)}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showSearch && <div role='button' tabIndex='-1' className='drawer__backdrop' onClick={onClear} />}
|
||||||
|
|
||||||
|
<Motion defaultStyle={{ x: -100 }} style={{ x: spring(showSearch ? 0 : -100, { stiffness: 210, damping: 20 }) }}>
|
||||||
|
{({ x }) =>
|
||||||
|
<div className='drawer__inner backdrop' style={{ transform: x === 0 ? null : `translateX(${x}%)`, visibility: x === -100 ? 'hidden' : 'visible' }}>
|
||||||
|
{searchAccountIds.map(accountId => <Account key={accountId} accountId={accountId} />)}
|
||||||
|
</div>
|
||||||
|
}
|
||||||
|
</Motion>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
170
app/javascript/flavours/glitch/features/list_timeline/index.js
Normal file
170
app/javascript/flavours/glitch/features/list_timeline/index.js
Normal file
@@ -0,0 +1,170 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import StatusListContainer from 'flavours/glitch/features/ui/containers/status_list_container';
|
||||||
|
import Column from 'flavours/glitch/components/column';
|
||||||
|
import ColumnHeader from 'flavours/glitch/components/column_header';
|
||||||
|
import { addColumn, removeColumn, moveColumn } from 'flavours/glitch/actions/columns';
|
||||||
|
import { FormattedMessage, defineMessages, injectIntl } from 'react-intl';
|
||||||
|
import { connectListStream } from 'flavours/glitch/actions/streaming';
|
||||||
|
import { refreshListTimeline, expandListTimeline } from 'flavours/glitch/actions/timelines';
|
||||||
|
import { fetchList, deleteList } from 'flavours/glitch/actions/lists';
|
||||||
|
import { openModal } from 'flavours/glitch/actions/modal';
|
||||||
|
import MissingIndicator from 'flavours/glitch/components/missing_indicator';
|
||||||
|
import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
deleteMessage: { id: 'confirmations.delete_list.message', defaultMessage: 'Are you sure you want to permanently delete this list?' },
|
||||||
|
deleteConfirm: { id: 'confirmations.delete_list.confirm', defaultMessage: 'Delete' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStateToProps = (state, props) => ({
|
||||||
|
list: state.getIn(['lists', props.params.id]),
|
||||||
|
hasUnread: state.getIn(['timelines', `list:${props.params.id}`, 'unread']) > 0,
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(mapStateToProps)
|
||||||
|
@injectIntl
|
||||||
|
export default class ListTimeline extends React.PureComponent {
|
||||||
|
|
||||||
|
static contextTypes = {
|
||||||
|
router: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
params: PropTypes.object.isRequired,
|
||||||
|
dispatch: PropTypes.func.isRequired,
|
||||||
|
columnId: PropTypes.string,
|
||||||
|
hasUnread: PropTypes.bool,
|
||||||
|
multiColumn: PropTypes.bool,
|
||||||
|
list: PropTypes.oneOfType([ImmutablePropTypes.map, PropTypes.bool]),
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
handlePin = () => {
|
||||||
|
const { columnId, dispatch } = this.props;
|
||||||
|
|
||||||
|
if (columnId) {
|
||||||
|
dispatch(removeColumn(columnId));
|
||||||
|
} else {
|
||||||
|
dispatch(addColumn('LIST', { id: this.props.params.id }));
|
||||||
|
this.context.router.history.push('/');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
handleMove = (dir) => {
|
||||||
|
const { columnId, dispatch } = this.props;
|
||||||
|
dispatch(moveColumn(columnId, dir));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleHeaderClick = () => {
|
||||||
|
this.column.scrollTop();
|
||||||
|
}
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
const { dispatch } = this.props;
|
||||||
|
const { id } = this.props.params;
|
||||||
|
|
||||||
|
dispatch(fetchList(id));
|
||||||
|
dispatch(refreshListTimeline(id));
|
||||||
|
|
||||||
|
this.disconnect = dispatch(connectListStream(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
componentWillUnmount () {
|
||||||
|
if (this.disconnect) {
|
||||||
|
this.disconnect();
|
||||||
|
this.disconnect = null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setRef = c => {
|
||||||
|
this.column = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
handleLoadMore = () => {
|
||||||
|
const { id } = this.props.params;
|
||||||
|
this.props.dispatch(expandListTimeline(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleEditClick = () => {
|
||||||
|
this.props.dispatch(openModal('LIST_EDITOR', { listId: this.props.params.id }));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleDeleteClick = () => {
|
||||||
|
const { dispatch, columnId, intl } = this.props;
|
||||||
|
const { id } = this.props.params;
|
||||||
|
|
||||||
|
dispatch(openModal('CONFIRM', {
|
||||||
|
message: intl.formatMessage(messages.deleteMessage),
|
||||||
|
confirm: intl.formatMessage(messages.deleteConfirm),
|
||||||
|
onConfirm: () => {
|
||||||
|
dispatch(deleteList(id));
|
||||||
|
|
||||||
|
if (!!columnId) {
|
||||||
|
dispatch(removeColumn(columnId));
|
||||||
|
} else {
|
||||||
|
this.context.router.history.push('/lists');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { hasUnread, columnId, multiColumn, list } = this.props;
|
||||||
|
const { id } = this.props.params;
|
||||||
|
const pinned = !!columnId;
|
||||||
|
const title = list ? list.get('title') : id;
|
||||||
|
|
||||||
|
if (typeof list === 'undefined') {
|
||||||
|
return (
|
||||||
|
<Column>
|
||||||
|
<LoadingIndicator />
|
||||||
|
</Column>
|
||||||
|
);
|
||||||
|
} else if (list === false) {
|
||||||
|
return (
|
||||||
|
<Column>
|
||||||
|
<MissingIndicator />
|
||||||
|
</Column>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Column ref={this.setRef}>
|
||||||
|
<ColumnHeader
|
||||||
|
icon='bars'
|
||||||
|
active={hasUnread}
|
||||||
|
title={title}
|
||||||
|
onPin={this.handlePin}
|
||||||
|
onMove={this.handleMove}
|
||||||
|
onClick={this.handleHeaderClick}
|
||||||
|
pinned={pinned}
|
||||||
|
multiColumn={multiColumn}
|
||||||
|
>
|
||||||
|
<div className='column-header__links'>
|
||||||
|
<button className='text-btn column-header__setting-btn' tabIndex='0' onClick={this.handleEditClick}>
|
||||||
|
<i className='fa fa-pencil' /> <FormattedMessage id='lists.edit' defaultMessage='Edit list' />
|
||||||
|
</button>
|
||||||
|
|
||||||
|
<button className='text-btn column-header__setting-btn' tabIndex='0' onClick={this.handleDeleteClick}>
|
||||||
|
<i className='fa fa-trash' /> <FormattedMessage id='lists.delete' defaultMessage='Delete list' />
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<hr />
|
||||||
|
</ColumnHeader>
|
||||||
|
|
||||||
|
<StatusListContainer
|
||||||
|
trackScroll={!pinned}
|
||||||
|
scrollKey={`list_timeline-${columnId}`}
|
||||||
|
timelineId={`list:${id}`}
|
||||||
|
loadMore={this.handleLoadMore}
|
||||||
|
emptyMessage={<FormattedMessage id='empty_column.list' defaultMessage='There is nothing in this list yet.' />}
|
||||||
|
/>
|
||||||
|
</Column>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,78 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { changeListEditorTitle, submitListEditor } from 'flavours/glitch/actions/lists';
|
||||||
|
import IconButton from 'flavours/glitch/components/icon_button';
|
||||||
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
label: { id: 'lists.new.title_placeholder', defaultMessage: 'New list title' },
|
||||||
|
title: { id: 'lists.new.create', defaultMessage: 'Add list' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
value: state.getIn(['listEditor', 'title']),
|
||||||
|
disabled: state.getIn(['listEditor', 'isSubmitting']),
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
onChange: value => dispatch(changeListEditorTitle(value)),
|
||||||
|
onSubmit: () => dispatch(submitListEditor(true)),
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(mapStateToProps, mapDispatchToProps)
|
||||||
|
@injectIntl
|
||||||
|
export default class NewListForm extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
value: PropTypes.string.isRequired,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
onChange: PropTypes.func.isRequired,
|
||||||
|
onSubmit: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
handleChange = e => {
|
||||||
|
this.props.onChange(e.target.value);
|
||||||
|
}
|
||||||
|
|
||||||
|
handleSubmit = e => {
|
||||||
|
e.preventDefault();
|
||||||
|
this.props.onSubmit();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleClick = () => {
|
||||||
|
this.props.onSubmit();
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { value, disabled, intl } = this.props;
|
||||||
|
|
||||||
|
const label = intl.formatMessage(messages.label);
|
||||||
|
const title = intl.formatMessage(messages.title);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form className='column-inline-form' onSubmit={this.handleSubmit}>
|
||||||
|
<label>
|
||||||
|
<span style={{ display: 'none' }}>{label}</span>
|
||||||
|
|
||||||
|
<input
|
||||||
|
className='setting-text'
|
||||||
|
value={value}
|
||||||
|
disabled={disabled}
|
||||||
|
onChange={this.handleChange}
|
||||||
|
placeholder={label}
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<IconButton
|
||||||
|
disabled={disabled}
|
||||||
|
icon='plus'
|
||||||
|
title={title}
|
||||||
|
onClick={this.handleClick}
|
||||||
|
/>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
76
app/javascript/flavours/glitch/features/lists/index.js
Normal file
76
app/javascript/flavours/glitch/features/lists/index.js
Normal file
@@ -0,0 +1,76 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import LoadingIndicator from 'flavours/glitch/components/loading_indicator';
|
||||||
|
import Column from 'flavours/glitch/features/ui/components/column';
|
||||||
|
import ColumnBackButtonSlim from 'flavours/glitch/components/column_back_button_slim';
|
||||||
|
import { fetchLists } from 'flavours/glitch/actions/lists';
|
||||||
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import ColumnLink from 'flavours/glitch/features/ui/components/column_link';
|
||||||
|
import ColumnSubheading from 'flavours/glitch/features/ui/components/column_subheading';
|
||||||
|
import NewListForm from './components/new_list_form';
|
||||||
|
import { createSelector } from 'reselect';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
heading: { id: 'column.lists', defaultMessage: 'Lists' },
|
||||||
|
subheading: { id: 'lists.subheading', defaultMessage: 'Your lists' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const getOrderedLists = createSelector([state => state.get('lists')], lists => {
|
||||||
|
if (!lists) {
|
||||||
|
return lists;
|
||||||
|
}
|
||||||
|
|
||||||
|
return lists.toList().filter(item => !!item).sort((a, b) => a.get('title').localeCompare(b.get('title')));
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
lists: getOrderedLists(state),
|
||||||
|
});
|
||||||
|
|
||||||
|
@connect(mapStateToProps)
|
||||||
|
@injectIntl
|
||||||
|
export default class Lists extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
params: PropTypes.object.isRequired,
|
||||||
|
dispatch: PropTypes.func.isRequired,
|
||||||
|
lists: ImmutablePropTypes.list,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentWillMount () {
|
||||||
|
this.props.dispatch(fetchLists());
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { intl, lists } = this.props;
|
||||||
|
|
||||||
|
if (!lists) {
|
||||||
|
return (
|
||||||
|
<Column>
|
||||||
|
<LoadingIndicator />
|
||||||
|
</Column>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<Column icon='bars' heading={intl.formatMessage(messages.heading)}>
|
||||||
|
<ColumnBackButtonSlim />
|
||||||
|
|
||||||
|
<NewListForm />
|
||||||
|
|
||||||
|
<div className='scrollable'>
|
||||||
|
<ColumnSubheading text={intl.formatMessage(messages.subheading)} />
|
||||||
|
|
||||||
|
{lists.map(list =>
|
||||||
|
<ColumnLink key={list.get('id')} to={`/timelines/list/${list.get('id')}`} icon='bars' text={list.get('title')} />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</Column>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -10,9 +10,6 @@ import LocalSettingsNavigation from './navigation';
|
|||||||
import { closeModal } from 'flavours/glitch/actions/modal';
|
import { closeModal } from 'flavours/glitch/actions/modal';
|
||||||
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings';
|
import { changeLocalSetting } from 'flavours/glitch/actions/local_settings';
|
||||||
|
|
||||||
// Stylesheet imports
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
settings: state.get('local_settings'),
|
settings: state.get('local_settings'),
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -6,9 +6,6 @@ import { injectIntl, defineMessages } from 'react-intl';
|
|||||||
// Our imports
|
// Our imports
|
||||||
import LocalSettingsNavigationItem from './item';
|
import LocalSettingsNavigationItem from './item';
|
||||||
|
|
||||||
// Stylesheet imports
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
// Stylesheet imports
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
export default class LocalSettingsPage extends React.PureComponent {
|
export default class LocalSettingsPage extends React.PureComponent {
|
||||||
|
|||||||
@@ -1,27 +0,0 @@
|
|||||||
@import 'styles/mastodon/variables';
|
|
||||||
|
|
||||||
.glitch.local-settings__navigation__item {
|
|
||||||
display: block;
|
|
||||||
padding: 15px 20px;
|
|
||||||
color: inherit;
|
|
||||||
background: $primary-text-color;
|
|
||||||
border-bottom: 1px $ui-primary-color solid;
|
|
||||||
cursor: pointer;
|
|
||||||
text-decoration: none;
|
|
||||||
outline: none;
|
|
||||||
transition: background .3s;
|
|
||||||
|
|
||||||
&:hover {
|
|
||||||
background: $ui-secondary-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.active {
|
|
||||||
background: $ui-highlight-color;
|
|
||||||
color: $primary-text-color;
|
|
||||||
}
|
|
||||||
|
|
||||||
&.close, &.close:hover {
|
|
||||||
background: $error-value-color;
|
|
||||||
color: $primary-text-color;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
@import 'styles/mastodon/variables';
|
|
||||||
|
|
||||||
.glitch.local-settings__navigation {
|
|
||||||
background: $primary-text-color;
|
|
||||||
color: $ui-base-color;
|
|
||||||
width: 200px;
|
|
||||||
font-size: 15px;
|
|
||||||
line-height: 20px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
@@ -7,9 +7,6 @@ import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
|||||||
// Our imports
|
// Our imports
|
||||||
import LocalSettingsPageItem from './item';
|
import LocalSettingsPageItem from './item';
|
||||||
|
|
||||||
// Stylesheet imports
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
|
|||||||
@@ -3,9 +3,6 @@ import React from 'react';
|
|||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
|
||||||
// Stylesheet imports
|
|
||||||
import './style.scss';
|
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
export default class LocalSettingsPageItem extends React.PureComponent {
|
export default class LocalSettingsPageItem extends React.PureComponent {
|
||||||
|
|||||||
@@ -1,7 +0,0 @@
|
|||||||
@import 'styles/mastodon/variables';
|
|
||||||
|
|
||||||
.glitch.local-settings__page__item {
|
|
||||||
select {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
@import 'styles/mastodon/variables';
|
|
||||||
|
|
||||||
.glitch.local-settings__page {
|
|
||||||
display: block;
|
|
||||||
flex: auto;
|
|
||||||
padding: 15px 20px 15px 20px;
|
|
||||||
width: 360px;
|
|
||||||
overflow-y: auto;
|
|
||||||
}
|
|
||||||
@@ -1,34 +0,0 @@
|
|||||||
@import 'styles/mastodon/variables';
|
|
||||||
|
|
||||||
.glitch.local-settings {
|
|
||||||
position: relative;
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
background: $ui-secondary-color;
|
|
||||||
color: $ui-base-color;
|
|
||||||
border-radius: 8px;
|
|
||||||
height: 80vh;
|
|
||||||
width: 80vw;
|
|
||||||
max-width: 740px;
|
|
||||||
max-height: 450px;
|
|
||||||
overflow: hidden;
|
|
||||||
|
|
||||||
label {
|
|
||||||
display: block;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
font-size: 18px;
|
|
||||||
font-weight: 500;
|
|
||||||
line-height: 24px;
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2 {
|
|
||||||
font-size: 15px;
|
|
||||||
font-weight: 500;
|
|
||||||
line-height: 20px;
|
|
||||||
margin-top: 20px;
|
|
||||||
margin-bottom: 10px;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -48,8 +48,8 @@ export default class ActionBar extends React.PureComponent {
|
|||||||
this.props.onReblog(this.props.status, e);
|
this.props.onReblog(this.props.status, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleFavouriteClick = () => {
|
handleFavouriteClick = (e) => {
|
||||||
this.props.onFavourite(this.props.status);
|
this.props.onFavourite(this.props.status, e);
|
||||||
}
|
}
|
||||||
|
|
||||||
handleDeleteClick = () => {
|
handleDeleteClick = () => {
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ import { openModal } from 'flavours/glitch/actions/modal';
|
|||||||
import { defineMessages, injectIntl } from 'react-intl';
|
import { defineMessages, injectIntl } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import { HotKeys } from 'react-hotkeys';
|
import { HotKeys } from 'react-hotkeys';
|
||||||
import { boostModal, deleteModal } from 'flavours/glitch/util/initial_state';
|
import { boostModal, favouriteModal, deleteModal } from 'flavours/glitch/util/initial_state';
|
||||||
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from 'flavours/glitch/util/fullscreen';
|
import { attachFullscreenListener, detachFullscreenListener, isFullscreen } from 'flavours/glitch/util/fullscreen';
|
||||||
|
|
||||||
const messages = defineMessages({
|
const messages = defineMessages({
|
||||||
@@ -95,11 +95,19 @@ export default class Status extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
handleFavouriteClick = (status) => {
|
handleModalFavourite = (status) => {
|
||||||
|
this.props.dispatch(favourite(status));
|
||||||
|
}
|
||||||
|
|
||||||
|
handleFavouriteClick = (status, e) => {
|
||||||
if (status.get('favourited')) {
|
if (status.get('favourited')) {
|
||||||
this.props.dispatch(unfavourite(status));
|
this.props.dispatch(unfavourite(status));
|
||||||
} else {
|
} else {
|
||||||
this.props.dispatch(favourite(status));
|
if (e.shiftKey || !favouriteModal) {
|
||||||
|
this.handleModalFavourite(status);
|
||||||
|
} else {
|
||||||
|
this.props.dispatch(openModal('FAVOURITE', { status, onFavourite: this.handleModalFavourite }));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ import BundleContainer from '../containers/bundle_container';
|
|||||||
import ColumnLoading from './column_loading';
|
import ColumnLoading from './column_loading';
|
||||||
import DrawerLoading from './drawer_loading';
|
import DrawerLoading from './drawer_loading';
|
||||||
import BundleColumnError from './bundle_column_error';
|
import BundleColumnError from './bundle_column_error';
|
||||||
import { Compose, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses } from 'flavours/glitch/util/async-components';
|
import { Compose, Notifications, HomeTimeline, CommunityTimeline, PublicTimeline, HashtagTimeline, DirectTimeline, FavouritedStatuses, ListTimeline } from 'flavours/glitch/util/async-components';
|
||||||
|
|
||||||
import detectPassiveEvents from 'detect-passive-events';
|
import detectPassiveEvents from 'detect-passive-events';
|
||||||
import { scrollRight } from 'flavours/glitch/util/scroll';
|
import { scrollRight } from 'flavours/glitch/util/scroll';
|
||||||
@@ -25,6 +25,7 @@ const componentMap = {
|
|||||||
'HASHTAG': HashtagTimeline,
|
'HASHTAG': HashtagTimeline,
|
||||||
'DIRECT': DirectTimeline,
|
'DIRECT': DirectTimeline,
|
||||||
'FAVOURITES': FavouritedStatuses,
|
'FAVOURITES': FavouritedStatuses,
|
||||||
|
'LIST': ListTimeline,
|
||||||
};
|
};
|
||||||
|
|
||||||
@component => injectIntl(component, { withRef: true })
|
@component => injectIntl(component, { withRef: true })
|
||||||
|
|||||||
@@ -0,0 +1,84 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
|
import Button from 'flavours/glitch/components/button';
|
||||||
|
import StatusContent from 'flavours/glitch/components/status_content';
|
||||||
|
import Avatar from 'flavours/glitch/components/avatar';
|
||||||
|
import RelativeTimestamp from 'flavours/glitch/components/relative_timestamp';
|
||||||
|
import DisplayName from 'flavours/glitch/components/display_name';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
favourite: { id: 'status.favourite', defaultMessage: 'Favourite' },
|
||||||
|
});
|
||||||
|
|
||||||
|
@injectIntl
|
||||||
|
export default class FavouriteModal extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
static contextTypes = {
|
||||||
|
router: PropTypes.object,
|
||||||
|
};
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
status: ImmutablePropTypes.map.isRequired,
|
||||||
|
onFavourite: PropTypes.func.isRequired,
|
||||||
|
onClose: PropTypes.func.isRequired,
|
||||||
|
intl: PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount() {
|
||||||
|
this.button.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleFavourite = () => {
|
||||||
|
this.props.onFavourite(this.props.status);
|
||||||
|
this.props.onClose();
|
||||||
|
}
|
||||||
|
|
||||||
|
handleAccountClick = (e) => {
|
||||||
|
if (e.button === 0) {
|
||||||
|
e.preventDefault();
|
||||||
|
this.props.onClose();
|
||||||
|
this.context.router.history.push(`/accounts/${this.props.status.getIn(['account', 'id'])}`);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setRef = (c) => {
|
||||||
|
this.button = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { status, intl } = this.props;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='modal-root__modal favourite-modal'>
|
||||||
|
<div className='favourite-modal__container'>
|
||||||
|
<div className='status light'>
|
||||||
|
<div className='favourite-modal__status-header'>
|
||||||
|
<div className='favourite-modal__status-time'>
|
||||||
|
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener'><RelativeTimestamp timestamp={status.get('created_at')} /></a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<a onClick={this.handleAccountClick} href={status.getIn(['account', 'url'])} className='status__display-name'>
|
||||||
|
<div className='status__avatar'>
|
||||||
|
<Avatar account={status.get('account')} size={48} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<DisplayName account={status.get('account')} />
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<StatusContent status={status} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='favourite-modal__action-bar'>
|
||||||
|
<div><FormattedMessage id='favourite_modal.combo' defaultMessage='You can press {combo} to skip this next time' values={{ combo: <span>Shift + <i className='fa fa-star' /></span> }} /></div>
|
||||||
|
<Button text={intl.formatMessage(messages.favourite)} onClick={this.handleFavourite} ref={this.setRef} />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import ActionsModal from './actions_modal';
|
|||||||
import MediaModal from './media_modal';
|
import MediaModal from './media_modal';
|
||||||
import VideoModal from './video_modal';
|
import VideoModal from './video_modal';
|
||||||
import BoostModal from './boost_modal';
|
import BoostModal from './boost_modal';
|
||||||
|
import FavouriteModal from './favourite_modal';
|
||||||
import DoodleModal from './doodle_modal';
|
import DoodleModal from './doodle_modal';
|
||||||
import ConfirmationModal from './confirmation_modal';
|
import ConfirmationModal from './confirmation_modal';
|
||||||
import {
|
import {
|
||||||
@@ -15,6 +16,7 @@ import {
|
|||||||
ReportModal,
|
ReportModal,
|
||||||
SettingsModal,
|
SettingsModal,
|
||||||
EmbedModal,
|
EmbedModal,
|
||||||
|
ListEditor,
|
||||||
} from 'flavours/glitch/util/async-components';
|
} from 'flavours/glitch/util/async-components';
|
||||||
|
|
||||||
const MODAL_COMPONENTS = {
|
const MODAL_COMPONENTS = {
|
||||||
@@ -22,6 +24,7 @@ const MODAL_COMPONENTS = {
|
|||||||
'ONBOARDING': OnboardingModal,
|
'ONBOARDING': OnboardingModal,
|
||||||
'VIDEO': () => Promise.resolve({ default: VideoModal }),
|
'VIDEO': () => Promise.resolve({ default: VideoModal }),
|
||||||
'BOOST': () => Promise.resolve({ default: BoostModal }),
|
'BOOST': () => Promise.resolve({ default: BoostModal }),
|
||||||
|
'FAVOURITE': () => Promise.resolve({ default: FavouriteModal }),
|
||||||
'DOODLE': () => Promise.resolve({ default: DoodleModal }),
|
'DOODLE': () => Promise.resolve({ default: DoodleModal }),
|
||||||
'CONFIRM': () => Promise.resolve({ default: ConfirmationModal }),
|
'CONFIRM': () => Promise.resolve({ default: ConfirmationModal }),
|
||||||
'MUTE': MuteModal,
|
'MUTE': MuteModal,
|
||||||
@@ -29,6 +32,7 @@ const MODAL_COMPONENTS = {
|
|||||||
'SETTINGS': SettingsModal,
|
'SETTINGS': SettingsModal,
|
||||||
'ACTIONS': () => Promise.resolve({ default: ActionsModal }),
|
'ACTIONS': () => Promise.resolve({ default: ActionsModal }),
|
||||||
'EMBED': EmbedModal,
|
'EMBED': EmbedModal,
|
||||||
|
'LIST_EDITOR': ListEditor,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default class ModalRoot extends React.PureComponent {
|
export default class ModalRoot extends React.PureComponent {
|
||||||
@@ -90,7 +94,7 @@ export default class ModalRoot extends React.PureComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
renderLoading = modalId => () => {
|
renderLoading = modalId => () => {
|
||||||
return ['MEDIA', 'VIDEO', 'BOOST', 'DOODLE', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
|
return ['MEDIA', 'VIDEO', 'BOOST', 'FAVOURITE', 'DOODLE', 'CONFIRM', 'ACTIONS'].indexOf(modalId) === -1 ? <ModalLoading /> : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
renderError = (props) => {
|
renderError = (props) => {
|
||||||
|
|||||||
@@ -35,9 +35,11 @@ import {
|
|||||||
FollowRequests,
|
FollowRequests,
|
||||||
GenericNotFound,
|
GenericNotFound,
|
||||||
FavouritedStatuses,
|
FavouritedStatuses,
|
||||||
|
ListTimeline,
|
||||||
Blocks,
|
Blocks,
|
||||||
Mutes,
|
Mutes,
|
||||||
PinnedStatuses,
|
PinnedStatuses,
|
||||||
|
Lists,
|
||||||
} from 'flavours/glitch/util/async-components';
|
} from 'flavours/glitch/util/async-components';
|
||||||
import { HotKeys } from 'react-hotkeys';
|
import { HotKeys } from 'react-hotkeys';
|
||||||
import { me } from 'flavours/glitch/util/initial_state';
|
import { me } from 'flavours/glitch/util/initial_state';
|
||||||
@@ -407,7 +409,7 @@ export default class UI extends React.Component {
|
|||||||
<WrappedRoute path='/timelines/public/local' component={CommunityTimeline} content={children} />
|
<WrappedRoute path='/timelines/public/local' component={CommunityTimeline} content={children} />
|
||||||
<WrappedRoute path='/timelines/direct' component={DirectTimeline} content={children} />
|
<WrappedRoute path='/timelines/direct' component={DirectTimeline} content={children} />
|
||||||
<WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} />
|
<WrappedRoute path='/timelines/tag/:id' component={HashtagTimeline} content={children} />
|
||||||
|
<WrappedRoute path='/timelines/list/:id' component={ListTimeline} content={children} />
|
||||||
<WrappedRoute path='/notifications' component={Notifications} content={children} />
|
<WrappedRoute path='/notifications' component={Notifications} content={children} />
|
||||||
<WrappedRoute path='/favourites' component={FavouritedStatuses} content={children} />
|
<WrappedRoute path='/favourites' component={FavouritedStatuses} content={children} />
|
||||||
<WrappedRoute path='/pinned' component={PinnedStatuses} content={children} />
|
<WrappedRoute path='/pinned' component={PinnedStatuses} content={children} />
|
||||||
@@ -425,6 +427,7 @@ export default class UI extends React.Component {
|
|||||||
<WrappedRoute path='/follow_requests' component={FollowRequests} content={children} />
|
<WrappedRoute path='/follow_requests' component={FollowRequests} content={children} />
|
||||||
<WrappedRoute path='/blocks' component={Blocks} content={children} />
|
<WrappedRoute path='/blocks' component={Blocks} content={children} />
|
||||||
<WrappedRoute path='/mutes' component={Mutes} content={children} />
|
<WrappedRoute path='/mutes' component={Mutes} content={children} />
|
||||||
|
<WrappedRoute path='/lists' component={Lists} content={children} />
|
||||||
|
|
||||||
<WrappedRoute component={GenericNotFound} content={children} />
|
<WrappedRoute component={GenericNotFound} content={children} />
|
||||||
</WrappedSwitch>
|
</WrappedSwitch>
|
||||||
|
|||||||
BIN
app/javascript/flavours/glitch/images/glitch-preview.jpg
Normal file
BIN
app/javascript/flavours/glitch/images/glitch-preview.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 193 KiB |
7
app/javascript/flavours/glitch/locales/ar.js
Normal file
7
app/javascript/flavours/glitch/locales/ar.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/ar.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/bg.js
Normal file
7
app/javascript/flavours/glitch/locales/bg.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/bg.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/ca.js
Normal file
7
app/javascript/flavours/glitch/locales/ca.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/ca.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/de.js
Normal file
7
app/javascript/flavours/glitch/locales/de.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/de.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
52
app/javascript/flavours/glitch/locales/en.js
Normal file
52
app/javascript/flavours/glitch/locales/en.js
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
import inherited from 'mastodon/locales/en.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
'getting_started.open_source_notice': 'Glitchsoc is free open source software forked from {Mastodon}. You can contribute or report issues on GitHub at {github}.',
|
||||||
|
'layout.auto': 'Auto',
|
||||||
|
'layout.current_is': 'Your current layout is:',
|
||||||
|
'layout.desktop': 'Desktop',
|
||||||
|
'layout.mobile': 'Mobile',
|
||||||
|
'navigation_bar.app_settings': 'App settings',
|
||||||
|
'getting_started.onboarding': 'Show me around',
|
||||||
|
'onboarding.page_one.federation': '{domain} is an \'instance\' of Mastodon. Mastodon is a network of independent servers joining up to make one larger social network. We call these servers instances.',
|
||||||
|
'onboarding.page_one.welcome': 'Welcome to {domain}!',
|
||||||
|
'onboarding.page_six.github': '{domain} runs on Glitchsoc. Glitchsoc is a friendly {fork} of {Mastodon}, and is compatible with any Mastodon instance or app. Glitchsoc is entirely free and open-source. You can report bugs, request features, or contribute to the code on {github}.',
|
||||||
|
'settings.auto_collapse': 'Automatic collapsing',
|
||||||
|
'settings.auto_collapse_all': 'Everything',
|
||||||
|
'settings.auto_collapse_lengthy': 'Lengthy toots',
|
||||||
|
'settings.auto_collapse_media': 'Toots with media',
|
||||||
|
'settings.auto_collapse_notifications': 'Notifications',
|
||||||
|
'settings.auto_collapse_reblogs': 'Boosts',
|
||||||
|
'settings.auto_collapse_replies': 'Replies',
|
||||||
|
'settings.close': 'Close',
|
||||||
|
'settings.collapsed_statuses': 'Collapsed toots',
|
||||||
|
'settings.enable_collapsed': 'Enable collapsed toots',
|
||||||
|
'settings.general': 'General',
|
||||||
|
'settings.image_backgrounds': 'Image backgrounds',
|
||||||
|
'settings.image_backgrounds_media': 'Preview collapsed toot media',
|
||||||
|
'settings.image_backgrounds_users': 'Give collapsed toots an image background',
|
||||||
|
'settings.media': 'Media',
|
||||||
|
'settings.media_letterbox': 'Letterbox media',
|
||||||
|
'settings.media_fullwidth': 'Full-width media previews',
|
||||||
|
'settings.preferences': 'User preferences',
|
||||||
|
'settings.wide_view': 'Wide view (Desktop mode only)',
|
||||||
|
'settings.navbar_under': 'Navbar at the bottom (Mobile only)',
|
||||||
|
'status.collapse': 'Collapse',
|
||||||
|
'status.uncollapse': 'Uncollapse',
|
||||||
|
|
||||||
|
'favourite_modal.combo': 'You can press {combo} to skip this next time',
|
||||||
|
|
||||||
|
'home.column_settings.show_direct': 'Show DMs',
|
||||||
|
|
||||||
|
'notification.markForDeletion': 'Mark for deletion',
|
||||||
|
'notifications.clear': 'Clear all my notifications',
|
||||||
|
'notifications.marked_clear_confirmation': 'Are you sure you want to permanently clear all selected notifications?',
|
||||||
|
'notifications.marked_clear': 'Clear selected notifications',
|
||||||
|
|
||||||
|
'notification_purge.btn_all': 'Select\nall',
|
||||||
|
'notification_purge.btn_none': 'Select\nnone',
|
||||||
|
'notification_purge.btn_invert': 'Invert\nselection',
|
||||||
|
'notification_purge.btn_apply': 'Clear\nselected',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/eo.js
Normal file
7
app/javascript/flavours/glitch/locales/eo.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/eo.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/es.js
Normal file
7
app/javascript/flavours/glitch/locales/es.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/es.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/fa.js
Normal file
7
app/javascript/flavours/glitch/locales/fa.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/fa.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/fi.js
Normal file
7
app/javascript/flavours/glitch/locales/fi.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/fi.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/fr.js
Normal file
7
app/javascript/flavours/glitch/locales/fr.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/fr.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/he.js
Normal file
7
app/javascript/flavours/glitch/locales/he.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/he.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/hr.js
Normal file
7
app/javascript/flavours/glitch/locales/hr.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/hr.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/hu.js
Normal file
7
app/javascript/flavours/glitch/locales/hu.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/hu.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/id.js
Normal file
7
app/javascript/flavours/glitch/locales/id.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/id.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/io.js
Normal file
7
app/javascript/flavours/glitch/locales/io.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/io.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/it.js
Normal file
7
app/javascript/flavours/glitch/locales/it.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/it.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
55
app/javascript/flavours/glitch/locales/ja.js
Normal file
55
app/javascript/flavours/glitch/locales/ja.js
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
import inherited from 'mastodon/locales/ja.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
'getting_started.open_source_notice': 'Glitchsocは{Mastodon}によるフリーなオープンソースソフトウェアです。誰でもGitHub({github})から開発に參加したり、問題を報告したりできます。',
|
||||||
|
'layout.auto': '自動',
|
||||||
|
'layout.current_is': 'あなたの現在のレイアウト:',
|
||||||
|
'layout.desktop': 'Desktop',
|
||||||
|
'layout.mobile': 'Mobile',
|
||||||
|
'navigation_bar.app_settings': 'アプリ設定',
|
||||||
|
'getting_started.onboarding': '解説を表示',
|
||||||
|
'onboarding.page_one.federation': '{domain}はMastodonのインスタンスです。Mastodonとは、独立したサーバが連携して作るソーシャルネットワークです。これらのサーバーをインスタンスと呼びます。',
|
||||||
|
'onboarding.page_one.welcome': '{domain}へようこそ!',
|
||||||
|
'onboarding.page_six.github': '{domain}はGlitchsocを使用しています。Glitchsocは{Mastodon}のフレンドリーな{fork}で、どんなMastodonアプリやインスタンスとも互換性があります。Glitchsocは完全に無料で、オープンソースです。{github}でバグ報告や機能要望あるいは貢獻をすることが可能です。',
|
||||||
|
'settings.auto_collapse': '自動折りたたみ',
|
||||||
|
'settings.auto_collapse_all': 'すべて',
|
||||||
|
'settings.auto_collapse_lengthy': '長いトゥート',
|
||||||
|
'settings.auto_collapse_media': 'メディア付きトゥート',
|
||||||
|
'settings.auto_collapse_notifications': '通知',
|
||||||
|
'settings.auto_collapse_reblogs': 'ブースト',
|
||||||
|
'settings.auto_collapse_replies': '返信',
|
||||||
|
'settings.close': '閉じる',
|
||||||
|
'settings.collapsed_statuses': 'トゥート',
|
||||||
|
'settings.enable_collapsed': 'トゥート折りたたみを有効にする',
|
||||||
|
'settings.general': '一般',
|
||||||
|
'settings.image_backgrounds': '画像背景',
|
||||||
|
'settings.image_backgrounds_media': '折りたまれたメディア付きトゥートをプレビュー',
|
||||||
|
'settings.image_backgrounds_users': '折りたまれたトゥートの背景を変更する',
|
||||||
|
'settings.media': 'メディア',
|
||||||
|
'settings.media_letterbox': 'メディアをレターボックス式で表示',
|
||||||
|
'settings.media_fullwidth': '全幅メディアプレビュー',
|
||||||
|
'settings.preferences': 'ユーザー設定',
|
||||||
|
'settings.wide_view': 'ワイドビュー(Desktopレイアウトのみ)',
|
||||||
|
'settings.navbar_under': 'ナビを画面下部に移動させる(Mobileレイアウトのみ)',
|
||||||
|
'settings.compose_box_opts': 'コンポーズボックス設定',
|
||||||
|
'settings.side_arm': 'セカンダリートゥートボタン',
|
||||||
|
'settings.layout': 'レイアウト',
|
||||||
|
'status.collapse': '折りたたむ',
|
||||||
|
'status.uncollapse': '折りたたみを解除',
|
||||||
|
|
||||||
|
'favourite_modal.combo': '次からは {combo} を押せば、これをスキップできます。',
|
||||||
|
|
||||||
|
'home.column_settings.show_direct': 'DMを表示',
|
||||||
|
|
||||||
|
'notification.markForDeletion': '選択',
|
||||||
|
'notifications.clear': '通知を全てクリアする',
|
||||||
|
'notifications.marked_clear_confirmation': '削除した全ての通知を完全に削除してもよろしいですか?',
|
||||||
|
'notifications.marked_clear': '選択した通知を削除する',
|
||||||
|
|
||||||
|
'notification_purge.btn_all': 'すべて\n選択',
|
||||||
|
'notification_purge.btn_none': '選択\n解除',
|
||||||
|
'notification_purge.btn_invert': '選択を\n反転',
|
||||||
|
'notification_purge.btn_apply': '選択したものを\n削除',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/ko.js
Normal file
7
app/javascript/flavours/glitch/locales/ko.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/ko.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/nl.js
Normal file
7
app/javascript/flavours/glitch/locales/nl.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/nl.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/no.js
Normal file
7
app/javascript/flavours/glitch/locales/no.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/no.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/oc.js
Normal file
7
app/javascript/flavours/glitch/locales/oc.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/oc.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
48
app/javascript/flavours/glitch/locales/pl.js
Normal file
48
app/javascript/flavours/glitch/locales/pl.js
Normal file
@@ -0,0 +1,48 @@
|
|||||||
|
import inherited from 'mastodon/locales/pl.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
'getting_started.open_source_notice': 'Glitchsoc jest wolnym i otwartoźródłowym forkiem oprogramowania {Mastodon}. Możesz współtworzyć projekt lub zgłaszać błędy na GitHubie pod adresem {github}.',
|
||||||
|
'layout.auto': 'Automatyczny',
|
||||||
|
'layout.current_is': 'Twój obecny układ to:',
|
||||||
|
'layout.desktop': 'Desktopowy',
|
||||||
|
'layout.mobile': 'Mobilny',
|
||||||
|
'navigation_bar.app_settings': 'Ustawienia aplikacji',
|
||||||
|
'getting_started.onboarding': 'Rozejrzyj się',
|
||||||
|
'onboarding.page_one.federation': '{domain} jest \'instancją\' Mastodona. Mastodon to sieć działających niezależnie serwerów tworzących jedną sieć społecznościową. Te serwery nazywane są instancjami.',
|
||||||
|
'onboarding.page_one.welcome': 'Witamy na {domain}!',
|
||||||
|
'onboarding.page_six.github': '{domain} jest oparty na Glitchsoc. Glitchsoc jest {forkiem} {Mastodon}a kompatybilnym z każdym klientem i aplikacją Mastodona. Glitchsoc jest całkowicie wolnym i otwartoźródłowym oprogramowaniem. Możesz zgłaszać błędy i sugestie funkcji oraz współtworzyć projekt na {github}.',
|
||||||
|
'settings.auto_collapse': 'Automatyczne zwijanie',
|
||||||
|
'settings.auto_collapse_all': 'Wszystko',
|
||||||
|
'settings.auto_collapse_lengthy': 'Długie wpisy',
|
||||||
|
'settings.auto_collapse_media': 'Wpisy z zawartością multimedialną',
|
||||||
|
'settings.auto_collapse_notifications': 'Powiadomienia',
|
||||||
|
'settings.auto_collapse_reblogs': 'Podbicia',
|
||||||
|
'settings.auto_collapse_replies': 'Odpowiedzi',
|
||||||
|
'settings.close': 'Zamknij',
|
||||||
|
'settings.collapsed_statuses': 'Zwijanie wpisów',
|
||||||
|
'settings.enable_collapsed': 'Włącz zwijanie wpisów',
|
||||||
|
'settings.general': 'Ogólne',
|
||||||
|
'settings.image_backgrounds': 'Obrazy w tle',
|
||||||
|
'settings.image_backgrounds_media': 'Wyświetlaj zawartość multimedialną zwiniętych wpisów',
|
||||||
|
'settings.image_backgrounds_users': 'Nadaj tło zwiniętym wpisom',
|
||||||
|
'settings.media': 'Zawartość multimedialna',
|
||||||
|
'settings.media_letterbox': 'Letterbox media',
|
||||||
|
'settings.media_fullwidth': 'Podgląd zawartości multimedialnej o pełnej szerokości',
|
||||||
|
'settings.preferences': 'Preferencje użyytkownika',
|
||||||
|
'settings.wide_view': 'Szeroki widok (tylko w trybie desktopowym)',
|
||||||
|
'settings.navbar_under': 'Pasek nawigacji na dole (tylko w trybie mobilnym)',
|
||||||
|
'status.collapse': 'Zwiń',
|
||||||
|
'status.uncollapse': 'Rozwiń',
|
||||||
|
|
||||||
|
'notification.markForDeletion': 'Oznacz do usunięcia',
|
||||||
|
'notifications.clear': 'Wyczyść wszystkie powiadomienia',
|
||||||
|
'notifications.marked_clear_confirmation': 'Czy na pewno chcesz bezpowrtonie usunąć wszystkie powiadomienia?',
|
||||||
|
'notifications.marked_clear': 'Usuń zaznaczone powiadomienia',
|
||||||
|
|
||||||
|
'notification_purge.btn_all': 'Zaznacz\nwszystkie',
|
||||||
|
'notification_purge.btn_none': 'Odznacz\nwszystkie',
|
||||||
|
'notification_purge.btn_invert': 'Odwróć\nzaznaczenie',
|
||||||
|
'notification_purge.btn_apply': 'Usuń\nzaznaczone',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/pt-BR.js
Normal file
7
app/javascript/flavours/glitch/locales/pt-BR.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/pt-BR.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/pt.js
Normal file
7
app/javascript/flavours/glitch/locales/pt.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/pt.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/ru.js
Normal file
7
app/javascript/flavours/glitch/locales/ru.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/ru.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/sv.js
Normal file
7
app/javascript/flavours/glitch/locales/sv.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/sv.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/th.js
Normal file
7
app/javascript/flavours/glitch/locales/th.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/th.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/tr.js
Normal file
7
app/javascript/flavours/glitch/locales/tr.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/tr.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/uk.js
Normal file
7
app/javascript/flavours/glitch/locales/uk.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/uk.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/zh-CN.js
Normal file
7
app/javascript/flavours/glitch/locales/zh-CN.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/zh-CN.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/zh-HK.js
Normal file
7
app/javascript/flavours/glitch/locales/zh-HK.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/zh-HK.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
7
app/javascript/flavours/glitch/locales/zh-TW.js
Normal file
7
app/javascript/flavours/glitch/locales/zh-TW.js
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
import inherited from 'mastodon/locales/zh-TW.json';
|
||||||
|
|
||||||
|
const messages = {
|
||||||
|
// No translations available.
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Object.assign({}, inherited, messages);
|
||||||
8
app/javascript/flavours/glitch/names.yml
Normal file
8
app/javascript/flavours/glitch/names.yml
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
en:
|
||||||
|
flavours:
|
||||||
|
glitch:
|
||||||
|
description: The default flavour for GlitchSoc instances.
|
||||||
|
name: Glitch Edition
|
||||||
|
skins:
|
||||||
|
glitch:
|
||||||
|
default: Default
|
||||||
@@ -1 +1,4 @@
|
|||||||
import 'flavours/glitch/styles/index.scss';
|
import 'flavours/glitch/styles/index.scss';
|
||||||
|
|
||||||
|
// This ensures that webpack compiles our images.
|
||||||
|
require.context('../images', true);
|
||||||
|
|||||||
@@ -43,6 +43,10 @@ import {
|
|||||||
FAVOURITED_STATUSES_FETCH_SUCCESS,
|
FAVOURITED_STATUSES_FETCH_SUCCESS,
|
||||||
FAVOURITED_STATUSES_EXPAND_SUCCESS,
|
FAVOURITED_STATUSES_EXPAND_SUCCESS,
|
||||||
} from 'flavours/glitch/actions/favourites';
|
} from 'flavours/glitch/actions/favourites';
|
||||||
|
import {
|
||||||
|
LIST_ACCOUNTS_FETCH_SUCCESS,
|
||||||
|
LIST_EDITOR_SUGGESTIONS_READY,
|
||||||
|
} from 'flavours/glitch/actions/lists';
|
||||||
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
||||||
import emojify from 'flavours/glitch/util/emoji';
|
import emojify from 'flavours/glitch/util/emoji';
|
||||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
@@ -110,6 +114,8 @@ export default function accounts(state = initialState, action) {
|
|||||||
case BLOCKS_EXPAND_SUCCESS:
|
case BLOCKS_EXPAND_SUCCESS:
|
||||||
case MUTES_FETCH_SUCCESS:
|
case MUTES_FETCH_SUCCESS:
|
||||||
case MUTES_EXPAND_SUCCESS:
|
case MUTES_EXPAND_SUCCESS:
|
||||||
|
case LIST_ACCOUNTS_FETCH_SUCCESS:
|
||||||
|
case LIST_EDITOR_SUGGESTIONS_READY:
|
||||||
return action.accounts ? normalizeAccounts(state, action.accounts) : state;
|
return action.accounts ? normalizeAccounts(state, action.accounts) : state;
|
||||||
case NOTIFICATIONS_REFRESH_SUCCESS:
|
case NOTIFICATIONS_REFRESH_SUCCESS:
|
||||||
case NOTIFICATIONS_EXPAND_SUCCESS:
|
case NOTIFICATIONS_EXPAND_SUCCESS:
|
||||||
|
|||||||
@@ -45,6 +45,10 @@ import {
|
|||||||
FAVOURITED_STATUSES_FETCH_SUCCESS,
|
FAVOURITED_STATUSES_FETCH_SUCCESS,
|
||||||
FAVOURITED_STATUSES_EXPAND_SUCCESS,
|
FAVOURITED_STATUSES_EXPAND_SUCCESS,
|
||||||
} from 'flavours/glitch/actions/favourites';
|
} from 'flavours/glitch/actions/favourites';
|
||||||
|
import {
|
||||||
|
LIST_ACCOUNTS_FETCH_SUCCESS,
|
||||||
|
LIST_EDITOR_SUGGESTIONS_READY,
|
||||||
|
} from 'flavours/glitch/actions/lists';
|
||||||
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
||||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
|
|
||||||
@@ -106,6 +110,8 @@ export default function accountsCounters(state = initialState, action) {
|
|||||||
case BLOCKS_EXPAND_SUCCESS:
|
case BLOCKS_EXPAND_SUCCESS:
|
||||||
case MUTES_FETCH_SUCCESS:
|
case MUTES_FETCH_SUCCESS:
|
||||||
case MUTES_EXPAND_SUCCESS:
|
case MUTES_EXPAND_SUCCESS:
|
||||||
|
case LIST_ACCOUNTS_FETCH_SUCCESS:
|
||||||
|
case LIST_EDITOR_SUGGESTIONS_READY:
|
||||||
return action.accounts ? normalizeAccounts(state, action.accounts) : state;
|
return action.accounts ? normalizeAccounts(state, action.accounts) : state;
|
||||||
case NOTIFICATIONS_REFRESH_SUCCESS:
|
case NOTIFICATIONS_REFRESH_SUCCESS:
|
||||||
case NOTIFICATIONS_EXPAND_SUCCESS:
|
case NOTIFICATIONS_EXPAND_SUCCESS:
|
||||||
|
|||||||
@@ -23,6 +23,8 @@ import media_attachments from './media_attachments';
|
|||||||
import notifications from './notifications';
|
import notifications from './notifications';
|
||||||
import height_cache from './height_cache';
|
import height_cache from './height_cache';
|
||||||
import custom_emojis from './custom_emojis';
|
import custom_emojis from './custom_emojis';
|
||||||
|
import lists from './lists';
|
||||||
|
import listEditor from './list_editor';
|
||||||
|
|
||||||
const reducers = {
|
const reducers = {
|
||||||
timelines,
|
timelines,
|
||||||
@@ -49,6 +51,8 @@ const reducers = {
|
|||||||
notifications,
|
notifications,
|
||||||
height_cache,
|
height_cache,
|
||||||
custom_emojis,
|
custom_emojis,
|
||||||
|
lists,
|
||||||
|
listEditor,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default combineReducers(reducers);
|
export default combineReducers(reducers);
|
||||||
|
|||||||
89
app/javascript/flavours/glitch/reducers/list_editor.js
Normal file
89
app/javascript/flavours/glitch/reducers/list_editor.js
Normal file
@@ -0,0 +1,89 @@
|
|||||||
|
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
|
||||||
|
import {
|
||||||
|
LIST_CREATE_REQUEST,
|
||||||
|
LIST_CREATE_FAIL,
|
||||||
|
LIST_CREATE_SUCCESS,
|
||||||
|
LIST_UPDATE_REQUEST,
|
||||||
|
LIST_UPDATE_FAIL,
|
||||||
|
LIST_UPDATE_SUCCESS,
|
||||||
|
LIST_EDITOR_RESET,
|
||||||
|
LIST_EDITOR_SETUP,
|
||||||
|
LIST_EDITOR_TITLE_CHANGE,
|
||||||
|
LIST_ACCOUNTS_FETCH_REQUEST,
|
||||||
|
LIST_ACCOUNTS_FETCH_SUCCESS,
|
||||||
|
LIST_ACCOUNTS_FETCH_FAIL,
|
||||||
|
LIST_EDITOR_SUGGESTIONS_READY,
|
||||||
|
LIST_EDITOR_SUGGESTIONS_CLEAR,
|
||||||
|
LIST_EDITOR_SUGGESTIONS_CHANGE,
|
||||||
|
LIST_EDITOR_ADD_SUCCESS,
|
||||||
|
LIST_EDITOR_REMOVE_SUCCESS,
|
||||||
|
} from '../actions/lists';
|
||||||
|
|
||||||
|
const initialState = ImmutableMap({
|
||||||
|
listId: null,
|
||||||
|
isSubmitting: false,
|
||||||
|
title: '',
|
||||||
|
|
||||||
|
accounts: ImmutableMap({
|
||||||
|
items: ImmutableList(),
|
||||||
|
loaded: false,
|
||||||
|
isLoading: false,
|
||||||
|
}),
|
||||||
|
|
||||||
|
suggestions: ImmutableMap({
|
||||||
|
value: '',
|
||||||
|
items: ImmutableList(),
|
||||||
|
}),
|
||||||
|
});
|
||||||
|
|
||||||
|
export default function listEditorReducer(state = initialState, action) {
|
||||||
|
switch(action.type) {
|
||||||
|
case LIST_EDITOR_RESET:
|
||||||
|
return initialState;
|
||||||
|
case LIST_EDITOR_SETUP:
|
||||||
|
return state.withMutations(map => {
|
||||||
|
map.set('listId', action.list.get('id'));
|
||||||
|
map.set('title', action.list.get('title'));
|
||||||
|
map.set('isSubmitting', false);
|
||||||
|
});
|
||||||
|
case LIST_EDITOR_TITLE_CHANGE:
|
||||||
|
return state.set('title', action.value);
|
||||||
|
case LIST_CREATE_REQUEST:
|
||||||
|
case LIST_UPDATE_REQUEST:
|
||||||
|
return state.set('isSubmitting', true);
|
||||||
|
case LIST_CREATE_FAIL:
|
||||||
|
case LIST_UPDATE_FAIL:
|
||||||
|
return state.set('isSubmitting', false);
|
||||||
|
case LIST_CREATE_SUCCESS:
|
||||||
|
case LIST_UPDATE_SUCCESS:
|
||||||
|
return state.withMutations(map => {
|
||||||
|
map.set('isSubmitting', false);
|
||||||
|
map.set('listId', action.list.id);
|
||||||
|
});
|
||||||
|
case LIST_ACCOUNTS_FETCH_REQUEST:
|
||||||
|
return state.setIn(['accounts', 'isLoading'], true);
|
||||||
|
case LIST_ACCOUNTS_FETCH_FAIL:
|
||||||
|
return state.setIn(['accounts', 'isLoading'], false);
|
||||||
|
case LIST_ACCOUNTS_FETCH_SUCCESS:
|
||||||
|
return state.update('accounts', accounts => accounts.withMutations(map => {
|
||||||
|
map.set('isLoading', false);
|
||||||
|
map.set('loaded', true);
|
||||||
|
map.set('items', ImmutableList(action.accounts.map(item => item.id)));
|
||||||
|
}));
|
||||||
|
case LIST_EDITOR_SUGGESTIONS_CHANGE:
|
||||||
|
return state.setIn(['suggestions', 'value'], action.value);
|
||||||
|
case LIST_EDITOR_SUGGESTIONS_READY:
|
||||||
|
return state.setIn(['suggestions', 'items'], ImmutableList(action.accounts.map(item => item.id)));
|
||||||
|
case LIST_EDITOR_SUGGESTIONS_CLEAR:
|
||||||
|
return state.update('suggestions', suggestions => suggestions.withMutations(map => {
|
||||||
|
map.set('items', ImmutableList());
|
||||||
|
map.set('value', '');
|
||||||
|
}));
|
||||||
|
case LIST_EDITOR_ADD_SUCCESS:
|
||||||
|
return state.updateIn(['accounts', 'items'], list => list.unshift(action.accountId));
|
||||||
|
case LIST_EDITOR_REMOVE_SUCCESS:
|
||||||
|
return state.updateIn(['accounts', 'items'], list => list.filterNot(item => item === action.accountId));
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
37
app/javascript/flavours/glitch/reducers/lists.js
Normal file
37
app/javascript/flavours/glitch/reducers/lists.js
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
import {
|
||||||
|
LIST_FETCH_SUCCESS,
|
||||||
|
LIST_FETCH_FAIL,
|
||||||
|
LISTS_FETCH_SUCCESS,
|
||||||
|
LIST_CREATE_SUCCESS,
|
||||||
|
LIST_UPDATE_SUCCESS,
|
||||||
|
LIST_DELETE_SUCCESS,
|
||||||
|
} from '../actions/lists';
|
||||||
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
|
|
||||||
|
const initialState = ImmutableMap();
|
||||||
|
|
||||||
|
const normalizeList = (state, list) => state.set(list.id, fromJS(list));
|
||||||
|
|
||||||
|
const normalizeLists = (state, lists) => {
|
||||||
|
lists.forEach(list => {
|
||||||
|
state = normalizeList(state, list);
|
||||||
|
});
|
||||||
|
|
||||||
|
return state;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function lists(state = initialState, action) {
|
||||||
|
switch(action.type) {
|
||||||
|
case LIST_FETCH_SUCCESS:
|
||||||
|
case LIST_CREATE_SUCCESS:
|
||||||
|
case LIST_UPDATE_SUCCESS:
|
||||||
|
return normalizeList(state, action.list);
|
||||||
|
case LISTS_FETCH_SUCCESS:
|
||||||
|
return normalizeLists(state, action.lists);
|
||||||
|
case LIST_DELETE_SUCCESS:
|
||||||
|
case LIST_FETCH_FAIL:
|
||||||
|
return state.set(action.id, false);
|
||||||
|
default:
|
||||||
|
return state;
|
||||||
|
}
|
||||||
|
};
|
||||||
@@ -2,6 +2,7 @@ import { SETTING_CHANGE, SETTING_SAVE } from 'flavours/glitch/actions/settings';
|
|||||||
import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE } from 'flavours/glitch/actions/columns';
|
import { COLUMN_ADD, COLUMN_REMOVE, COLUMN_MOVE } from 'flavours/glitch/actions/columns';
|
||||||
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
import { STORE_HYDRATE } from 'flavours/glitch/actions/store';
|
||||||
import { EMOJI_USE } from 'flavours/glitch/actions/emojis';
|
import { EMOJI_USE } from 'flavours/glitch/actions/emojis';
|
||||||
|
import { LIST_DELETE_SUCCESS, LIST_FETCH_FAIL } from '../actions/lists';
|
||||||
import { Map as ImmutableMap, fromJS } from 'immutable';
|
import { Map as ImmutableMap, fromJS } from 'immutable';
|
||||||
import uuid from 'flavours/glitch/util/uuid';
|
import uuid from 'flavours/glitch/util/uuid';
|
||||||
|
|
||||||
@@ -92,6 +93,8 @@ const moveColumn = (state, uuid, direction) => {
|
|||||||
|
|
||||||
const updateFrequentEmojis = (state, emoji) => state.update('frequentlyUsedEmojis', ImmutableMap(), map => map.update(emoji.id, 0, count => count + 1)).set('saved', false);
|
const updateFrequentEmojis = (state, emoji) => state.update('frequentlyUsedEmojis', ImmutableMap(), map => map.update(emoji.id, 0, count => count + 1)).set('saved', false);
|
||||||
|
|
||||||
|
const filterDeadListColumns = (state, listId) => state.update('columns', columns => columns.filterNot(column => column.get('id') === 'LIST' && column.get('params').get('id') === listId));
|
||||||
|
|
||||||
export default function settings(state = initialState, action) {
|
export default function settings(state = initialState, action) {
|
||||||
switch(action.type) {
|
switch(action.type) {
|
||||||
case STORE_HYDRATE:
|
case STORE_HYDRATE:
|
||||||
@@ -114,6 +117,10 @@ export default function settings(state = initialState, action) {
|
|||||||
return updateFrequentEmojis(state, action.emoji);
|
return updateFrequentEmojis(state, action.emoji);
|
||||||
case SETTING_SAVE:
|
case SETTING_SAVE:
|
||||||
return state.set('saved', true);
|
return state.set('saved', true);
|
||||||
|
case LIST_FETCH_FAIL:
|
||||||
|
return action.error.response.status === 404 ? filterDeadListColumns(state, action.id) : state;
|
||||||
|
case LIST_DELETE_SUCCESS:
|
||||||
|
return filterDeadListColumns(state, action.id);
|
||||||
default:
|
default:
|
||||||
return state;
|
return state;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -246,6 +246,22 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.flavour-screen {
|
||||||
|
display: block;
|
||||||
|
margin: 10px auto;
|
||||||
|
max-width: 100%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.flavour-description {
|
||||||
|
display: block;
|
||||||
|
font-size: 16px;
|
||||||
|
margin: 10px 0;
|
||||||
|
|
||||||
|
& > p {
|
||||||
|
margin: 10px 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
.report-accounts {
|
.report-accounts {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-wrap: wrap;
|
flex-wrap: wrap;
|
||||||
@@ -347,3 +363,120 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.spacer {
|
||||||
|
flex: 1 1 auto;
|
||||||
|
}
|
||||||
|
|
||||||
|
.log-entry {
|
||||||
|
margin-bottom: 8px;
|
||||||
|
line-height: 20px;
|
||||||
|
|
||||||
|
&__header {
|
||||||
|
display: flex;
|
||||||
|
justify-content: flex-start;
|
||||||
|
align-items: center;
|
||||||
|
padding: 10px;
|
||||||
|
background: $ui-base-color;
|
||||||
|
color: $ui-primary-color;
|
||||||
|
border-radius: 4px 4px 0 0;
|
||||||
|
font-size: 14px;
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__avatar {
|
||||||
|
margin-right: 10px;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
border-radius: 50%;
|
||||||
|
width: 40px;
|
||||||
|
height: 40px;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
&__title {
|
||||||
|
overflow: hidden;
|
||||||
|
text-overflow: ellipsis;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__timestamp {
|
||||||
|
color: lighten($ui-base-color, 34%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__extras {
|
||||||
|
background: lighten($ui-base-color, 6%);
|
||||||
|
border-radius: 0 0 4px 4px;
|
||||||
|
padding: 10px;
|
||||||
|
color: $ui-primary-color;
|
||||||
|
font-family: 'mastodon-font-monospace', monospace;
|
||||||
|
font-size: 12px;
|
||||||
|
white-space: nowrap;
|
||||||
|
min-height: 20px;
|
||||||
|
}
|
||||||
|
|
||||||
|
&__icon {
|
||||||
|
font-size: 28px;
|
||||||
|
margin-right: 10px;
|
||||||
|
color: lighten($ui-base-color, 34%);
|
||||||
|
}
|
||||||
|
|
||||||
|
&__icon__overlay {
|
||||||
|
position: absolute;
|
||||||
|
top: 10px;
|
||||||
|
right: 10px;
|
||||||
|
width: 10px;
|
||||||
|
height: 10px;
|
||||||
|
border-radius: 50%;
|
||||||
|
|
||||||
|
&.positive {
|
||||||
|
background: $success-green;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.negative {
|
||||||
|
background: $error-red;
|
||||||
|
}
|
||||||
|
|
||||||
|
&.neutral {
|
||||||
|
background: $ui-highlight-color;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
a,
|
||||||
|
.username,
|
||||||
|
.target {
|
||||||
|
color: $ui-secondary-color;
|
||||||
|
text-decoration: none;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-old {
|
||||||
|
color: $error-red;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-neutral {
|
||||||
|
color: $ui-secondary-color;
|
||||||
|
}
|
||||||
|
|
||||||
|
.diff-new {
|
||||||
|
color: $success-green;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.name-tag {
|
||||||
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
|
|
||||||
|
.avatar {
|
||||||
|
display: block;
|
||||||
|
margin: 0;
|
||||||
|
margin-right: 5px;
|
||||||
|
border-radius: 50%;
|
||||||
|
}
|
||||||
|
|
||||||
|
.username {
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user