Compare commits
462 Commits
feature/ex
...
compose-re
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b982058173 | ||
|
|
2c9123660d | ||
|
|
05c63c5c99 | ||
|
|
118fe224ff | ||
|
|
a7be86e875 | ||
|
|
b15dd05514 | ||
|
|
21bafc6555 | ||
|
|
f5e2469485 | ||
|
|
9423553e5c | ||
|
|
90770f6d59 | ||
|
|
c756651278 | ||
|
|
eb907a5bab | ||
|
|
39c9cdf7fe | ||
|
|
86cf4468af | ||
|
|
42e8c8eb0e | ||
|
|
09d81defcd | ||
|
|
3810d98cd8 | ||
|
|
26b2a6a71e | ||
|
|
edf9a5e4fc | ||
|
|
c710069c12 | ||
|
|
990d6dd565 | ||
|
|
402da46ff6 | ||
|
|
e7099d8d9e | ||
|
|
637ea3bb5b | ||
|
|
363d0d3a44 | ||
|
|
6e54719474 | ||
|
|
f3003417c5 | ||
|
|
33ea042dec | ||
|
|
8b22a63ab0 | ||
|
|
05686cc99d | ||
|
|
484208ce12 | ||
|
|
3bc8924940 | ||
|
|
a02de9e012 | ||
|
|
2d395324e1 | ||
|
|
e6c9756fa9 | ||
|
|
5050719fac | ||
|
|
989553c69a | ||
|
|
0e0c6b1b4b | ||
|
|
554c2fd8af | ||
|
|
a2b600428c | ||
|
|
df1a9c5ab5 | ||
|
|
4421f6598f | ||
|
|
64a5e9a1de | ||
|
|
7364b26e4b | ||
|
|
313ba202ef | ||
|
|
7c44ad6355 | ||
|
|
37ff061d9b | ||
|
|
3d7de06db4 | ||
|
|
26f08f0791 | ||
|
|
8b9ee5f16b | ||
|
|
4b397adb5b | ||
|
|
8980aa804f | ||
|
|
34118169ac | ||
|
|
4fd7aebd5e | ||
|
|
65154869df | ||
|
|
bc89995f65 | ||
|
|
7e9d93472c | ||
|
|
dbb1fce94d | ||
|
|
7cc71748ce | ||
|
|
aec70b44fc | ||
|
|
6f490b4bfe | ||
|
|
03975dbde4 | ||
|
|
f72936b4e6 | ||
|
|
3c530d95f6 | ||
|
|
1e7b3bf625 | ||
|
|
bf0ee1a25c | ||
|
|
fa0be3f834 | ||
|
|
981e20b03a | ||
|
|
d5b767c374 | ||
|
|
93b54b8d4b | ||
|
|
e7ab9bf8b4 | ||
|
|
6cd5b3bbe5 | ||
|
|
f72ad67a39 | ||
|
|
56094cb4bd | ||
|
|
22df18e902 | ||
|
|
894da3dcca | ||
|
|
3e2f793948 | ||
|
|
8eb7d30a6c | ||
|
|
7fe1428cc4 | ||
|
|
b3b4b5a2eb | ||
|
|
8125fdc19f | ||
|
|
ae716a12e1 | ||
|
|
f63a40e7c2 | ||
|
|
1bdd694a0a | ||
|
|
2eab41cd1a | ||
|
|
c6f76db2e1 | ||
|
|
2c704ca9c6 | ||
|
|
cdc22d23b9 | ||
|
|
eb96aa86a4 | ||
|
|
c1a2707ecf | ||
|
|
531dadad86 | ||
|
|
723890b6fa | ||
|
|
daa04c39b6 | ||
|
|
2af964ef20 | ||
|
|
33e806217f | ||
|
|
c35132a738 | ||
|
|
a1c54220e8 | ||
|
|
df7dbc41ae | ||
|
|
b8db386e05 | ||
|
|
48f7a58799 | ||
|
|
388d093beb | ||
|
|
95fe20b78a | ||
|
|
3283868e28 | ||
|
|
dc91fd482a | ||
|
|
b8bae96647 | ||
|
|
d37305c628 | ||
|
|
ad917cda10 | ||
|
|
f398ad1994 | ||
|
|
df626fdd43 | ||
|
|
6a2b1ba91e | ||
|
|
3cfcc7a50e | ||
|
|
fe1c20cfb9 | ||
|
|
cb7ba23cd8 | ||
|
|
691e9112f3 | ||
|
|
385df2c5a0 | ||
|
|
35ec1c91e3 | ||
|
|
edd1a00faf | ||
|
|
13e05fece2 | ||
|
|
9d84b6e606 | ||
|
|
bf0f7e8846 | ||
|
|
4817744b87 | ||
|
|
8e9911962d | ||
|
|
3ebe03b729 | ||
|
|
eeaa8fba43 | ||
|
|
b0b5ff1b0f | ||
|
|
bd51a16150 | ||
|
|
0bf9261e65 | ||
|
|
6bc07d3de3 | ||
|
|
fbc6375fde | ||
|
|
0352c40e99 | ||
|
|
e5d8166a12 | ||
|
|
07ea625cb2 | ||
|
|
3cc6255a7e | ||
|
|
35e2cad4eb | ||
|
|
8d6b9ba494 | ||
|
|
27101f1beb | ||
|
|
1823cf435a | ||
|
|
6a50329a9c | ||
|
|
b17e571bc2 | ||
|
|
476e79b8e3 | ||
|
|
19d3317a69 | ||
|
|
fe6941e28e | ||
|
|
38600b2792 | ||
|
|
b0407ece42 | ||
|
|
9b3d8ee346 | ||
|
|
b3d7ad958f | ||
|
|
552d22bec9 | ||
|
|
7c33da45f0 | ||
|
|
9815be2a44 | ||
|
|
bebaa6eced | ||
|
|
616f53eea8 | ||
|
|
61d3ecc805 | ||
|
|
4bb3e4eeba | ||
|
|
784c7510d7 | ||
|
|
6c54d2e583 | ||
|
|
96c942e8ab | ||
|
|
aafe55af81 | ||
|
|
fd49d5603a | ||
|
|
1c6fc0e4ce | ||
|
|
92e7815d1d | ||
|
|
9d97054fe6 | ||
|
|
cc796298c9 | ||
|
|
f0a2a6c875 | ||
|
|
7fd66cf2fe | ||
|
|
6e9e0c14e6 | ||
|
|
0aa810f9c8 | ||
|
|
3888a12c79 | ||
|
|
cfa68907ae | ||
|
|
488584bfc1 | ||
|
|
0717d9b3e6 | ||
|
|
6e4046fc3f | ||
|
|
92a3181dc6 | ||
|
|
f0c939c431 | ||
|
|
ebadfe0ab7 | ||
|
|
94f15338c3 | ||
|
|
db33a53ee8 | ||
|
|
7de6d269d2 | ||
|
|
684001d729 | ||
|
|
292f3cd7e0 | ||
|
|
7cc0da756d | ||
|
|
85d5da86df | ||
|
|
e10cff8226 | ||
|
|
979b0d66a7 | ||
|
|
6ca03a7f58 | ||
|
|
96ba3482b9 | ||
|
|
a3d4f1bd93 | ||
|
|
633426b261 | ||
|
|
f486ef2666 | ||
|
|
d2dee6ea43 | ||
|
|
967e70663f | ||
|
|
b7e65a004f | ||
|
|
3a3475450e | ||
|
|
057db0ecd0 | ||
|
|
11436358b4 | ||
|
|
6610d57f91 | ||
|
|
0e0a9e716c | ||
|
|
45682f876d | ||
|
|
4413d81d7f | ||
|
|
5a2c7bd4ce | ||
|
|
5c8ca024ef | ||
|
|
d8b2f89d33 | ||
|
|
d5f490b1a2 | ||
|
|
c75ca0525b | ||
|
|
6f2d88dd28 | ||
|
|
daa59dd454 | ||
|
|
72d939b69f | ||
|
|
1a8011648f | ||
|
|
37e141bccb | ||
|
|
dcd8ff5308 | ||
|
|
97b3d0cd56 | ||
|
|
fd7f0732fe | ||
|
|
eb5ac23434 | ||
|
|
a5143df303 | ||
|
|
2aca22b8ea | ||
|
|
7db0f8dcb2 | ||
|
|
49cc0eb3e7 | ||
|
|
b9c76e2edb | ||
|
|
f82e90bf11 | ||
|
|
2559d9166c | ||
|
|
32e8a87830 | ||
|
|
636acb5712 | ||
|
|
b406e3cc4c | ||
|
|
43577e9f59 | ||
|
|
ecfa1c3f3b | ||
|
|
b3af3f9f8c | ||
|
|
d5091387c6 | ||
|
|
178f718a9b | ||
|
|
0e1b0f2747 | ||
|
|
468523f4ad | ||
|
|
2076c557c9 | ||
|
|
d40c9140e8 | ||
|
|
632178d754 | ||
|
|
291feba6f1 | ||
|
|
63f0979799 | ||
|
|
ec13cfa4f9 | ||
|
|
cdd5ef691b | ||
|
|
c743b5e1fd | ||
|
|
dfaa219f88 | ||
|
|
e6543d5fc4 | ||
|
|
813c5f2f52 | ||
|
|
82d9ade7a6 | ||
|
|
875d943c18 | ||
|
|
334a446313 | ||
|
|
ecacb15cd5 | ||
|
|
eb6ec3d068 | ||
|
|
f303a954e6 | ||
|
|
395a57d03d | ||
|
|
0f699a4280 | ||
|
|
5e5f36c216 | ||
|
|
a767ef85fa | ||
|
|
0db47196fb | ||
|
|
c30e492587 | ||
|
|
97c02c3389 | ||
|
|
4453c9a9f5 | ||
|
|
b9c612b561 | ||
|
|
d841af4e80 | ||
|
|
01d6aa0397 | ||
|
|
c567c87453 | ||
|
|
47ecd652d3 | ||
|
|
04fa4eb7f9 | ||
|
|
cdad7977fc | ||
|
|
0b3f1ec62a | ||
|
|
b110cc542f | ||
|
|
cdacac8c6c | ||
|
|
eb605141ff | ||
|
|
1e1d788757 | ||
|
|
b1217242fc | ||
|
|
5dec67d964 | ||
|
|
1df453aff6 | ||
|
|
f7c909e290 | ||
|
|
7481ae1bcb | ||
|
|
cb3b0c1a0f | ||
|
|
ca0e8be20c | ||
|
|
83ffc4dc07 | ||
|
|
d6fe0954e3 | ||
|
|
ebb8c89207 | ||
|
|
0060f98847 | ||
|
|
1a72813b53 | ||
|
|
ce3e0faf4d | ||
|
|
c3f9c74719 | ||
|
|
c027a7bd4d | ||
|
|
35a8cafa35 | ||
|
|
f4ca116ea8 | ||
|
|
53f829dfa8 | ||
|
|
5b45c1646a | ||
|
|
cf1f83ca2a | ||
|
|
887cd94e96 | ||
|
|
1522795853 | ||
|
|
d2f56d1cbc | ||
|
|
d0b4709b2a | ||
|
|
6e0659c838 | ||
|
|
3406e30526 | ||
|
|
76f360c625 | ||
|
|
a3202f61af | ||
|
|
4ec1771165 | ||
|
|
3d9b8847d2 | ||
|
|
e9f9e3cc89 | ||
|
|
cf24ce7e03 | ||
|
|
74e4fc8f8a | ||
|
|
9a5418942c | ||
|
|
daad07b1d5 | ||
|
|
83bda6c1a8 | ||
|
|
fcf0d2078e | ||
|
|
9330ea1f4d | ||
|
|
06e299cef5 | ||
|
|
8a24ad5828 | ||
|
|
b9f59ebcc6 | ||
|
|
e648ef0bfb | ||
|
|
db3ed498b0 | ||
|
|
901fc48aae | ||
|
|
3caf0ba923 | ||
|
|
6e83b5e719 | ||
|
|
b32a1d5754 | ||
|
|
9d53a38a44 | ||
|
|
f7ca205f38 | ||
|
|
86e617a839 | ||
|
|
e528114c53 | ||
|
|
cf7fbf2c56 | ||
|
|
91e5b0dfdb | ||
|
|
3b60832214 | ||
|
|
259181c41a | ||
|
|
510df0ac55 | ||
|
|
98936bfcdf | ||
|
|
5c82c2b75f | ||
|
|
0fea700c7b | ||
|
|
2c8e3fbbfb | ||
|
|
b982d549f4 | ||
|
|
909a6d4661 | ||
|
|
3f3de38075 | ||
|
|
c267acfcf7 | ||
|
|
ab625c57ce | ||
|
|
e756c4f5ec | ||
|
|
a0bbeafb04 | ||
|
|
2f079573ed | ||
|
|
b2820c3913 | ||
|
|
adc38078dd | ||
|
|
dae0af1fd2 | ||
|
|
5b8d0ad71b | ||
|
|
233258c61b | ||
|
|
9c8aad612e | ||
|
|
210e6776fc | ||
|
|
1924a71b5a | ||
|
|
67f8277526 | ||
|
|
6dfeb64326 | ||
|
|
427beb4177 | ||
|
|
838f255fc2 | ||
|
|
1e02ba111a | ||
|
|
66126f3021 | ||
|
|
293972f716 | ||
|
|
9c8e602163 | ||
|
|
846cd4e838 | ||
|
|
0de82dd316 | ||
|
|
dcfc9b2204 | ||
|
|
b01ab55ed8 | ||
|
|
dd4ef69839 | ||
|
|
d4f80824f7 | ||
|
|
034fab39ab | ||
|
|
0df6442636 | ||
|
|
245816ab27 | ||
|
|
63819c848d | ||
|
|
a9abe89093 | ||
|
|
798b0fc5af | ||
|
|
8fcfcddc8f | ||
|
|
d68df88d4e | ||
|
|
c8580eb806 | ||
|
|
f41e70ca38 | ||
|
|
7b8ecde32d | ||
|
|
8cb4561145 | ||
|
|
1607bb445a | ||
|
|
33c39784e4 | ||
|
|
669fe9ee06 | ||
|
|
b35406b700 | ||
|
|
8e33fc29d7 | ||
|
|
1de6c52545 | ||
|
|
34fa305a00 | ||
|
|
bb4d005a83 | ||
|
|
df1ce2350c | ||
|
|
e5c65b3067 | ||
|
|
7d16bb379d | ||
|
|
0401a24558 | ||
|
|
4aea3f88a6 | ||
|
|
41e6c8b151 | ||
|
|
813e650729 | ||
|
|
1664e52cbb | ||
|
|
dce869dfc7 | ||
|
|
09a94b575e | ||
|
|
d43944143a | ||
|
|
81cec35dbf | ||
|
|
c155d843f4 | ||
|
|
3d640dc8ac | ||
|
|
6db034a866 | ||
|
|
17bf3363ac | ||
|
|
dcf1139ebd | ||
|
|
9619b7f727 | ||
|
|
66be6475b6 | ||
|
|
9e0985d9e4 | ||
|
|
cf14f4945a | ||
|
|
4c14ff659b | ||
|
|
dd6f9a1b82 | ||
|
|
3f07f1b2b1 | ||
|
|
44245926f1 | ||
|
|
8811778b55 | ||
|
|
1eab53ee10 | ||
|
|
7be3131240 | ||
|
|
198a9a4fa4 | ||
|
|
ec36df97c4 | ||
|
|
c8969dca35 | ||
|
|
1e3b1d7211 | ||
|
|
0698c610a6 | ||
|
|
629fae8b3b | ||
|
|
c30e6433de | ||
|
|
cea5597722 | ||
|
|
48d77ea1eb | ||
|
|
efec507230 | ||
|
|
54edb4b853 | ||
|
|
6c81f9d6e5 | ||
|
|
472df24579 | ||
|
|
0d1215e82f | ||
|
|
e77cc032c2 | ||
|
|
67559361e8 | ||
|
|
4a73615193 | ||
|
|
bdcc9e2ceb | ||
|
|
3816943e6b | ||
|
|
b39d512ade | ||
|
|
04046a4983 | ||
|
|
a4c500176b | ||
|
|
1aad015bbb | ||
|
|
94fba44eec | ||
|
|
721460a59b | ||
|
|
45b595cdca | ||
|
|
aad3df6afc | ||
|
|
1023f52eaa | ||
|
|
596dab06e9 | ||
|
|
4f0597d579 | ||
|
|
2bbf987a0a | ||
|
|
af00220d79 | ||
|
|
9239e4ce4d | ||
|
|
06f26e09b4 | ||
|
|
331263270b | ||
|
|
283a5ec1a4 | ||
|
|
550ff677da | ||
|
|
da77f65c46 | ||
|
|
9e2ff3ef71 | ||
|
|
b9d241c6f5 | ||
|
|
56af04dbb4 | ||
|
|
60944d5dca | ||
|
|
081f907f90 | ||
|
|
f29918e707 | ||
|
|
af10c9fbff | ||
|
|
8f8e677630 | ||
|
|
4931eac280 | ||
|
|
881856553e | ||
|
|
0a6b098668 | ||
|
|
0ef9d45d05 | ||
|
|
a6a206ef85 | ||
|
|
bbff144004 | ||
|
|
47d48fed8d | ||
|
|
3018043fc2 | ||
|
|
c2bee07dbc | ||
|
|
a345479de2 | ||
|
|
08f00df94b | ||
|
|
b6bf04ece2 |
@@ -1,5 +1,6 @@
|
|||||||
# Service dependencies
|
# Service dependencies
|
||||||
# You may set REDIS_URL instead for more advanced options
|
# You may set REDIS_URL instead for more advanced options
|
||||||
|
# You may also set REDIS_NAMESPACE to share Redis between multiple Mastodon servers
|
||||||
REDIS_HOST=redis
|
REDIS_HOST=redis
|
||||||
REDIS_PORT=6379
|
REDIS_PORT=6379
|
||||||
# You may set DATABASE_URL instead for more advanced options
|
# You may set DATABASE_URL instead for more advanced options
|
||||||
@@ -101,11 +102,19 @@ SMTP_FROM_ADDRESS=notifications@example.com
|
|||||||
# Swift (optional)
|
# Swift (optional)
|
||||||
# SWIFT_ENABLED=true
|
# SWIFT_ENABLED=true
|
||||||
# SWIFT_USERNAME=
|
# SWIFT_USERNAME=
|
||||||
|
# For Keystone V3, the value for SWIFT_TENANT should be the project name
|
||||||
# SWIFT_TENANT=
|
# SWIFT_TENANT=
|
||||||
# SWIFT_PASSWORD=
|
# SWIFT_PASSWORD=
|
||||||
|
# Keystone V2 and V3 URLs are supported. Use a V3 URL if possible to avoid
|
||||||
|
# issues with token rate-limiting during high load.
|
||||||
# SWIFT_AUTH_URL=
|
# SWIFT_AUTH_URL=
|
||||||
# SWIFT_CONTAINER=
|
# SWIFT_CONTAINER=
|
||||||
# SWIFT_OBJECT_URL=
|
# SWIFT_OBJECT_URL=
|
||||||
|
# SWIFT_REGION=
|
||||||
|
# Defaults to 'default'
|
||||||
|
# SWIFT_DOMAIN_NAME=
|
||||||
|
# Defaults to 60 seconds. Set to 0 to disable
|
||||||
|
# SWIFT_CACHE_TTL=
|
||||||
|
|
||||||
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
# Optional alias for S3 if you want to use Cloudfront or Cloudflare in front
|
||||||
# S3_CLOUDFRONT_HOST=
|
# S3_CLOUDFRONT_HOST=
|
||||||
|
|||||||
@@ -5,12 +5,14 @@ env:
|
|||||||
browser: true
|
browser: true
|
||||||
node: true
|
node: true
|
||||||
es6: true
|
es6: true
|
||||||
|
jest: true
|
||||||
|
|
||||||
parser: babel-eslint
|
parser: babel-eslint
|
||||||
|
|
||||||
plugins:
|
plugins:
|
||||||
- react
|
- react
|
||||||
- jsx-a11y
|
- jsx-a11y
|
||||||
|
- import
|
||||||
|
|
||||||
parserOptions:
|
parserOptions:
|
||||||
sourceType: module
|
sourceType: module
|
||||||
@@ -21,8 +23,14 @@ parserOptions:
|
|||||||
modules: true
|
modules: true
|
||||||
spread: true
|
spread: true
|
||||||
|
|
||||||
rules:
|
settings:
|
||||||
|
import/extensions:
|
||||||
|
- .js
|
||||||
|
import/ignore:
|
||||||
|
- node_modules
|
||||||
|
- \\.(css|scss|json)$
|
||||||
|
|
||||||
|
rules:
|
||||||
brace-style: warn
|
brace-style: warn
|
||||||
comma-dangle:
|
comma-dangle:
|
||||||
- error
|
- error
|
||||||
@@ -125,3 +133,17 @@ rules:
|
|||||||
jsx-a11y/role-supports-aria-props: off
|
jsx-a11y/role-supports-aria-props: off
|
||||||
jsx-a11y/scope: warn
|
jsx-a11y/scope: warn
|
||||||
jsx-a11y/tabindex-no-positive: warn
|
jsx-a11y/tabindex-no-positive: warn
|
||||||
|
|
||||||
|
import/extensions:
|
||||||
|
- error
|
||||||
|
- always
|
||||||
|
- js: never
|
||||||
|
import/newline-after-import: error
|
||||||
|
import/no-extraneous-dependencies:
|
||||||
|
- error
|
||||||
|
- devDependencies:
|
||||||
|
- "config/webpack/**"
|
||||||
|
- "app/javascript/mastodon/test_setup.js"
|
||||||
|
- "app/javascript/**/__tests__/**"
|
||||||
|
import/no-unresolved: error
|
||||||
|
import/no-webpack-loader-syntax: error
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
2.4.1
|
2.4.2
|
||||||
|
|||||||
@@ -26,18 +26,16 @@ addons:
|
|||||||
postgresql: 9.4
|
postgresql: 9.4
|
||||||
apt:
|
apt:
|
||||||
sources:
|
sources:
|
||||||
- ubuntu-toolchain-r-test
|
|
||||||
- trusty-media
|
- trusty-media
|
||||||
packages:
|
packages:
|
||||||
- ffmpeg
|
- ffmpeg
|
||||||
- g++-6
|
|
||||||
- libprotobuf-dev
|
- libprotobuf-dev
|
||||||
- protobuf-compiler
|
- protobuf-compiler
|
||||||
- libicu-dev
|
- libicu-dev
|
||||||
|
|
||||||
rvm:
|
rvm:
|
||||||
- 2.3.4
|
- 2.3.4
|
||||||
- 2.4.1
|
- 2.4.2
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- redis-server
|
- redis-server
|
||||||
@@ -55,5 +53,5 @@ before_script:
|
|||||||
|
|
||||||
script:
|
script:
|
||||||
- travis_retry bundle exec parallel_test spec/ --group-by filesize --type rspec
|
- travis_retry bundle exec parallel_test spec/ --group-by filesize --type rspec
|
||||||
- npm test
|
- yarn test
|
||||||
- bundle exec i18n-tasks unused
|
- bundle exec i18n-tasks check-normalized && bundle exec i18n-tasks unused
|
||||||
|
|||||||
46
.yarnclean
Normal file
@@ -0,0 +1,46 @@
|
|||||||
|
# test directories
|
||||||
|
__tests__
|
||||||
|
test
|
||||||
|
tests
|
||||||
|
powered-test
|
||||||
|
|
||||||
|
# asset directories
|
||||||
|
docs
|
||||||
|
doc
|
||||||
|
website
|
||||||
|
images
|
||||||
|
# assets
|
||||||
|
|
||||||
|
# examples
|
||||||
|
example
|
||||||
|
examples
|
||||||
|
|
||||||
|
# code coverage directories
|
||||||
|
coverage
|
||||||
|
.nyc_output
|
||||||
|
|
||||||
|
# build scripts
|
||||||
|
Makefile
|
||||||
|
Gulpfile.js
|
||||||
|
Gruntfile.js
|
||||||
|
|
||||||
|
# configs
|
||||||
|
.tern-project
|
||||||
|
.gitattributes
|
||||||
|
.editorconfig
|
||||||
|
.*ignore
|
||||||
|
.eslintrc
|
||||||
|
.jshintrc
|
||||||
|
.flowconfig
|
||||||
|
.documentup.json
|
||||||
|
.yarn-metadata.json
|
||||||
|
.*.yml
|
||||||
|
*.yml
|
||||||
|
|
||||||
|
# misc
|
||||||
|
*.gz
|
||||||
|
*.md
|
||||||
|
|
||||||
|
# for specific ignore
|
||||||
|
!.svgo.yml
|
||||||
|
|
||||||
1
Aptfile
@@ -1,4 +1,5 @@
|
|||||||
ffmpeg
|
ffmpeg
|
||||||
|
libicu[0-9][0-9]
|
||||||
libicu-dev
|
libicu-dev
|
||||||
libidn11
|
libidn11
|
||||||
libidn11-dev
|
libidn11-dev
|
||||||
|
|||||||
17
CODEOWNERS
@@ -8,8 +8,25 @@
|
|||||||
# /config/locales/*.fr.yml @żelipapą
|
# /config/locales/*.fr.yml @żelipapą
|
||||||
# /config/locales/fr.yml @żelipapą
|
# /config/locales/fr.yml @żelipapą
|
||||||
|
|
||||||
|
# Polish
|
||||||
/app/javascript/mastodon/locales/pl.json @m4sk1n
|
/app/javascript/mastodon/locales/pl.json @m4sk1n
|
||||||
/app/views/user_mailer/*.pl.html.erb @m4sk1n
|
/app/views/user_mailer/*.pl.html.erb @m4sk1n
|
||||||
/app/views/user_mailer/*.pl.text.erb @m4sk1n
|
/app/views/user_mailer/*.pl.text.erb @m4sk1n
|
||||||
/config/locales/*.pl.yml @m4sk1n
|
/config/locales/*.pl.yml @m4sk1n
|
||||||
/config/locales/pl.yml @m4sk1n
|
/config/locales/pl.yml @m4sk1n
|
||||||
|
|
||||||
|
# French
|
||||||
|
/app/javascript/mastodon/locales/fr.json @aldarone
|
||||||
|
/app/javascript/mastodon/locales/whitelist_fr.json @aldarone
|
||||||
|
/app/views/user_mailer/*.fr.html.erb @aldarone
|
||||||
|
/app/views/user_mailer/*.fr.text.erb @aldarone
|
||||||
|
/config/locales/*.fr.yml @aldarone
|
||||||
|
/config/locales/fr.yml @aldarone
|
||||||
|
|
||||||
|
# Dutch
|
||||||
|
/app/javascript/mastodon/locales/nl.json @jeroenpraat
|
||||||
|
/app/javascript/mastodon/locales/whitelist_nl.json @jeroenpraat
|
||||||
|
/app/views/user_mailer/*.nl.html.erb @jeroenpraat
|
||||||
|
/app/views/user_mailer/*.nl.text.erb @jeroenpraat
|
||||||
|
/config/locales/*.nl.yml @jeroenpraat
|
||||||
|
/config/locales/nl.yml @jeroenpraat
|
||||||
|
|||||||
21
Dockerfile
@@ -1,4 +1,4 @@
|
|||||||
FROM ruby:2.4.1-alpine3.6
|
FROM ruby:2.4.2-alpine3.6
|
||||||
|
|
||||||
LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
LABEL maintainer="https://github.com/tootsuite/mastodon" \
|
||||||
description="A GNU Social-compatible microblogging server"
|
description="A GNU Social-compatible microblogging server"
|
||||||
@@ -7,6 +7,8 @@ ENV UID=991 GID=991 \
|
|||||||
RAILS_SERVE_STATIC_FILES=true \
|
RAILS_SERVE_STATIC_FILES=true \
|
||||||
RAILS_ENV=production NODE_ENV=production
|
RAILS_ENV=production NODE_ENV=production
|
||||||
|
|
||||||
|
ARG YARN_VERSION=1.1.0
|
||||||
|
ARG YARN_DOWNLOAD_SHA256=171c1f9ee93c488c0d774ac6e9c72649047c3f896277d88d0f805266519430f3
|
||||||
ARG LIBICONV_VERSION=1.15
|
ARG LIBICONV_VERSION=1.15
|
||||||
ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
ARG LIBICONV_DOWNLOAD_SHA256=ccf536620a45458d26ba83887a983b96827001e92a13847b45e4925cc8913178
|
||||||
|
|
||||||
@@ -19,6 +21,7 @@ RUN apk -U upgrade \
|
|||||||
build-base \
|
build-base \
|
||||||
icu-dev \
|
icu-dev \
|
||||||
libidn-dev \
|
libidn-dev \
|
||||||
|
libressl \
|
||||||
libtool \
|
libtool \
|
||||||
postgresql-dev \
|
postgresql-dev \
|
||||||
protobuf-dev \
|
protobuf-dev \
|
||||||
@@ -32,16 +35,21 @@ RUN apk -U upgrade \
|
|||||||
imagemagick \
|
imagemagick \
|
||||||
libidn \
|
libidn \
|
||||||
libpq \
|
libpq \
|
||||||
nodejs-npm \
|
|
||||||
nodejs \
|
nodejs \
|
||||||
|
nodejs-npm \
|
||||||
protobuf \
|
protobuf \
|
||||||
su-exec \
|
su-exec \
|
||||||
tini \
|
tini \
|
||||||
yarn \
|
|
||||||
&& update-ca-certificates \
|
&& update-ca-certificates \
|
||||||
|
&& mkdir -p /tmp/src /opt \
|
||||||
|
&& wget -O yarn.tar.gz "https://github.com/yarnpkg/yarn/releases/download/v$YARN_VERSION/yarn-v$YARN_VERSION.tar.gz" \
|
||||||
|
&& echo "$YARN_DOWNLOAD_SHA256 *yarn.tar.gz" | sha256sum -c - \
|
||||||
|
&& tar -xzf yarn.tar.gz -C /tmp/src \
|
||||||
|
&& rm yarn.tar.gz \
|
||||||
|
&& mv /tmp/src/yarn-v$YARN_VERSION /opt/yarn \
|
||||||
|
&& ln -s /opt/yarn/bin/yarn /usr/local/bin/yarn \
|
||||||
&& wget -O libiconv.tar.gz "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
|
&& wget -O libiconv.tar.gz "http://ftp.gnu.org/pub/gnu/libiconv/libiconv-$LIBICONV_VERSION.tar.gz" \
|
||||||
&& echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
|
&& echo "$LIBICONV_DOWNLOAD_SHA256 *libiconv.tar.gz" | sha256sum -c - \
|
||||||
&& mkdir -p /tmp/src \
|
|
||||||
&& tar -xzf libiconv.tar.gz -C /tmp/src \
|
&& tar -xzf libiconv.tar.gz -C /tmp/src \
|
||||||
&& rm libiconv.tar.gz \
|
&& rm libiconv.tar.gz \
|
||||||
&& cd /tmp/src/libiconv-$LIBICONV_VERSION \
|
&& cd /tmp/src/libiconv-$LIBICONV_VERSION \
|
||||||
@@ -52,11 +60,12 @@ RUN apk -U upgrade \
|
|||||||
&& cd /mastodon \
|
&& cd /mastodon \
|
||||||
&& rm -rf /tmp/* /var/cache/apk/*
|
&& rm -rf /tmp/* /var/cache/apk/*
|
||||||
|
|
||||||
COPY Gemfile Gemfile.lock package.json yarn.lock /mastodon/
|
COPY Gemfile Gemfile.lock package.json yarn.lock .yarnclean /mastodon/
|
||||||
|
|
||||||
RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
|
RUN bundle config build.nokogiri --with-iconv-lib=/usr/local/lib --with-iconv-include=/usr/local/include \
|
||||||
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
|
&& bundle install -j$(getconf _NPROCESSORS_ONLN) --deployment --without test development \
|
||||||
&& yarn --ignore-optional --pure-lockfile
|
&& yarn --pure-lockfile \
|
||||||
|
&& yarn cache clean
|
||||||
|
|
||||||
COPY . /mastodon
|
COPY . /mastodon
|
||||||
|
|
||||||
|
|||||||
15
Gemfile
@@ -5,8 +5,8 @@ ruby '>= 2.3.0', '< 2.5.0'
|
|||||||
|
|
||||||
gem 'pkg-config', '~> 1.2'
|
gem 'pkg-config', '~> 1.2'
|
||||||
|
|
||||||
gem 'puma', '~> 3.8'
|
gem 'puma', '~> 3.10'
|
||||||
gem 'rails', '~> 5.1.0'
|
gem 'rails', '~> 5.1.4'
|
||||||
gem 'uglifier', '~> 3.2'
|
gem 'uglifier', '~> 3.2'
|
||||||
|
|
||||||
gem 'hamlit-rails', '~> 0.2'
|
gem 'hamlit-rails', '~> 0.2'
|
||||||
@@ -25,7 +25,7 @@ gem 'bootsnap'
|
|||||||
gem 'browser'
|
gem 'browser'
|
||||||
gem 'charlock_holmes', '~> 0.7.5'
|
gem 'charlock_holmes', '~> 0.7.5'
|
||||||
gem 'iso-639'
|
gem 'iso-639'
|
||||||
gem 'cld3', '~> 3.1'
|
gem 'cld3', '~> 3.2.0'
|
||||||
gem 'devise', '~> 4.2'
|
gem 'devise', '~> 4.2'
|
||||||
gem 'devise-two-factor', '~> 3.0'
|
gem 'devise-two-factor', '~> 3.0'
|
||||||
gem 'doorkeeper', '~> 4.2'
|
gem 'doorkeeper', '~> 4.2'
|
||||||
@@ -42,6 +42,7 @@ gem 'kaminari', '~> 1.0'
|
|||||||
gem 'link_header', '~> 0.0'
|
gem 'link_header', '~> 0.0'
|
||||||
gem 'mime-types', '~> 3.1'
|
gem 'mime-types', '~> 3.1'
|
||||||
gem 'nokogiri', '~> 1.7'
|
gem 'nokogiri', '~> 1.7'
|
||||||
|
gem 'nsa', '~> 0.2'
|
||||||
gem 'oj', '~> 3.0'
|
gem 'oj', '~> 3.0'
|
||||||
gem 'ostatus2', '~> 2.0'
|
gem 'ostatus2', '~> 2.0'
|
||||||
gem 'ox', '~> 2.5'
|
gem 'ox', '~> 2.5'
|
||||||
@@ -64,10 +65,10 @@ gem 'sidekiq-bulk', '~>0.1.1'
|
|||||||
gem 'simple-navigation', '~> 4.0'
|
gem 'simple-navigation', '~> 4.0'
|
||||||
gem 'simple_form', '~> 3.4'
|
gem 'simple_form', '~> 3.4'
|
||||||
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
|
gem 'sprockets-rails', '~> 3.2', require: 'sprockets/railtie'
|
||||||
gem 'statsd-instrument', '~> 2.1'
|
gem 'strong_migrations'
|
||||||
gem 'twitter-text', '~> 1.14'
|
gem 'twitter-text', '~> 1.14'
|
||||||
gem 'tzinfo-data', '~> 1.2017'
|
gem 'tzinfo-data', '~> 1.2017'
|
||||||
gem 'webpacker', '~> 2.0'
|
gem 'webpacker', '~> 3.0'
|
||||||
gem 'webpush'
|
gem 'webpush'
|
||||||
|
|
||||||
gem 'json-ld-preloaded', '~> 2.2.1'
|
gem 'json-ld-preloaded', '~> 2.2.1'
|
||||||
@@ -102,8 +103,8 @@ group :development do
|
|||||||
gem 'letter_opener', '~> 1.4'
|
gem 'letter_opener', '~> 1.4'
|
||||||
gem 'letter_opener_web', '~> 1.3'
|
gem 'letter_opener_web', '~> 1.3'
|
||||||
gem 'rubocop', require: false
|
gem 'rubocop', require: false
|
||||||
gem 'brakeman', '~> 3.6', require: false
|
gem 'brakeman', '~> 4.0', require: false
|
||||||
gem 'bundler-audit', '~> 0.5', require: false
|
gem 'bundler-audit', '~> 0.6', require: false
|
||||||
gem 'scss_lint', '~> 0.53', require: false
|
gem 'scss_lint', '~> 0.53', require: false
|
||||||
|
|
||||||
gem 'capistrano', '~> 3.8'
|
gem 'capistrano', '~> 3.8'
|
||||||
|
|||||||
202
Gemfile.lock
@@ -1,25 +1,25 @@
|
|||||||
GEM
|
GEM
|
||||||
remote: https://rubygems.org/
|
remote: https://rubygems.org/
|
||||||
specs:
|
specs:
|
||||||
actioncable (5.1.3)
|
actioncable (5.1.4)
|
||||||
actionpack (= 5.1.3)
|
actionpack (= 5.1.4)
|
||||||
nio4r (~> 2.0)
|
nio4r (~> 2.0)
|
||||||
websocket-driver (~> 0.6.1)
|
websocket-driver (~> 0.6.1)
|
||||||
actionmailer (5.1.3)
|
actionmailer (5.1.4)
|
||||||
actionpack (= 5.1.3)
|
actionpack (= 5.1.4)
|
||||||
actionview (= 5.1.3)
|
actionview (= 5.1.4)
|
||||||
activejob (= 5.1.3)
|
activejob (= 5.1.4)
|
||||||
mail (~> 2.5, >= 2.5.4)
|
mail (~> 2.5, >= 2.5.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
actionpack (5.1.3)
|
actionpack (5.1.4)
|
||||||
actionview (= 5.1.3)
|
actionview (= 5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
rack (~> 2.0)
|
rack (~> 2.0)
|
||||||
rack-test (~> 0.6.3)
|
rack-test (>= 0.6.3)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
||||||
actionview (5.1.3)
|
actionview (5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
builder (~> 3.1)
|
builder (~> 3.1)
|
||||||
erubi (~> 1.4)
|
erubi (~> 1.4)
|
||||||
rails-dom-testing (~> 2.0)
|
rails-dom-testing (~> 2.0)
|
||||||
@@ -30,16 +30,16 @@ GEM
|
|||||||
case_transform (>= 0.2)
|
case_transform (>= 0.2)
|
||||||
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
|
jsonapi-renderer (>= 0.1.1.beta1, < 0.2)
|
||||||
active_record_query_trace (1.5.4)
|
active_record_query_trace (1.5.4)
|
||||||
activejob (5.1.3)
|
activejob (5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
globalid (>= 0.3.6)
|
globalid (>= 0.3.6)
|
||||||
activemodel (5.1.3)
|
activemodel (5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
activerecord (5.1.3)
|
activerecord (5.1.4)
|
||||||
activemodel (= 5.1.3)
|
activemodel (= 5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
arel (~> 8.0)
|
arel (~> 8.0)
|
||||||
activesupport (5.1.3)
|
activesupport (5.1.4)
|
||||||
concurrent-ruby (~> 1.0, >= 1.0.2)
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
||||||
i18n (~> 0.7)
|
i18n (~> 0.7)
|
||||||
minitest (~> 5.1)
|
minitest (~> 5.1)
|
||||||
@@ -57,33 +57,33 @@ 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.21)
|
aws-sdk (2.10.46)
|
||||||
aws-sdk-resources (= 2.10.21)
|
aws-sdk-resources (= 2.10.46)
|
||||||
aws-sdk-core (2.10.21)
|
aws-sdk-core (2.10.46)
|
||||||
aws-sigv4 (~> 1.0)
|
aws-sigv4 (~> 1.0)
|
||||||
jmespath (~> 1.0)
|
jmespath (~> 1.0)
|
||||||
aws-sdk-resources (2.10.21)
|
aws-sdk-resources (2.10.46)
|
||||||
aws-sdk-core (= 2.10.21)
|
aws-sdk-core (= 2.10.46)
|
||||||
aws-sigv4 (1.0.1)
|
aws-sigv4 (1.0.2)
|
||||||
bcrypt (3.1.11)
|
bcrypt (3.1.11)
|
||||||
better_errors (2.1.1)
|
better_errors (2.3.0)
|
||||||
coderay (>= 1.0.0)
|
coderay (>= 1.0.0)
|
||||||
erubis (>= 2.6.6)
|
erubi (>= 1.0.0)
|
||||||
rack (>= 0.9.0)
|
rack (>= 0.9.0)
|
||||||
binding_of_caller (0.7.2)
|
binding_of_caller (0.7.2)
|
||||||
debug_inspector (>= 0.0.1)
|
debug_inspector (>= 0.0.1)
|
||||||
bootsnap (1.1.2)
|
bootsnap (1.1.3)
|
||||||
msgpack (~> 1.0)
|
msgpack (~> 1.0)
|
||||||
brakeman (3.7.2)
|
brakeman (4.0.1)
|
||||||
browser (2.4.0)
|
browser (2.5.1)
|
||||||
builder (3.2.3)
|
builder (3.2.3)
|
||||||
bullet (5.5.1)
|
bullet (5.6.1)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
uniform_notifier (~> 1.10.0)
|
uniform_notifier (~> 1.10.0)
|
||||||
bundler-audit (0.6.0)
|
bundler-audit (0.6.0)
|
||||||
bundler (~> 1.2)
|
bundler (~> 1.2)
|
||||||
thor (~> 0.18)
|
thor (~> 0.18)
|
||||||
capistrano (3.8.2)
|
capistrano (3.9.1)
|
||||||
airbrussh (>= 1.0.0)
|
airbrussh (>= 1.0.0)
|
||||||
i18n
|
i18n
|
||||||
rake (>= 10.0.0)
|
rake (>= 10.0.0)
|
||||||
@@ -99,9 +99,9 @@ GEM
|
|||||||
sshkit (~> 1.3)
|
sshkit (~> 1.3)
|
||||||
capistrano-yarn (2.0.2)
|
capistrano-yarn (2.0.2)
|
||||||
capistrano (~> 3.0)
|
capistrano (~> 3.0)
|
||||||
capybara (2.14.4)
|
capybara (2.15.1)
|
||||||
addressable
|
addressable
|
||||||
mime-types (>= 1.16)
|
mini_mime (>= 0.1.3)
|
||||||
nokogiri (>= 1.3.3)
|
nokogiri (>= 1.3.3)
|
||||||
rack (>= 1.0.0)
|
rack (>= 1.0.0)
|
||||||
rack-test (>= 0.5.4)
|
rack-test (>= 0.5.4)
|
||||||
@@ -110,12 +110,12 @@ GEM
|
|||||||
activesupport
|
activesupport
|
||||||
charlock_holmes (0.7.5)
|
charlock_holmes (0.7.5)
|
||||||
chunky_png (1.3.8)
|
chunky_png (1.3.8)
|
||||||
cld3 (3.1.3)
|
cld3 (3.2.0)
|
||||||
ffi (>= 1.1.0, < 1.10.0)
|
ffi (>= 1.1.0, < 1.10.0)
|
||||||
climate_control (0.2.0)
|
climate_control (0.2.0)
|
||||||
cocaine (0.5.8)
|
cocaine (0.5.8)
|
||||||
climate_control (>= 0.0.3, < 1.0)
|
climate_control (>= 0.0.3, < 1.0)
|
||||||
coderay (1.1.1)
|
coderay (1.1.2)
|
||||||
colorize (0.8.1)
|
colorize (0.8.1)
|
||||||
concurrent-ruby (1.0.5)
|
concurrent-ruby (1.0.5)
|
||||||
connection_pool (2.2.1)
|
connection_pool (2.2.1)
|
||||||
@@ -151,13 +151,12 @@ GEM
|
|||||||
thread_safe
|
thread_safe
|
||||||
encryptor (3.0.0)
|
encryptor (3.0.0)
|
||||||
erubi (1.6.1)
|
erubi (1.6.1)
|
||||||
erubis (2.7.0)
|
|
||||||
et-orbi (1.0.5)
|
et-orbi (1.0.5)
|
||||||
tzinfo
|
tzinfo
|
||||||
excon (0.58.0)
|
excon (0.59.0)
|
||||||
execjs (2.7.0)
|
execjs (2.7.0)
|
||||||
fabrication (2.16.2)
|
fabrication (2.16.3)
|
||||||
faker (1.7.3)
|
faker (1.8.4)
|
||||||
i18n (~> 0.5)
|
i18n (~> 0.5)
|
||||||
fast_blank (1.0.0)
|
fast_blank (1.0.0)
|
||||||
ffi (1.9.18)
|
ffi (1.9.18)
|
||||||
@@ -194,7 +193,7 @@ GEM
|
|||||||
railties (>= 4.0.1)
|
railties (>= 4.0.1)
|
||||||
hamster (3.0.0)
|
hamster (3.0.0)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
hashdiff (0.3.5)
|
hashdiff (0.3.7)
|
||||||
highline (1.7.8)
|
highline (1.7.8)
|
||||||
hiredis (0.6.1)
|
hiredis (0.6.1)
|
||||||
hkdf (0.3.0)
|
hkdf (0.3.0)
|
||||||
@@ -213,11 +212,11 @@ GEM
|
|||||||
colorize
|
colorize
|
||||||
rack
|
rack
|
||||||
i18n (0.8.6)
|
i18n (0.8.6)
|
||||||
i18n-tasks (0.9.16)
|
i18n-tasks (0.9.18)
|
||||||
activesupport (>= 4.0.2)
|
activesupport (>= 4.0.2)
|
||||||
ast (>= 2.1.0)
|
ast (>= 2.1.0)
|
||||||
easy_translate (>= 0.5.0)
|
easy_translate (>= 0.5.0)
|
||||||
erubis
|
erubi
|
||||||
highline (>= 1.7.3)
|
highline (>= 1.7.3)
|
||||||
i18n
|
i18n
|
||||||
parser (>= 2.2.3.0)
|
parser (>= 2.2.3.0)
|
||||||
@@ -231,7 +230,7 @@ GEM
|
|||||||
json-ld (2.1.5)
|
json-ld (2.1.5)
|
||||||
multi_json (~> 1.12)
|
multi_json (~> 1.12)
|
||||||
rdf (~> 2.2)
|
rdf (~> 2.2)
|
||||||
json-ld-preloaded (2.2.1)
|
json-ld-preloaded (2.2.2)
|
||||||
json-ld (~> 2.1, >= 2.1.5)
|
json-ld (~> 2.1, >= 2.1.5)
|
||||||
multi_json (~> 1.11)
|
multi_json (~> 1.11)
|
||||||
rdf (~> 2.2)
|
rdf (~> 2.2)
|
||||||
@@ -258,10 +257,11 @@ GEM
|
|||||||
letter_opener (~> 1.0)
|
letter_opener (~> 1.0)
|
||||||
railties (>= 3.2)
|
railties (>= 3.2)
|
||||||
link_header (0.0.8)
|
link_header (0.0.8)
|
||||||
lograge (0.5.1)
|
lograge (0.6.0)
|
||||||
actionpack (>= 4, < 5.2)
|
actionpack (>= 4, < 5.2)
|
||||||
activesupport (>= 4, < 5.2)
|
activesupport (>= 4, < 5.2)
|
||||||
railties (>= 4, < 5.2)
|
railties (>= 4, < 5.2)
|
||||||
|
request_store (~> 1.0)
|
||||||
loofah (2.0.3)
|
loofah (2.0.3)
|
||||||
nokogiri (>= 1.5.9)
|
nokogiri (>= 1.5.9)
|
||||||
mail (2.6.6)
|
mail (2.6.6)
|
||||||
@@ -276,27 +276,33 @@ GEM
|
|||||||
mime-types-data (~> 3.2015)
|
mime-types-data (~> 3.2015)
|
||||||
mime-types-data (3.2016.0521)
|
mime-types-data (3.2016.0521)
|
||||||
mimemagic (0.3.2)
|
mimemagic (0.3.2)
|
||||||
|
mini_mime (0.1.4)
|
||||||
mini_portile2 (2.2.0)
|
mini_portile2 (2.2.0)
|
||||||
minitest (5.10.3)
|
minitest (5.10.3)
|
||||||
msgpack (1.1.0)
|
msgpack (1.1.0)
|
||||||
multi_json (1.12.1)
|
multi_json (1.12.2)
|
||||||
net-scp (1.2.1)
|
net-scp (1.2.1)
|
||||||
net-ssh (>= 2.6.5)
|
net-ssh (>= 2.6.5)
|
||||||
net-ssh (4.1.0)
|
net-ssh (4.2.0)
|
||||||
nio4r (2.1.0)
|
nio4r (2.1.0)
|
||||||
nokogiri (1.8.0)
|
nokogiri (1.8.0)
|
||||||
mini_portile2 (~> 2.2.0)
|
mini_portile2 (~> 2.2.0)
|
||||||
nokogumbo (1.4.13)
|
nokogumbo (1.4.13)
|
||||||
nokogiri
|
nokogiri
|
||||||
oj (3.3.4)
|
nsa (0.2.4)
|
||||||
openssl (2.0.4)
|
activesupport (>= 4.2, < 6)
|
||||||
|
concurrent-ruby (~> 1.0.0)
|
||||||
|
sidekiq (>= 3.5.0)
|
||||||
|
statsd-ruby (~> 1.2.0)
|
||||||
|
oj (3.3.5)
|
||||||
|
openssl (2.0.5)
|
||||||
orm_adapter (0.5.0)
|
orm_adapter (0.5.0)
|
||||||
ostatus2 (2.0.1)
|
ostatus2 (2.0.1)
|
||||||
addressable (~> 2.4)
|
addressable (~> 2.4)
|
||||||
http (~> 2.0)
|
http (~> 2.0)
|
||||||
nokogiri (~> 1.6)
|
nokogiri (~> 1.6)
|
||||||
openssl (~> 2.0)
|
openssl (~> 2.0)
|
||||||
ox (2.5.0)
|
ox (2.6.0)
|
||||||
paperclip (5.1.0)
|
paperclip (5.1.0)
|
||||||
activemodel (>= 4.2.0)
|
activemodel (>= 4.2.0)
|
||||||
activesupport (>= 4.2.0)
|
activesupport (>= 4.2.0)
|
||||||
@@ -306,15 +312,15 @@ GEM
|
|||||||
paperclip-av-transcoder (0.6.4)
|
paperclip-av-transcoder (0.6.4)
|
||||||
av (~> 0.9.0)
|
av (~> 0.9.0)
|
||||||
paperclip (>= 2.5.2)
|
paperclip (>= 2.5.2)
|
||||||
parallel (1.11.2)
|
parallel (1.12.0)
|
||||||
parallel_tests (2.14.2)
|
parallel_tests (2.15.0)
|
||||||
parallel
|
parallel
|
||||||
parser (2.4.0.0)
|
parser (2.4.0.0)
|
||||||
ast (~> 2.2)
|
ast (~> 2.2)
|
||||||
pg (0.21.0)
|
pg (0.21.0)
|
||||||
pghero (1.7.0)
|
pghero (1.7.0)
|
||||||
activerecord
|
activerecord
|
||||||
pkg-config (1.2.4)
|
pkg-config (1.2.7)
|
||||||
powerpack (0.1.1)
|
powerpack (0.1.1)
|
||||||
pry (0.10.4)
|
pry (0.10.4)
|
||||||
coderay (~> 1.1.0)
|
coderay (~> 1.1.0)
|
||||||
@@ -323,7 +329,7 @@ GEM
|
|||||||
pry-rails (0.3.6)
|
pry-rails (0.3.6)
|
||||||
pry (>= 0.10.4)
|
pry (>= 0.10.4)
|
||||||
public_suffix (3.0.0)
|
public_suffix (3.0.0)
|
||||||
puma (3.9.1)
|
puma (3.10.0)
|
||||||
pundit (1.1.0)
|
pundit (1.1.0)
|
||||||
activesupport (>= 3.0.0)
|
activesupport (>= 3.0.0)
|
||||||
rabl (0.13.1)
|
rabl (0.13.1)
|
||||||
@@ -334,20 +340,22 @@ GEM
|
|||||||
rack-cors (0.4.1)
|
rack-cors (0.4.1)
|
||||||
rack-protection (2.0.0)
|
rack-protection (2.0.0)
|
||||||
rack
|
rack
|
||||||
rack-test (0.6.3)
|
rack-proxy (0.6.2)
|
||||||
rack (>= 1.0)
|
rack
|
||||||
|
rack-test (0.7.0)
|
||||||
|
rack (>= 1.0, < 3)
|
||||||
rack-timeout (0.4.2)
|
rack-timeout (0.4.2)
|
||||||
rails (5.1.3)
|
rails (5.1.4)
|
||||||
actioncable (= 5.1.3)
|
actioncable (= 5.1.4)
|
||||||
actionmailer (= 5.1.3)
|
actionmailer (= 5.1.4)
|
||||||
actionpack (= 5.1.3)
|
actionpack (= 5.1.4)
|
||||||
actionview (= 5.1.3)
|
actionview (= 5.1.4)
|
||||||
activejob (= 5.1.3)
|
activejob (= 5.1.4)
|
||||||
activemodel (= 5.1.3)
|
activemodel (= 5.1.4)
|
||||||
activerecord (= 5.1.3)
|
activerecord (= 5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
bundler (>= 1.3.0)
|
bundler (>= 1.3.0)
|
||||||
railties (= 5.1.3)
|
railties (= 5.1.4)
|
||||||
sprockets-rails (>= 2.0.0)
|
sprockets-rails (>= 2.0.0)
|
||||||
rails-controller-testing (1.0.2)
|
rails-controller-testing (1.0.2)
|
||||||
actionpack (~> 5.x, >= 5.0.1)
|
actionpack (~> 5.x, >= 5.0.1)
|
||||||
@@ -363,16 +371,16 @@ GEM
|
|||||||
railties (~> 5.0)
|
railties (~> 5.0)
|
||||||
rails-settings-cached (0.6.6)
|
rails-settings-cached (0.6.6)
|
||||||
rails (>= 4.2.0)
|
rails (>= 4.2.0)
|
||||||
railties (5.1.3)
|
railties (5.1.4)
|
||||||
actionpack (= 5.1.3)
|
actionpack (= 5.1.4)
|
||||||
activesupport (= 5.1.3)
|
activesupport (= 5.1.4)
|
||||||
method_source
|
method_source
|
||||||
rake (>= 0.8.7)
|
rake (>= 0.8.7)
|
||||||
thor (>= 0.18.1, < 2.0)
|
thor (>= 0.18.1, < 2.0)
|
||||||
rainbow (2.2.2)
|
rainbow (2.2.2)
|
||||||
rake
|
rake
|
||||||
rake (12.0.0)
|
rake (12.1.0)
|
||||||
rdf (2.2.8)
|
rdf (2.2.9)
|
||||||
hamster (~> 3.0)
|
hamster (~> 3.0)
|
||||||
link_header (~> 0.0, >= 0.0.8)
|
link_header (~> 0.0, >= 0.0.8)
|
||||||
rdf-normalize (0.3.2)
|
rdf-normalize (0.3.2)
|
||||||
@@ -396,6 +404,7 @@ GEM
|
|||||||
redis-store (>= 1.2, < 2)
|
redis-store (>= 1.2, < 2)
|
||||||
redis-store (1.3.0)
|
redis-store (1.3.0)
|
||||||
redis (>= 2.2)
|
redis (>= 2.2)
|
||||||
|
request_store (1.3.2)
|
||||||
responders (2.4.0)
|
responders (2.4.0)
|
||||||
actionpack (>= 4.2.0, < 5.3)
|
actionpack (>= 4.2.0, < 5.3)
|
||||||
railties (>= 4.2.0, < 5.3)
|
railties (>= 4.2.0, < 5.3)
|
||||||
@@ -410,7 +419,7 @@ GEM
|
|||||||
rspec-mocks (3.6.0)
|
rspec-mocks (3.6.0)
|
||||||
diff-lcs (>= 1.2.0, < 2.0)
|
diff-lcs (>= 1.2.0, < 2.0)
|
||||||
rspec-support (~> 3.6.0)
|
rspec-support (~> 3.6.0)
|
||||||
rspec-rails (3.6.0)
|
rspec-rails (3.6.1)
|
||||||
actionpack (>= 3.0)
|
actionpack (>= 3.0)
|
||||||
activesupport (>= 3.0)
|
activesupport (>= 3.0)
|
||||||
railties (>= 3.0)
|
railties (>= 3.0)
|
||||||
@@ -422,15 +431,15 @@ GEM
|
|||||||
rspec-core (~> 3.0, >= 3.0.0)
|
rspec-core (~> 3.0, >= 3.0.0)
|
||||||
sidekiq (>= 2.4.0)
|
sidekiq (>= 2.4.0)
|
||||||
rspec-support (3.6.0)
|
rspec-support (3.6.0)
|
||||||
rubocop (0.49.1)
|
rubocop (0.50.0)
|
||||||
parallel (~> 1.10)
|
parallel (~> 1.10)
|
||||||
parser (>= 2.3.3.1, < 3.0)
|
parser (>= 2.3.3.1, < 3.0)
|
||||||
powerpack (~> 0.1)
|
powerpack (~> 0.1)
|
||||||
rainbow (>= 1.99.1, < 3.0)
|
rainbow (>= 2.2.2, < 3.0)
|
||||||
ruby-progressbar (~> 1.7)
|
ruby-progressbar (~> 1.7)
|
||||||
unicode-display_width (~> 1.0, >= 1.0.1)
|
unicode-display_width (~> 1.0, >= 1.0.1)
|
||||||
ruby-oembed (0.12.0)
|
ruby-oembed (0.12.0)
|
||||||
ruby-progressbar (1.8.1)
|
ruby-progressbar (1.8.3)
|
||||||
rufus-scheduler (3.4.2)
|
rufus-scheduler (3.4.2)
|
||||||
et-orbi (~> 1.0)
|
et-orbi (~> 1.0)
|
||||||
safe_yaml (1.0.4)
|
safe_yaml (1.0.4)
|
||||||
@@ -438,7 +447,7 @@ GEM
|
|||||||
crass (~> 1.0.2)
|
crass (~> 1.0.2)
|
||||||
nokogiri (>= 1.4.4)
|
nokogiri (>= 1.4.4)
|
||||||
nokogumbo (~> 1.4.1)
|
nokogumbo (~> 1.4.1)
|
||||||
sass (3.4.24)
|
sass (3.4.25)
|
||||||
scss_lint (0.54.0)
|
scss_lint (0.54.0)
|
||||||
rake (>= 0.9, < 13)
|
rake (>= 0.9, < 13)
|
||||||
sass (~> 3.4.20)
|
sass (~> 3.4.20)
|
||||||
@@ -450,12 +459,12 @@ GEM
|
|||||||
sidekiq-bulk (0.1.1)
|
sidekiq-bulk (0.1.1)
|
||||||
activesupport
|
activesupport
|
||||||
sidekiq
|
sidekiq
|
||||||
sidekiq-scheduler (2.1.8)
|
sidekiq-scheduler (2.1.9)
|
||||||
redis (~> 3)
|
redis (~> 3)
|
||||||
rufus-scheduler (~> 3.2)
|
rufus-scheduler (~> 3.2)
|
||||||
sidekiq (>= 3)
|
sidekiq (>= 3)
|
||||||
tilt (>= 1.4.0)
|
tilt (>= 1.4.0)
|
||||||
sidekiq-unique-jobs (5.0.9)
|
sidekiq-unique-jobs (5.0.10)
|
||||||
sidekiq (>= 4.0, <= 6.0)
|
sidekiq (>= 4.0, <= 6.0)
|
||||||
thor (~> 0)
|
thor (~> 0)
|
||||||
simple-navigation (4.0.5)
|
simple-navigation (4.0.5)
|
||||||
@@ -463,23 +472,25 @@ GEM
|
|||||||
simple_form (3.5.0)
|
simple_form (3.5.0)
|
||||||
actionpack (> 4, < 5.2)
|
actionpack (> 4, < 5.2)
|
||||||
activemodel (> 4, < 5.2)
|
activemodel (> 4, < 5.2)
|
||||||
simplecov (0.14.1)
|
simplecov (0.15.1)
|
||||||
docile (~> 1.1.0)
|
docile (~> 1.1.0)
|
||||||
json (>= 1.8, < 3)
|
json (>= 1.8, < 3)
|
||||||
simplecov-html (~> 0.10.0)
|
simplecov-html (~> 0.10.0)
|
||||||
simplecov-html (0.10.1)
|
simplecov-html (0.10.2)
|
||||||
slop (3.6.0)
|
slop (3.6.0)
|
||||||
sprockets (3.7.1)
|
sprockets (3.7.1)
|
||||||
concurrent-ruby (~> 1.0)
|
concurrent-ruby (~> 1.0)
|
||||||
rack (> 1, < 3)
|
rack (> 1, < 3)
|
||||||
sprockets-rails (3.2.0)
|
sprockets-rails (3.2.1)
|
||||||
actionpack (>= 4.0)
|
actionpack (>= 4.0)
|
||||||
activesupport (>= 4.0)
|
activesupport (>= 4.0)
|
||||||
sprockets (>= 3.0.0)
|
sprockets (>= 3.0.0)
|
||||||
sshkit (1.13.1)
|
sshkit (1.14.0)
|
||||||
net-scp (>= 1.1.2)
|
net-scp (>= 1.1.2)
|
||||||
net-ssh (>= 2.8.0)
|
net-ssh (>= 2.8.0)
|
||||||
statsd-instrument (2.1.4)
|
statsd-ruby (1.2.1)
|
||||||
|
strong_migrations (0.1.9)
|
||||||
|
activerecord (>= 3.2.0)
|
||||||
temple (0.8.0)
|
temple (0.8.0)
|
||||||
terminal-table (1.8.0)
|
terminal-table (1.8.0)
|
||||||
unicode-display_width (~> 1.1, >= 1.1.1)
|
unicode-display_width (~> 1.1, >= 1.1.1)
|
||||||
@@ -502,13 +513,13 @@ GEM
|
|||||||
uniform_notifier (1.10.0)
|
uniform_notifier (1.10.0)
|
||||||
warden (1.2.7)
|
warden (1.2.7)
|
||||||
rack (>= 1.0)
|
rack (>= 1.0)
|
||||||
webmock (3.0.1)
|
webmock (3.1.0)
|
||||||
addressable (>= 2.3.6)
|
addressable (>= 2.3.6)
|
||||||
crack (>= 0.3.2)
|
crack (>= 0.3.2)
|
||||||
hashdiff
|
hashdiff
|
||||||
webpacker (2.0)
|
webpacker (3.0.1)
|
||||||
activesupport (>= 4.2)
|
activesupport (>= 4.2)
|
||||||
multi_json (~> 1.2)
|
rack-proxy (>= 0.6.1)
|
||||||
railties (>= 4.2)
|
railties (>= 4.2)
|
||||||
webpush (0.3.2)
|
webpush (0.3.2)
|
||||||
hkdf (~> 0.2)
|
hkdf (~> 0.2)
|
||||||
@@ -531,17 +542,17 @@ DEPENDENCIES
|
|||||||
better_errors (~> 2.1)
|
better_errors (~> 2.1)
|
||||||
binding_of_caller (~> 0.7)
|
binding_of_caller (~> 0.7)
|
||||||
bootsnap
|
bootsnap
|
||||||
brakeman (~> 3.6)
|
brakeman (~> 4.0)
|
||||||
browser
|
browser
|
||||||
bullet (~> 5.5)
|
bullet (~> 5.5)
|
||||||
bundler-audit (~> 0.5)
|
bundler-audit (~> 0.6)
|
||||||
capistrano (~> 3.8)
|
capistrano (~> 3.8)
|
||||||
capistrano-rails (~> 1.2)
|
capistrano-rails (~> 1.2)
|
||||||
capistrano-rbenv (~> 2.1)
|
capistrano-rbenv (~> 2.1)
|
||||||
capistrano-yarn (~> 2.0)
|
capistrano-yarn (~> 2.0)
|
||||||
capybara (~> 2.14)
|
capybara (~> 2.14)
|
||||||
charlock_holmes (~> 0.7.5)
|
charlock_holmes (~> 0.7.5)
|
||||||
cld3 (~> 3.1)
|
cld3 (~> 3.2.0)
|
||||||
climate_control (~> 0.2)
|
climate_control (~> 0.2)
|
||||||
devise (~> 4.2)
|
devise (~> 4.2)
|
||||||
devise-two-factor (~> 3.0)
|
devise-two-factor (~> 3.0)
|
||||||
@@ -572,6 +583,7 @@ DEPENDENCIES
|
|||||||
microformats (~> 4.0)
|
microformats (~> 4.0)
|
||||||
mime-types (~> 3.1)
|
mime-types (~> 3.1)
|
||||||
nokogiri (~> 1.7)
|
nokogiri (~> 1.7)
|
||||||
|
nsa (~> 0.2)
|
||||||
oj (~> 3.0)
|
oj (~> 3.0)
|
||||||
ostatus2 (~> 2.0)
|
ostatus2 (~> 2.0)
|
||||||
ox (~> 2.5)
|
ox (~> 2.5)
|
||||||
@@ -582,13 +594,13 @@ DEPENDENCIES
|
|||||||
pghero (~> 1.7)
|
pghero (~> 1.7)
|
||||||
pkg-config (~> 1.2)
|
pkg-config (~> 1.2)
|
||||||
pry-rails (~> 0.3)
|
pry-rails (~> 0.3)
|
||||||
puma (~> 3.8)
|
puma (~> 3.10)
|
||||||
pundit (~> 1.1)
|
pundit (~> 1.1)
|
||||||
rabl (~> 0.13)
|
rabl (~> 0.13)
|
||||||
rack-attack (~> 5.0)
|
rack-attack (~> 5.0)
|
||||||
rack-cors (~> 0.4)
|
rack-cors (~> 0.4)
|
||||||
rack-timeout (~> 0.4)
|
rack-timeout (~> 0.4)
|
||||||
rails (~> 5.1.0)
|
rails (~> 5.1.4)
|
||||||
rails-controller-testing (~> 1.0)
|
rails-controller-testing (~> 1.0)
|
||||||
rails-i18n (~> 5.0)
|
rails-i18n (~> 5.0)
|
||||||
rails-settings-cached (~> 0.6)
|
rails-settings-cached (~> 0.6)
|
||||||
@@ -611,16 +623,16 @@ DEPENDENCIES
|
|||||||
simple_form (~> 3.4)
|
simple_form (~> 3.4)
|
||||||
simplecov (~> 0.14)
|
simplecov (~> 0.14)
|
||||||
sprockets-rails (~> 3.2)
|
sprockets-rails (~> 3.2)
|
||||||
statsd-instrument (~> 2.1)
|
strong_migrations
|
||||||
twitter-text (~> 1.14)
|
twitter-text (~> 1.14)
|
||||||
tzinfo-data (~> 1.2017)
|
tzinfo-data (~> 1.2017)
|
||||||
uglifier (~> 3.2)
|
uglifier (~> 3.2)
|
||||||
webmock (~> 3.0)
|
webmock (~> 3.0)
|
||||||
webpacker (~> 2.0)
|
webpacker (~> 3.0)
|
||||||
webpush
|
webpush
|
||||||
|
|
||||||
RUBY VERSION
|
RUBY VERSION
|
||||||
ruby 2.4.1p111
|
ruby 2.4.2p198
|
||||||
|
|
||||||
BUNDLED WITH
|
BUNDLED WITH
|
||||||
1.15.4
|
1.15.4
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
web: PORT=3000 bundle exec puma -C config/puma.rb
|
web: PORT=3000 bundle exec puma -C config/puma.rb
|
||||||
sidekiq: PORT=3000 bundle exec sidekiq
|
sidekiq: PORT=3000 bundle exec sidekiq
|
||||||
stream: PORT=4000 yarn run start
|
stream: PORT=4000 yarn run start
|
||||||
webpack: ./bin/webpack-dev-server --host 0.0.0.0
|
webpack: ./bin/webpack-dev-server --listen-host 0.0.0.0
|
||||||
|
|||||||
@@ -26,7 +26,10 @@ class AccountsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: @account, serializer: ActivityPub::ActorSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
render json: @account,
|
||||||
|
serializer: ActivityPub::ActorSerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -9,9 +9,9 @@ class ActivityPub::InboxesController < Api::BaseController
|
|||||||
if signed_request_account
|
if signed_request_account
|
||||||
upgrade_account
|
upgrade_account
|
||||||
process_payload
|
process_payload
|
||||||
head 201
|
|
||||||
else
|
|
||||||
head 202
|
head 202
|
||||||
|
else
|
||||||
|
[signature_verification_failure_reason, 401]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@ class ActivityPub::InboxesController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed?
|
Pubsubhubbub::UnsubscribeWorker.perform_async(signed_request_account.id) if signed_request_account.subscribed?
|
||||||
|
DeliveryFailureTracker.track_inverse_success!(signed_request_account)
|
||||||
end
|
end
|
||||||
|
|
||||||
def process_payload
|
def process_payload
|
||||||
|
|||||||
31
app/controllers/admin/account_moderation_notes_controller.rb
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Admin::AccountModerationNotesController < Admin::BaseController
|
||||||
|
def create
|
||||||
|
@account_moderation_note = current_account.account_moderation_notes.new(resource_params)
|
||||||
|
if @account_moderation_note.save
|
||||||
|
@target_account = @account_moderation_note.target_account
|
||||||
|
redirect_to admin_account_path(@target_account.id), notice: I18n.t('admin.account_moderation_notes.created_msg')
|
||||||
|
else
|
||||||
|
@account = @account_moderation_note.target_account
|
||||||
|
@moderation_notes = @account.targeted_moderation_notes.latest
|
||||||
|
render template: 'admin/accounts/show'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@account_moderation_note = AccountModerationNote.find(params[:id])
|
||||||
|
@target_account = @account_moderation_note.target_account
|
||||||
|
@account_moderation_note.destroy
|
||||||
|
redirect_to admin_account_path(@target_account.id), notice: I18n.t('admin.account_moderation_notes.destroyed_msg')
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def resource_params
|
||||||
|
params.require(:account_moderation_note).permit(
|
||||||
|
:content,
|
||||||
|
:target_account_id
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -9,7 +9,10 @@ module Admin
|
|||||||
@accounts = filtered_accounts.page(params[:page])
|
@accounts = filtered_accounts.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
def show; end
|
def show
|
||||||
|
@account_moderation_note = current_account.account_moderation_notes.new(target_account: @account)
|
||||||
|
@moderation_notes = @account.targeted_moderation_notes.latest
|
||||||
|
end
|
||||||
|
|
||||||
def subscribe
|
def subscribe
|
||||||
Pubsubhubbub::SubscribeWorker.perform_async(@account.id)
|
Pubsubhubbub::SubscribeWorker.perform_async(@account.id)
|
||||||
|
|||||||
73
app/controllers/admin/custom_emojis_controller.rb
Normal file
@@ -0,0 +1,73 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Admin
|
||||||
|
class CustomEmojisController < BaseController
|
||||||
|
before_action :set_custom_emoji, except: [:index, :new, :create]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@custom_emojis = filtered_custom_emojis.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@custom_emoji = CustomEmoji.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@custom_emoji = CustomEmoji.new(resource_params)
|
||||||
|
|
||||||
|
if @custom_emoji.save
|
||||||
|
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.created_msg')
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@custom_emoji.destroy
|
||||||
|
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.destroyed_msg')
|
||||||
|
end
|
||||||
|
|
||||||
|
def copy
|
||||||
|
emoji = CustomEmoji.new(domain: nil, shortcode: @custom_emoji.shortcode, image: @custom_emoji.image)
|
||||||
|
|
||||||
|
if emoji.save
|
||||||
|
flash[:notice] = I18n.t('admin.custom_emojis.copied_msg')
|
||||||
|
else
|
||||||
|
flash[:alert] = I18n.t('admin.custom_emojis.copy_failed_msg')
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to admin_custom_emojis_path(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def enable
|
||||||
|
@custom_emoji.update!(disabled: false)
|
||||||
|
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.enabled_msg')
|
||||||
|
end
|
||||||
|
|
||||||
|
def disable
|
||||||
|
@custom_emoji.update!(disabled: true)
|
||||||
|
redirect_to admin_custom_emojis_path, notice: I18n.t('admin.custom_emojis.disabled_msg')
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_custom_emoji
|
||||||
|
@custom_emoji = CustomEmoji.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def resource_params
|
||||||
|
params.require(:custom_emoji).permit(:shortcode, :image)
|
||||||
|
end
|
||||||
|
|
||||||
|
def filtered_custom_emojis
|
||||||
|
CustomEmojiFilter.new(filter_params).results
|
||||||
|
end
|
||||||
|
|
||||||
|
def filter_params
|
||||||
|
params.permit(
|
||||||
|
:local,
|
||||||
|
:remote
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
40
app/controllers/admin/email_domain_blocks_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Admin
|
||||||
|
class EmailDomainBlocksController < BaseController
|
||||||
|
before_action :set_email_domain_block, only: [:show, :destroy]
|
||||||
|
|
||||||
|
def index
|
||||||
|
@email_domain_blocks = EmailDomainBlock.page(params[:page])
|
||||||
|
end
|
||||||
|
|
||||||
|
def new
|
||||||
|
@email_domain_block = EmailDomainBlock.new
|
||||||
|
end
|
||||||
|
|
||||||
|
def create
|
||||||
|
@email_domain_block = EmailDomainBlock.new(resource_params)
|
||||||
|
|
||||||
|
if @email_domain_block.save
|
||||||
|
redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.created_msg')
|
||||||
|
else
|
||||||
|
render :new
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def destroy
|
||||||
|
@email_domain_block.destroy
|
||||||
|
redirect_to admin_email_domain_blocks_path, notice: I18n.t('admin.email_domain_blocks.destroyed_msg')
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_email_domain_block
|
||||||
|
@email_domain_block = EmailDomainBlock.find(params[:id])
|
||||||
|
end
|
||||||
|
|
||||||
|
def resource_params
|
||||||
|
params.require(:email_domain_block).permit(:domain)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -14,8 +14,12 @@ module Admin
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def filtered_instances
|
||||||
|
InstanceFilter.new(filter_params).results
|
||||||
|
end
|
||||||
|
|
||||||
def paginated_instances
|
def paginated_instances
|
||||||
Account.remote.by_domain_accounts.page(params[:page])
|
filtered_instances.page(params[:page])
|
||||||
end
|
end
|
||||||
|
|
||||||
helper_method :paginated_instances
|
helper_method :paginated_instances
|
||||||
@@ -27,5 +31,11 @@ module Admin
|
|||||||
def subscribeable_accounts
|
def subscribeable_accounts
|
||||||
Account.with_followers.remote.where(domain: params[:by_domain])
|
Account.with_followers.remote.where(domain: params[:by_domain])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def filter_params
|
||||||
|
params.permit(
|
||||||
|
:domain_name
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ module Admin
|
|||||||
open_deletion
|
open_deletion
|
||||||
timeline_preview
|
timeline_preview
|
||||||
bootstrap_timeline_accounts
|
bootstrap_timeline_accounts
|
||||||
|
thumbnail
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
BOOLEAN_SETTINGS = %w(
|
BOOLEAN_SETTINGS = %w(
|
||||||
@@ -22,14 +23,23 @@ module Admin
|
|||||||
timeline_preview
|
timeline_preview
|
||||||
).freeze
|
).freeze
|
||||||
|
|
||||||
|
UPLOAD_SETTINGS = %w(
|
||||||
|
thumbnail
|
||||||
|
).freeze
|
||||||
|
|
||||||
def edit
|
def edit
|
||||||
@admin_settings = Form::AdminSettings.new
|
@admin_settings = Form::AdminSettings.new
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
settings_params.each do |key, value|
|
settings_params.each do |key, value|
|
||||||
setting = Setting.where(var: key).first_or_initialize(var: key)
|
if UPLOAD_SETTINGS.include?(key)
|
||||||
setting.update(value: value_for_update(key, value))
|
upload = SiteUpload.where(var: key).first_or_initialize(var: key)
|
||||||
|
upload.update(file: value)
|
||||||
|
else
|
||||||
|
setting = Setting.where(var: key).first_or_initialize(var: key)
|
||||||
|
setting.update(value: value_for_update(key, value))
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
flash[:notice] = I18n.t('generic.changes_saved_msg')
|
flash[:notice] = I18n.t('generic.changes_saved_msg')
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ class Api::SalmonController < Api::BaseController
|
|||||||
def update
|
def update
|
||||||
if verify_payload?
|
if verify_payload?
|
||||||
process_salmon
|
process_salmon
|
||||||
head 201
|
|
||||||
else
|
|
||||||
head 202
|
head 202
|
||||||
|
elsif payload.present?
|
||||||
|
[signature_verification_failure_reason, 401]
|
||||||
|
else
|
||||||
|
head 400
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,10 @@ class Api::V1::Accounts::RelationshipsController < Api::BaseController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@accounts = Account.where(id: account_ids).select('id')
|
accounts = Account.where(id: account_ids).select('id')
|
||||||
|
# .where doesn't guarantee that our results are in the same order
|
||||||
|
# we requested them, so return the "right" order to the requestor.
|
||||||
|
@accounts = accounts.index_by(&:id).values_at(*account_ids)
|
||||||
render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
|
render json: @accounts, each_serializer: REST::RelationshipSerializer, relationships: relationships
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
11
app/controllers/api/v1/apps/credentials_controller.rb
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::Apps::CredentialsController < Api::BaseController
|
||||||
|
before_action -> { doorkeeper_authorize! :read }
|
||||||
|
|
||||||
|
respond_to :json
|
||||||
|
|
||||||
|
def show
|
||||||
|
render json: doorkeeper_token.application, serializer: REST::StatusSerializer::ApplicationSerializer
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -1,8 +1,6 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class Api::V1::AppsController < Api::BaseController
|
class Api::V1::AppsController < Api::BaseController
|
||||||
respond_to :json
|
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@app = Doorkeeper::Application.create!(application_options)
|
@app = Doorkeeper::Application.create!(application_options)
|
||||||
render json: @app, serializer: REST::ApplicationSerializer
|
render json: @app, serializer: REST::ApplicationSerializer
|
||||||
|
|||||||
@@ -15,19 +15,17 @@ class Api::V1::BlocksController < Api::BaseController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def load_accounts
|
def load_accounts
|
||||||
default_accounts.merge(paginated_blocks).to_a
|
paginated_blocks.map(&:target_account)
|
||||||
end
|
|
||||||
|
|
||||||
def default_accounts
|
|
||||||
Account.includes(:blocked_by).references(:blocked_by)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def paginated_blocks
|
def paginated_blocks
|
||||||
Block.where(account: current_account).paginate_by_max_id(
|
@paginated_blocks ||= Block.eager_load(:target_account)
|
||||||
limit_param(DEFAULT_ACCOUNTS_LIMIT),
|
.where(account: current_account)
|
||||||
params[:max_id],
|
.paginate_by_max_id(
|
||||||
params[:since_id]
|
limit_param(DEFAULT_ACCOUNTS_LIMIT),
|
||||||
)
|
params[:max_id],
|
||||||
|
params[:since_id]
|
||||||
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
def insert_pagination_headers
|
def insert_pagination_headers
|
||||||
@@ -41,21 +39,21 @@ class Api::V1::BlocksController < Api::BaseController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def prev_path
|
def prev_path
|
||||||
unless @accounts.empty?
|
unless paginated_blocks.empty?
|
||||||
api_v1_blocks_url pagination_params(since_id: pagination_since_id)
|
api_v1_blocks_url pagination_params(since_id: pagination_since_id)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_max_id
|
def pagination_max_id
|
||||||
@accounts.last.blocked_by_ids.last
|
paginated_blocks.last.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_since_id
|
def pagination_since_id
|
||||||
@accounts.first.blocked_by_ids.first
|
paginated_blocks.first.id
|
||||||
end
|
end
|
||||||
|
|
||||||
def records_continue?
|
def records_continue?
|
||||||
@accounts.size == limit_param(DEFAULT_ACCOUNTS_LIMIT)
|
paginated_blocks.size == limit_param(DEFAULT_ACCOUNTS_LIMIT)
|
||||||
end
|
end
|
||||||
|
|
||||||
def pagination_params(core_params)
|
def pagination_params(core_params)
|
||||||
|
|||||||
9
app/controllers/api/v1/custom_emojis_controller.rb
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Api::V1::CustomEmojisController < Api::BaseController
|
||||||
|
respond_to :json
|
||||||
|
|
||||||
|
def index
|
||||||
|
render json: CustomEmoji.local.where(disabled: false), each_serializer: REST::CustomEmojiSerializer
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,7 +10,7 @@ class Api::V1::MediaController < Api::BaseController
|
|||||||
respond_to :json
|
respond_to :json
|
||||||
|
|
||||||
def create
|
def create
|
||||||
@media = current_account.media_attachments.create!(file: media_params[:file])
|
@media = current_account.media_attachments.create!(media_params)
|
||||||
render json: @media, serializer: REST::MediaAttachmentSerializer
|
render json: @media, serializer: REST::MediaAttachmentSerializer
|
||||||
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
|
rescue Paperclip::Errors::NotIdentifiedByImageMagickError
|
||||||
render json: file_type_error, status: 422
|
render json: file_type_error, status: 422
|
||||||
@@ -18,10 +18,16 @@ class Api::V1::MediaController < Api::BaseController
|
|||||||
render json: processing_error, status: 500
|
render json: processing_error, status: 500
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def update
|
||||||
|
@media = current_account.media_attachments.where(status_id: nil).find(params[:id])
|
||||||
|
@media.update!(media_params)
|
||||||
|
render json: @media, serializer: REST::MediaAttachmentSerializer
|
||||||
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def media_params
|
def media_params
|
||||||
params.permit(:file)
|
params.permit(:file, :description)
|
||||||
end
|
end
|
||||||
|
|
||||||
def file_type_error
|
def file_type_error
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ class ApplicationController < ActionController::Base
|
|||||||
|
|
||||||
helper_method :current_account
|
helper_method :current_account
|
||||||
helper_method :current_session
|
helper_method :current_session
|
||||||
|
helper_method :current_theme
|
||||||
helper_method :single_user_mode?
|
helper_method :single_user_mode?
|
||||||
|
|
||||||
rescue_from ActionController::RoutingError, with: :not_found
|
rescue_from ActionController::RoutingError, with: :not_found
|
||||||
@@ -77,6 +78,11 @@ class ApplicationController < ActionController::Base
|
|||||||
@current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
|
@current_session ||= SessionActivation.find_by(session_id: cookies.signed['_session_id'])
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def current_theme
|
||||||
|
return Setting.default_settings['theme'] unless Themes.instance.names.include? current_user&.setting_theme
|
||||||
|
current_user.setting_theme
|
||||||
|
end
|
||||||
|
|
||||||
def cache_collection(raw, klass)
|
def cache_collection(raw, klass)
|
||||||
return raw unless klass.respond_to?(:with_includes)
|
return raw unless klass.respond_to?(:with_includes)
|
||||||
|
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||||||
before_action :check_enabled_registrations, only: [:new, :create]
|
before_action :check_enabled_registrations, only: [:new, :create]
|
||||||
before_action :configure_sign_up_params, only: [:create]
|
before_action :configure_sign_up_params, only: [:create]
|
||||||
before_action :set_sessions, only: [:edit, :update]
|
before_action :set_sessions, only: [:edit, :update]
|
||||||
|
before_action :set_instance_presenter, only: [:new, :create, :update]
|
||||||
|
|
||||||
def destroy
|
def destroy
|
||||||
not_found
|
not_found
|
||||||
@@ -39,6 +40,10 @@ class Auth::RegistrationsController < Devise::RegistrationsController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def set_instance_presenter
|
||||||
|
@instance_presenter = InstancePresenter.new
|
||||||
|
end
|
||||||
|
|
||||||
def determine_layout
|
def determine_layout
|
||||||
%w(edit update).include?(action_name) ? 'admin' : 'auth'
|
%w(edit update).include?(action_name) ? 'admin' : 'auth'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
skip_before_action :require_no_authentication, only: [:create]
|
skip_before_action :require_no_authentication, only: [:create]
|
||||||
skip_before_action :check_suspension, only: [:destroy]
|
skip_before_action :check_suspension, only: [:destroy]
|
||||||
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
|
prepend_before_action :authenticate_with_two_factor, if: :two_factor_enabled?, only: [:create]
|
||||||
|
before_action :set_instance_presenter, only: [:new]
|
||||||
|
|
||||||
def create
|
def create
|
||||||
super do |resource|
|
super do |resource|
|
||||||
@@ -84,6 +85,10 @@ class Auth::SessionsController < Devise::SessionsController
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def set_instance_presenter
|
||||||
|
@instance_presenter = InstancePresenter.new
|
||||||
|
end
|
||||||
|
|
||||||
def home_paths(resource)
|
def home_paths(resource)
|
||||||
paths = [about_path]
|
paths = [about_path]
|
||||||
if single_user_mode? && resource.is_a?(User)
|
if single_user_mode? && resource.is_a?(User)
|
||||||
|
|||||||
@@ -9,10 +9,15 @@ module SignatureVerification
|
|||||||
request.headers['Signature'].present?
|
request.headers['Signature'].present?
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def signature_verification_failure_reason
|
||||||
|
return @signature_verification_failure_reason if defined?(@signature_verification_failure_reason)
|
||||||
|
end
|
||||||
|
|
||||||
def signed_request_account
|
def signed_request_account
|
||||||
return @signed_request_account if defined?(@signed_request_account)
|
return @signed_request_account if defined?(@signed_request_account)
|
||||||
|
|
||||||
unless signed_request?
|
unless signed_request?
|
||||||
|
@signature_verification_failure_reason = 'Request not signed'
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -27,6 +32,7 @@ module SignatureVerification
|
|||||||
end
|
end
|
||||||
|
|
||||||
if incompatible_signature?(signature_params)
|
if incompatible_signature?(signature_params)
|
||||||
|
@signature_verification_failure_reason = 'Incompatible request signature'
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -34,6 +40,7 @@ module SignatureVerification
|
|||||||
account = account_from_key_id(signature_params['keyId'])
|
account = account_from_key_id(signature_params['keyId'])
|
||||||
|
|
||||||
if account.nil?
|
if account.nil?
|
||||||
|
@signature_verification_failure_reason = "Public key not found for key #{signature_params['keyId']}"
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
@@ -44,7 +51,18 @@ module SignatureVerification
|
|||||||
if account.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, signature, compare_signed_string)
|
if account.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, signature, compare_signed_string)
|
||||||
@signed_request_account = account
|
@signed_request_account = account
|
||||||
@signed_request_account
|
@signed_request_account
|
||||||
|
elsif account.possibly_stale?
|
||||||
|
account = account.refresh!
|
||||||
|
|
||||||
|
if account.keypair.public_key.verify(OpenSSL::Digest::SHA256.new, signature, compare_signed_string)
|
||||||
|
@signed_request_account = account
|
||||||
|
@signed_request_account
|
||||||
|
else
|
||||||
|
@signed_verification_failure_reason = "Verification failed for #{account.username}@#{account.domain} #{account.uri}"
|
||||||
|
@signed_request_account = nil
|
||||||
|
end
|
||||||
else
|
else
|
||||||
|
@signed_verification_failure_reason = "Verification failed for #{account.username}@#{account.domain} #{account.uri}"
|
||||||
@signed_request_account = nil
|
@signed_request_account = nil
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -99,7 +117,7 @@ module SignatureVerification
|
|||||||
ResolveRemoteAccountService.new.call(key_id.gsub(/\Aacct:/, ''))
|
ResolveRemoteAccountService.new.call(key_id.gsub(/\Aacct:/, ''))
|
||||||
elsif !ActivityPub::TagManager.instance.local_uri?(key_id)
|
elsif !ActivityPub::TagManager.instance.local_uri?(key_id)
|
||||||
account = ActivityPub::TagManager.instance.uri_to_resource(key_id, Account)
|
account = ActivityPub::TagManager.instance.uri_to_resource(key_id, Account)
|
||||||
account ||= ActivityPub::FetchRemoteKeyService.new.call(key_id)
|
account ||= ActivityPub::FetchRemoteKeyService.new.call(key_id, id: false)
|
||||||
account
|
account
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,12 +7,14 @@ module UserTrackingConcern
|
|||||||
UPDATE_SIGN_IN_HOURS = 24
|
UPDATE_SIGN_IN_HOURS = 24
|
||||||
|
|
||||||
included do
|
included do
|
||||||
before_action :set_user_activity, if: %i(user_signed_in? user_needs_sign_in_update?)
|
before_action :set_user_activity
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def set_user_activity
|
def set_user_activity
|
||||||
|
return unless user_needs_sign_in_update?
|
||||||
|
|
||||||
# Mark as signed-in today
|
# Mark as signed-in today
|
||||||
current_user.update_tracked_fields!(request)
|
current_user.update_tracked_fields!(request)
|
||||||
|
|
||||||
@@ -21,7 +23,7 @@ module UserTrackingConcern
|
|||||||
end
|
end
|
||||||
|
|
||||||
def user_needs_sign_in_update?
|
def user_needs_sign_in_update?
|
||||||
current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < UPDATE_SIGN_IN_HOURS.hours.ago
|
user_signed_in? && (current_user.current_sign_in_at.nil? || current_user.current_sign_in_at < UPDATE_SIGN_IN_HOURS.hours.ago)
|
||||||
end
|
end
|
||||||
|
|
||||||
def user_needs_feed_update?
|
def user_needs_feed_update?
|
||||||
|
|||||||
22
app/controllers/emojis_controller.rb
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class EmojisController < ApplicationController
|
||||||
|
before_action :set_emoji
|
||||||
|
|
||||||
|
def show
|
||||||
|
respond_to do |format|
|
||||||
|
format.json do
|
||||||
|
render json: @emoji,
|
||||||
|
serializer: ActivityPub::EmojiSerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def set_emoji
|
||||||
|
@emoji = CustomEmoji.local.find(params[:id])
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -10,19 +10,39 @@ class FollowerAccountsController < ApplicationController
|
|||||||
format.html
|
format.html
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
render json: collection_presenter,
|
||||||
|
serializer: ActivityPub::CollectionSerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def page_url(page)
|
||||||
|
account_followers_url(@account, page: page) unless page.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
ActivityPub::CollectionPresenter.new(
|
page = ActivityPub::CollectionPresenter.new(
|
||||||
id: account_followers_url(@account),
|
id: account_followers_url(@account, page: params.fetch(:page, 1)),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.followers_count,
|
size: @account.followers_count,
|
||||||
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) }
|
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.account) },
|
||||||
|
part_of: account_followers_url(@account),
|
||||||
|
next: page_url(@follows.next_page),
|
||||||
|
prev: page_url(@follows.prev_page)
|
||||||
)
|
)
|
||||||
|
if params[:page].present?
|
||||||
|
page
|
||||||
|
else
|
||||||
|
ActivityPub::CollectionPresenter.new(
|
||||||
|
id: account_followers_url(@account),
|
||||||
|
type: :ordered,
|
||||||
|
size: @account.followers_count,
|
||||||
|
first: page
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,19 +10,39 @@ class FollowingAccountsController < ApplicationController
|
|||||||
format.html
|
format.html
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
render json: collection_presenter,
|
||||||
|
serializer: ActivityPub::CollectionSerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def page_url(page)
|
||||||
|
account_following_index_url(@account, page: page) unless page.nil?
|
||||||
|
end
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
ActivityPub::CollectionPresenter.new(
|
page = ActivityPub::CollectionPresenter.new(
|
||||||
id: account_following_index_url(@account),
|
id: account_following_index_url(@account, page: params.fetch(:page, 1)),
|
||||||
type: :ordered,
|
type: :ordered,
|
||||||
size: @account.following_count,
|
size: @account.following_count,
|
||||||
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) }
|
items: @follows.map { |f| ActivityPub::TagManager.instance.uri_for(f.target_account) },
|
||||||
|
part_of: account_following_index_url(@account),
|
||||||
|
next: page_url(@follows.next_page),
|
||||||
|
prev: page_url(@follows.prev_page)
|
||||||
)
|
)
|
||||||
|
if params[:page].present?
|
||||||
|
page
|
||||||
|
else
|
||||||
|
ActivityPub::CollectionPresenter.new(
|
||||||
|
id: account_following_index_url(@account),
|
||||||
|
type: :ordered,
|
||||||
|
size: @account.following_count,
|
||||||
|
first: page
|
||||||
|
)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -12,7 +12,30 @@ class HomeController < ApplicationController
|
|||||||
private
|
private
|
||||||
|
|
||||||
def authenticate_user!
|
def authenticate_user!
|
||||||
redirect_to(single_user_mode? ? account_path(Account.first) : about_path) unless user_signed_in?
|
return if user_signed_in?
|
||||||
|
|
||||||
|
matches = request.path.match(/\A\/web\/(statuses|accounts)\/([\d]+)\z/)
|
||||||
|
|
||||||
|
if matches
|
||||||
|
case matches[1]
|
||||||
|
when 'statuses'
|
||||||
|
status = Status.find_by(id: matches[2])
|
||||||
|
|
||||||
|
if status && (status.public_visibility? || status.unlisted_visibility?)
|
||||||
|
redirect_to(ActivityPub::TagManager.instance.url_for(status))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
when 'accounts'
|
||||||
|
account = Account.find_by(id: matches[2])
|
||||||
|
|
||||||
|
if account
|
||||||
|
redirect_to(ActivityPub::TagManager.instance.url_for(account))
|
||||||
|
return
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to(default_redirect_path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def set_initial_state_json
|
def set_initial_state_json
|
||||||
@@ -29,4 +52,14 @@ class HomeController < ApplicationController
|
|||||||
admin: Account.find_local(Setting.site_contact_username),
|
admin: Account.find_local(Setting.site_contact_username),
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def default_redirect_path
|
||||||
|
if request.path.start_with?('/web')
|
||||||
|
new_user_session_path
|
||||||
|
elsif single_user_mode?
|
||||||
|
short_account_path(Account.first)
|
||||||
|
else
|
||||||
|
about_path
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,11 +1,7 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class ManifestsController < ApplicationController
|
class ManifestsController < ApplicationController
|
||||||
before_action :set_instance_presenter
|
def show
|
||||||
|
render json: InstancePresenter.new, serializer: ManifestSerializer
|
||||||
def show; end
|
|
||||||
|
|
||||||
def set_instance_presenter
|
|
||||||
@instance_presenter = InstancePresenter.new
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
40
app/controllers/media_proxy_controller.rb
Normal file
@@ -0,0 +1,40 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class MediaProxyController < ApplicationController
|
||||||
|
include RoutingHelper
|
||||||
|
|
||||||
|
def show
|
||||||
|
RedisLock.acquire(lock_options) do |lock|
|
||||||
|
if lock.acquired?
|
||||||
|
@media_attachment = MediaAttachment.remote.find(params[:id])
|
||||||
|
redownload! if @media_attachment.needs_redownload? && !reject_media?
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
redirect_to full_asset_url(@media_attachment.file.url(version))
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def redownload!
|
||||||
|
@media_attachment.file_remote_url = @media_attachment.remote_url
|
||||||
|
@media_attachment.created_at = Time.now.utc
|
||||||
|
@media_attachment.save!
|
||||||
|
end
|
||||||
|
|
||||||
|
def version
|
||||||
|
if request.path.ends_with?('/small')
|
||||||
|
:small
|
||||||
|
else
|
||||||
|
:original
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def lock_options
|
||||||
|
{ redis: Redis.current, key: "media_download:#{params[:id]}" }
|
||||||
|
end
|
||||||
|
|
||||||
|
def reject_media?
|
||||||
|
DomainBlock.find_by(domain: @media_attachment.account.domain)&.reject_media?
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -9,7 +9,7 @@ class Settings::FollowerDomainsController < ApplicationController
|
|||||||
|
|
||||||
def show
|
def show
|
||||||
@account = current_account
|
@account = current_account
|
||||||
@domains = current_account.followers.reorder(nil).group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
|
@domains = current_account.followers.reorder('MIN(follows.id) DESC').group('accounts.domain').select('accounts.domain, count(accounts.id) as accounts_from_domain').page(params[:page]).per(10)
|
||||||
end
|
end
|
||||||
|
|
||||||
def update
|
def update
|
||||||
|
|||||||
32
app/controllers/settings/notifications_controller.rb
Normal file
@@ -0,0 +1,32 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
class Settings::NotificationsController < ApplicationController
|
||||||
|
layout 'admin'
|
||||||
|
|
||||||
|
before_action :authenticate_user!
|
||||||
|
|
||||||
|
def show; end
|
||||||
|
|
||||||
|
def update
|
||||||
|
user_settings.update(user_settings_params.to_h)
|
||||||
|
|
||||||
|
if current_user.save
|
||||||
|
redirect_to settings_notifications_path, notice: I18n.t('generic.changes_saved_msg')
|
||||||
|
else
|
||||||
|
render :show
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def user_settings
|
||||||
|
UserSettingsDecorator.new(current_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
def user_settings_params
|
||||||
|
params.require(:user).permit(
|
||||||
|
notification_emails: %i(follow follow_request reblog favourite mention digest),
|
||||||
|
interactions: %i(must_be_follower must_be_following)
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -39,8 +39,10 @@ class Settings::PreferencesController < ApplicationController
|
|||||||
:setting_boost_modal,
|
:setting_boost_modal,
|
||||||
:setting_delete_modal,
|
:setting_delete_modal,
|
||||||
:setting_auto_play_gif,
|
:setting_auto_play_gif,
|
||||||
|
:setting_reduce_motion,
|
||||||
:setting_system_font_ui,
|
:setting_system_font_ui,
|
||||||
:setting_noindex,
|
:setting_noindex,
|
||||||
|
:setting_theme,
|
||||||
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)
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -21,13 +21,19 @@ class StatusesController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: @status, serializer: ActivityPub::NoteSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
render json: @status,
|
||||||
|
serializer: ActivityPub::NoteSerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def activity
|
def activity
|
||||||
render json: @status, serializer: ActivityPub::ActivitySerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
render json: @status,
|
||||||
|
serializer: ActivityPub::ActivitySerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
|
|
||||||
def embed
|
def embed
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ class StreamEntriesController < ApplicationController
|
|||||||
@type = @stream_entry.activity_type.downcase
|
@type = @stream_entry.activity_type.downcase
|
||||||
|
|
||||||
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
|
raise ActiveRecord::RecordNotFound if @stream_entry.activity.nil?
|
||||||
authorize @stream_entry.activity, :show? if @stream_entry.hidden?
|
authorize @stream_entry.activity, :show? if @stream_entry.hidden? || @stream_entry.local_only?
|
||||||
rescue Mastodon::NotPermittedError
|
rescue Mastodon::NotPermittedError
|
||||||
# Reraise in order to get a 404
|
# Reraise in order to get a 404
|
||||||
raise ActiveRecord::RecordNotFound
|
raise ActiveRecord::RecordNotFound
|
||||||
|
|||||||
@@ -1,24 +1,40 @@
|
|||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
class TagsController < ApplicationController
|
class TagsController < ApplicationController
|
||||||
layout 'public'
|
before_action :set_body_classes
|
||||||
|
before_action :set_instance_presenter
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@tag = Tag.find_by!(name: params[:id].downcase)
|
@tag = Tag.find_by!(name: params[:id].downcase)
|
||||||
@statuses = Status.as_tag_timeline(@tag, current_account, params[:local]).paginate_by_max_id(20, params[:max_id])
|
|
||||||
@statuses = cache_collection(@statuses, Status)
|
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html
|
format.html do
|
||||||
|
serializable_resource = ActiveModelSerializers::SerializableResource.new(InitialStatePresenter.new(initial_state_params), serializer: InitialStateSerializer)
|
||||||
|
@initial_state_json = serializable_resource.to_json
|
||||||
|
end
|
||||||
|
|
||||||
format.json do
|
format.json do
|
||||||
render json: collection_presenter, serializer: ActivityPub::CollectionSerializer, adapter: ActivityPub::Adapter, content_type: 'application/activity+json'
|
@statuses = Status.as_tag_timeline(@tag, current_account, params[:local]).paginate_by_max_id(20, params[:max_id])
|
||||||
|
@statuses = cache_collection(@statuses, Status)
|
||||||
|
|
||||||
|
render json: collection_presenter,
|
||||||
|
serializer: ActivityPub::CollectionSerializer,
|
||||||
|
adapter: ActivityPub::Adapter,
|
||||||
|
content_type: 'application/activity+json'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
|
def set_body_classes
|
||||||
|
@body_classes = 'tag-body'
|
||||||
|
end
|
||||||
|
|
||||||
|
def set_instance_presenter
|
||||||
|
@instance_presenter = InstancePresenter.new
|
||||||
|
end
|
||||||
|
|
||||||
def collection_presenter
|
def collection_presenter
|
||||||
ActivityPub::CollectionPresenter.new(
|
ActivityPub::CollectionPresenter.new(
|
||||||
id: tag_url(@tag),
|
id: tag_url(@tag),
|
||||||
@@ -27,4 +43,11 @@ class TagsController < ApplicationController
|
|||||||
items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
|
items: @statuses.map { |s| ActivityPub::TagManager.instance.uri_for(s) }
|
||||||
)
|
)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def initial_state_params
|
||||||
|
{
|
||||||
|
settings: {},
|
||||||
|
token: current_session&.token,
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
4
app/helpers/admin/account_moderation_notes_helper.rb
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
# frozen_string_literal: true
|
||||||
|
|
||||||
|
module Admin::AccountModerationNotesHelper
|
||||||
|
end
|
||||||
@@ -42,4 +42,8 @@ module ApplicationHelper
|
|||||||
|
|
||||||
content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
|
content_tag(:i, nil, attributes.merge(class: class_names.join(' ')))
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def opengraph(property, content)
|
||||||
|
tag(:meta, content: content, property: property)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,24 +0,0 @@
|
|||||||
# frozen_string_literal: true
|
|
||||||
|
|
||||||
module EmojiHelper
|
|
||||||
def emojify(text)
|
|
||||||
return text if text.blank?
|
|
||||||
|
|
||||||
text.gsub(emoji_pattern) do |match|
|
|
||||||
emoji = Emoji.instance.unicode($1) # rubocop:disable Style/PerlBackrefs
|
|
||||||
|
|
||||||
if emoji
|
|
||||||
emoji
|
|
||||||
else
|
|
||||||
match
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
def emoji_pattern
|
|
||||||
@emoji_pattern ||=
|
|
||||||
/(?<=[^[:alnum:]:]|\n|^)
|
|
||||||
(#{Emoji.instance.names.map { |name| Regexp.escape(name) }.join('|')})
|
|
||||||
(?=[^[:alnum:]:]|$)/x
|
|
||||||
end
|
|
||||||
end
|
|
||||||
@@ -22,7 +22,18 @@ module JsonLdHelper
|
|||||||
graph.dump(:normalize)
|
graph.dump(:normalize)
|
||||||
end
|
end
|
||||||
|
|
||||||
def fetch_resource(uri)
|
def fetch_resource(uri, id)
|
||||||
|
unless id
|
||||||
|
json = fetch_resource_without_id_validation(uri)
|
||||||
|
return unless json
|
||||||
|
uri = json['id']
|
||||||
|
end
|
||||||
|
|
||||||
|
json = fetch_resource_without_id_validation(uri)
|
||||||
|
json.present? && json['id'] == uri ? json : nil
|
||||||
|
end
|
||||||
|
|
||||||
|
def fetch_resource_without_id_validation(uri)
|
||||||
response = build_request(uri).perform
|
response = build_request(uri).perform
|
||||||
return if response.code != 200
|
return if response.code != 200
|
||||||
body_to_json(response.to_s)
|
body_to_json(response.to_s)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ module SettingsHelper
|
|||||||
pt: 'Português',
|
pt: 'Português',
|
||||||
'pt-BR': 'Português do Brasil',
|
'pt-BR': 'Português do Brasil',
|
||||||
ru: 'Русский',
|
ru: 'Русский',
|
||||||
|
sv: 'Svenska',
|
||||||
th: 'ภาษาไทย',
|
th: 'ภาษาไทย',
|
||||||
tr: 'Türkçe',
|
tr: 'Türkçe',
|
||||||
uk: 'Українська',
|
uk: 'Українська',
|
||||||
@@ -41,7 +42,7 @@ module SettingsHelper
|
|||||||
end
|
end
|
||||||
|
|
||||||
def filterable_languages
|
def filterable_languages
|
||||||
I18n.available_locales.map { |locale| locale.to_s.split('-').first.to_sym }.uniq
|
LanguageDetector.instance.language_names.select(&HUMAN_LOCALES.method(:key?))
|
||||||
end
|
end
|
||||||
|
|
||||||
def hash_to_object(hash)
|
def hash_to_object(hash)
|
||||||
|
|||||||
@@ -44,12 +44,11 @@ Imports:
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
|
||||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
import emojify from '../../../mastodon/emoji';
|
import emojify from '../../../mastodon/features/emoji/emoji';
|
||||||
import IconButton from '../../../mastodon/components/icon_button';
|
import IconButton from '../../../mastodon/components/icon_button';
|
||||||
import Avatar from '../../../mastodon/components/avatar';
|
import Avatar from '../../../mastodon/components/avatar';
|
||||||
|
|
||||||
@@ -89,7 +88,7 @@ export default class AccountHeader extends ImmutablePureComponent {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account : ImmutablePropTypes.map,
|
account : ImmutablePropTypes.map,
|
||||||
me : PropTypes.number.isRequired,
|
me : PropTypes.string.isRequired,
|
||||||
onFollow : PropTypes.func.isRequired,
|
onFollow : PropTypes.func.isRequired,
|
||||||
intl : PropTypes.object.isRequired,
|
intl : PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
@@ -117,15 +116,11 @@ then we set the `displayName` to just be the `username` of the account.
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
let displayName = account.get('display_name');
|
let displayName = account.get('display_name_html');
|
||||||
let info = '';
|
let info = '';
|
||||||
let actionBtn = '';
|
let actionBtn = '';
|
||||||
let following = false;
|
let following = false;
|
||||||
|
|
||||||
if (displayName.length === 0) {
|
|
||||||
displayName = account.get('username');
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Next, we handle the account relationships. If the account follows the
|
Next, we handle the account relationships. If the account follows the
|
||||||
@@ -167,16 +162,11 @@ appropriate icon.
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
we extract the `text` and
|
||||||
`displayNameHTML` processes the `displayName` and prepares it for
|
|
||||||
insertion into the document. Meanwhile, we extract the `text` and
|
|
||||||
`metadata` from our account's `note` using `processBio()`.
|
`metadata` from our account's `note` using `processBio()`.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
const displayNameHTML = {
|
|
||||||
__html : emojify(escapeTextContentForBrowser(displayName)),
|
|
||||||
};
|
|
||||||
const { text, metadata } = processBio(account.get('note'));
|
const { text, metadata } = processBio(account.get('note'));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -198,7 +188,7 @@ Here, we render our component using all the things we've defined above.
|
|||||||
</span>
|
</span>
|
||||||
<span
|
<span
|
||||||
className='account__header__display-name'
|
className='account__header__display-name'
|
||||||
dangerouslySetInnerHTML={displayNameHTML}
|
dangerouslySetInnerHTML={{ __html: displayName }}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
<span className='account__header__username'>
|
<span className='account__header__username'>
|
||||||
|
|||||||
@@ -47,11 +47,9 @@ import PropTypes from 'prop-types';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import { injectIntl, defineMessages } from 'react-intl';
|
import { injectIntl, defineMessages } from 'react-intl';
|
||||||
|
|
||||||
// Mastodon imports //
|
|
||||||
import IconButton from '../../../../mastodon/components/icon_button';
|
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import ComposeAdvancedOptionsToggle from './toggle';
|
import ComposeAdvancedOptionsToggle from './toggle';
|
||||||
|
import ComposeDropdown from '../dropdown/index';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
@@ -77,11 +75,6 @@ const messages = defineMessages({
|
|||||||
{ id: 'advanced_options.icon_title', defaultMessage: 'Advanced options' },
|
{ id: 'advanced_options.icon_title', defaultMessage: 'Advanced options' },
|
||||||
});
|
});
|
||||||
|
|
||||||
const iconStyle = {
|
|
||||||
height : null,
|
|
||||||
lineHeight : '27px',
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
Implementation:
|
Implementation:
|
||||||
@@ -100,67 +93,6 @@ export default class ComposeAdvancedOptions extends React.PureComponent {
|
|||||||
intl : PropTypes.object.isRequired,
|
intl : PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
state = {
|
|
||||||
open: false,
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
### `onToggleDropdown()`
|
|
||||||
|
|
||||||
This function toggles the opening and closing of the advanced options
|
|
||||||
dropdown.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
onToggleDropdown = () => {
|
|
||||||
this.setState({ open: !this.state.open });
|
|
||||||
};
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
### `onGlobalClick(e)`
|
|
||||||
|
|
||||||
This function closes the advanced options dropdown if you click
|
|
||||||
anywhere else on the screen.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
onGlobalClick = (e) => {
|
|
||||||
if (e.target !== this.node && !this.node.contains(e.target) && this.state.open) {
|
|
||||||
this.setState({ open: false });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
### `componentDidMount()`, `componentWillUnmount()`
|
|
||||||
|
|
||||||
This function closes the advanced options dropdown if you click
|
|
||||||
anywhere else on the screen.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
componentDidMount () {
|
|
||||||
window.addEventListener('click', this.onGlobalClick);
|
|
||||||
window.addEventListener('touchstart', this.onGlobalClick);
|
|
||||||
}
|
|
||||||
componentWillUnmount () {
|
|
||||||
window.removeEventListener('click', this.onGlobalClick);
|
|
||||||
window.removeEventListener('touchstart', this.onGlobalClick);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
### `setRef(c)`
|
|
||||||
|
|
||||||
`setRef()` stores a reference to the dropdown's `<div> in `this.node`.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
setRef = (c) => {
|
|
||||||
this.node = c;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@@ -171,7 +103,6 @@ anywhere else on the screen.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { open } = this.state;
|
|
||||||
const { intl, values } = this.props;
|
const { intl, values } = this.props;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -218,23 +149,14 @@ toggle as its `key` so that React can keep track of it.
|
|||||||
Finally, we can render our component.
|
Finally, we can render our component.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div ref={this.setRef} className={`advanced-options-dropdown ${open ? 'open' : ''} ${anyEnabled ? 'active' : ''} `}>
|
<ComposeDropdown
|
||||||
<div className='advanced-options-dropdown__value'>
|
title={intl.formatMessage(messages.advanced_options_icon_title)}
|
||||||
<IconButton
|
icon='home'
|
||||||
className='advanced-options-dropdown__value'
|
highlight={anyEnabled}
|
||||||
title={intl.formatMessage(messages.advanced_options_icon_title)}
|
>
|
||||||
icon='ellipsis-h' active={open || anyEnabled}
|
{optionElems}
|
||||||
size={18}
|
</ComposeDropdown>
|
||||||
style={iconStyle}
|
|
||||||
onClick={this.onToggleDropdown}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
<div className='advanced-options-dropdown__dropdown'>
|
|
||||||
{optionElems}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
133
app/javascript/glitch/components/compose/attach_options/index.js
Normal file
@@ -0,0 +1,133 @@
|
|||||||
|
// Package imports //
|
||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import { connect } from 'react-redux';
|
||||||
|
import { injectIntl, defineMessages } from 'react-intl';
|
||||||
|
|
||||||
|
// Our imports //
|
||||||
|
import ComposeDropdown from '../dropdown/index';
|
||||||
|
import { uploadCompose } from '../../../../mastodon/actions/compose';
|
||||||
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
import { openModal } from '../../../../mastodon/actions/modal';
|
||||||
|
|
||||||
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
const messages = defineMessages({
|
||||||
|
upload :
|
||||||
|
{ id: 'compose.attach.upload', defaultMessage: 'Upload a file' },
|
||||||
|
doodle :
|
||||||
|
{ id: 'compose.attach.doodle', defaultMessage: 'Draw something' },
|
||||||
|
attach :
|
||||||
|
{ id: 'compose.attach', defaultMessage: 'Attach...' },
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapStateToProps = state => ({
|
||||||
|
// This horrible expression is copied from vanilla upload_button_container
|
||||||
|
disabled: state.getIn(['compose', 'is_uploading']) || (state.getIn(['compose', 'media_attachments']).size > 3 || state.getIn(['compose', 'media_attachments']).some(m => m.get('type') === 'video')),
|
||||||
|
resetFileKey: state.getIn(['compose', 'resetFileKey']),
|
||||||
|
acceptContentTypes: state.getIn(['media_attachments', 'accept_content_types']),
|
||||||
|
});
|
||||||
|
|
||||||
|
const mapDispatchToProps = dispatch => ({
|
||||||
|
onSelectFile (files) {
|
||||||
|
dispatch(uploadCompose(files));
|
||||||
|
},
|
||||||
|
onOpenDoodle () {
|
||||||
|
dispatch(openModal('DOODLE', { noEsc: true }));
|
||||||
|
},
|
||||||
|
});
|
||||||
|
|
||||||
|
@injectIntl
|
||||||
|
@connect(mapStateToProps, mapDispatchToProps)
|
||||||
|
export default class ComposeAttachOptions extends ImmutablePureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
intl : PropTypes.object.isRequired,
|
||||||
|
resetFileKey: PropTypes.number,
|
||||||
|
acceptContentTypes: ImmutablePropTypes.listOf(PropTypes.string).isRequired,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
onSelectFile: PropTypes.func.isRequired,
|
||||||
|
onOpenDoodle: PropTypes.func.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
handleItemClick = bt => {
|
||||||
|
if (bt === 'upload') {
|
||||||
|
this.fileElement.click();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (bt === 'doodle') {
|
||||||
|
this.props.onOpenDoodle();
|
||||||
|
}
|
||||||
|
|
||||||
|
this.dropdown.setState({ open: false });
|
||||||
|
};
|
||||||
|
|
||||||
|
handleFileChange = (e) => {
|
||||||
|
if (e.target.files.length > 0) {
|
||||||
|
this.props.onSelectFile(e.target.files);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
setFileRef = (c) => {
|
||||||
|
this.fileElement = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
setDropdownRef = (c) => {
|
||||||
|
this.dropdown = c;
|
||||||
|
}
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { intl, resetFileKey, disabled, acceptContentTypes } = this.props;
|
||||||
|
|
||||||
|
const options = [
|
||||||
|
{ icon: 'cloud-upload', text: messages.upload, name: 'upload' },
|
||||||
|
{ icon: 'paint-brush', text: messages.doodle, name: 'doodle' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const optionElems = options.map((item) => {
|
||||||
|
const hdl = () => this.handleItemClick(item.name);
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
role='button'
|
||||||
|
tabIndex='0'
|
||||||
|
key={item.name}
|
||||||
|
onClick={hdl}
|
||||||
|
className='privacy-dropdown__option'
|
||||||
|
>
|
||||||
|
<div className='privacy-dropdown__option__icon'>
|
||||||
|
<i className={`fa fa-fw fa-${item.icon}`} />
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className='privacy-dropdown__option__content'>
|
||||||
|
<strong>{intl.formatMessage(item.text)}</strong>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div>
|
||||||
|
<ComposeDropdown
|
||||||
|
title={intl.formatMessage(messages.attach)}
|
||||||
|
icon='paperclip'
|
||||||
|
disabled={disabled}
|
||||||
|
ref={this.setDropdownRef}
|
||||||
|
>
|
||||||
|
{optionElems}
|
||||||
|
</ComposeDropdown>
|
||||||
|
<input
|
||||||
|
key={resetFileKey}
|
||||||
|
ref={this.setFileRef}
|
||||||
|
type='file'
|
||||||
|
multiple={false}
|
||||||
|
accept={acceptContentTypes.toArray().join(',')}
|
||||||
|
onChange={this.handleFileChange}
|
||||||
|
disabled={disabled}
|
||||||
|
style={{ display: 'none' }}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
77
app/javascript/glitch/components/compose/dropdown/index.js
Normal file
@@ -0,0 +1,77 @@
|
|||||||
|
// Package imports //
|
||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
// Mastodon imports //
|
||||||
|
import IconButton from '../../../../mastodon/components/icon_button';
|
||||||
|
|
||||||
|
const iconStyle = {
|
||||||
|
height : null,
|
||||||
|
lineHeight : '27px',
|
||||||
|
};
|
||||||
|
|
||||||
|
export default class ComposeDropdown extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
title: PropTypes.string.isRequired,
|
||||||
|
icon: PropTypes.string,
|
||||||
|
highlight: PropTypes.bool,
|
||||||
|
disabled: PropTypes.bool,
|
||||||
|
children: PropTypes.arrayOf(PropTypes.node).isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
state = {
|
||||||
|
open: false,
|
||||||
|
};
|
||||||
|
|
||||||
|
onGlobalClick = (e) => {
|
||||||
|
if (e.target !== this.node && !this.node.contains(e.target) && this.state.open) {
|
||||||
|
this.setState({ open: false });
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
componentDidMount () {
|
||||||
|
window.addEventListener('click', this.onGlobalClick);
|
||||||
|
window.addEventListener('touchstart', this.onGlobalClick);
|
||||||
|
}
|
||||||
|
componentWillUnmount () {
|
||||||
|
window.removeEventListener('click', this.onGlobalClick);
|
||||||
|
window.removeEventListener('touchstart', this.onGlobalClick);
|
||||||
|
}
|
||||||
|
|
||||||
|
onToggleDropdown = () => {
|
||||||
|
if (this.props.disabled) return;
|
||||||
|
this.setState({ open: !this.state.open });
|
||||||
|
};
|
||||||
|
|
||||||
|
setRef = (c) => {
|
||||||
|
this.node = c;
|
||||||
|
};
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { open } = this.state;
|
||||||
|
let { highlight, title, icon, disabled } = this.props;
|
||||||
|
|
||||||
|
if (!icon) icon = 'ellipsis-h';
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div ref={this.setRef} className={`advanced-options-dropdown ${open ? 'open' : ''} ${highlight ? 'active' : ''} `}>
|
||||||
|
<div className='advanced-options-dropdown__value'>
|
||||||
|
<IconButton
|
||||||
|
className={'inverted'}
|
||||||
|
title={title}
|
||||||
|
icon={icon} active={open || highlight}
|
||||||
|
size={18}
|
||||||
|
style={iconStyle}
|
||||||
|
disabled={disabled}
|
||||||
|
onClick={this.onToggleDropdown}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div className='advanced-options-dropdown__dropdown'>
|
||||||
|
{this.props.children}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -2,10 +2,10 @@
|
|||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
import { closeModal } from 'mastodon/actions/modal';
|
import { closeModal } from '../../../mastodon/actions/modal';
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import { changeLocalSetting } from 'glitch/actions/local_settings';
|
import { changeLocalSetting } from '../../../glitch/actions/local_settings';
|
||||||
import LocalSettings from '.';
|
import LocalSettings from '.';
|
||||||
|
|
||||||
const mapStateToProps = state => ({
|
const mapStateToProps = state => ({
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import LocalSettingsPage from './page';
|
|||||||
import LocalSettingsNavigation from './navigation';
|
import LocalSettingsNavigation from './navigation';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style';
|
import './style.scss';
|
||||||
|
|
||||||
export default class LocalSettings extends React.PureComponent {
|
export default class LocalSettings extends React.PureComponent {
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ import { injectIntl, defineMessages } from 'react-intl';
|
|||||||
import LocalSettingsNavigationItem from './item';
|
import LocalSettingsNavigationItem from './item';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style';
|
import './style.scss';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
import classNames from 'classnames';
|
import classNames from 'classnames';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style';
|
import './style.scss';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'variables';
|
@import 'styles/mastodon/variables';
|
||||||
|
|
||||||
.glitch.local-settings__navigation__item {
|
.glitch.local-settings__navigation__item {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'variables';
|
@import 'styles/mastodon/variables';
|
||||||
|
|
||||||
.glitch.local-settings__navigation {
|
.glitch.local-settings__navigation {
|
||||||
background: $primary-text-color;
|
background: $primary-text-color;
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ import { defineMessages, FormattedMessage, injectIntl } from 'react-intl';
|
|||||||
import LocalSettingsPageItem from './item';
|
import LocalSettingsPageItem from './item';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style';
|
import './style.scss';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
@@ -16,6 +16,7 @@ const messages = defineMessages({
|
|||||||
layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' },
|
layout_auto: { id: 'layout.auto', defaultMessage: 'Auto' },
|
||||||
layout_desktop: { id: 'layout.desktop', defaultMessage: 'Desktop' },
|
layout_desktop: { id: 'layout.desktop', defaultMessage: 'Desktop' },
|
||||||
layout_mobile: { id: 'layout.single', defaultMessage: 'Mobile' },
|
layout_mobile: { id: 'layout.single', defaultMessage: 'Mobile' },
|
||||||
|
side_arm_none: { id: 'settings.side_arm.none', defaultMessage: 'None' },
|
||||||
});
|
});
|
||||||
|
|
||||||
@injectIntl
|
@injectIntl
|
||||||
@@ -61,6 +62,24 @@ export default class LocalSettingsPage extends React.PureComponent {
|
|||||||
>
|
>
|
||||||
<FormattedMessage id='settings.navbar_under' defaultMessage='Navbar at the bottom (Mobile only)' />
|
<FormattedMessage id='settings.navbar_under' defaultMessage='Navbar at the bottom (Mobile only)' />
|
||||||
</LocalSettingsPageItem>
|
</LocalSettingsPageItem>
|
||||||
|
<section>
|
||||||
|
<h2><FormattedMessage id='settings.compose_box_opts' defaultMessage='Compose box options' /></h2>
|
||||||
|
<LocalSettingsPageItem
|
||||||
|
settings={settings}
|
||||||
|
item={['side_arm']}
|
||||||
|
id='mastodon-settings--side_arm'
|
||||||
|
options={[
|
||||||
|
{ value: 'none', message: intl.formatMessage(messages.side_arm_none) },
|
||||||
|
{ value: 'direct', message: intl.formatMessage({ id: 'privacy.direct.short' }) },
|
||||||
|
{ value: 'private', message: intl.formatMessage({ id: 'privacy.private.short' }) },
|
||||||
|
{ value: 'unlisted', message: intl.formatMessage({ id: 'privacy.unlisted.short' }) },
|
||||||
|
{ value: 'public', message: intl.formatMessage({ id: 'privacy.public.short' }) },
|
||||||
|
]}
|
||||||
|
onChange={onChange}
|
||||||
|
>
|
||||||
|
<FormattedMessage id='settings.side_arm' defaultMessage='Secondary toot button:' />
|
||||||
|
</LocalSettingsPageItem>
|
||||||
|
</section>
|
||||||
</div>
|
</div>
|
||||||
),
|
),
|
||||||
({ onChange, settings }) => (
|
({ onChange, settings }) => (
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ import PropTypes from 'prop-types';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
|
||||||
// Stylesheet imports
|
// Stylesheet imports
|
||||||
import './style';
|
import './style.scss';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'variables';
|
@import 'styles/mastodon/variables';
|
||||||
|
|
||||||
.glitch.local-settings__page__item {
|
.glitch.local-settings__page__item {
|
||||||
select {
|
select {
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'variables';
|
@import 'styles/mastodon/variables';
|
||||||
|
|
||||||
.glitch.local-settings__page {
|
.glitch.local-settings__page {
|
||||||
display: block;
|
display: block;
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
@import 'variables';
|
@import 'styles/mastodon/variables';
|
||||||
|
|
||||||
.glitch.local-settings {
|
.glitch.local-settings {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
|||||||
@@ -19,38 +19,30 @@ Imports:
|
|||||||
// Package imports //
|
// Package imports //
|
||||||
import { connect } from 'react-redux';
|
import { connect } from 'react-redux';
|
||||||
|
|
||||||
// Mastodon imports //
|
|
||||||
import { makeGetNotification } from '../../../mastodon/selectors';
|
|
||||||
|
|
||||||
// Our imports //
|
// Our imports //
|
||||||
import Notification from '.';
|
import Notification from '.';
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
/*
|
const mapStateToProps = (state, props) => {
|
||||||
|
// replace account id with object
|
||||||
|
let leNotif = props.notification.set('account', state.getIn(['accounts', props.notification.get('account')]));
|
||||||
|
|
||||||
State mapping:
|
// populate markedForDelete from state - is mysteriously lost somewhere
|
||||||
--------------
|
for (let n of state.getIn(['notifications', 'items'])) {
|
||||||
|
if (n.get('id') === props.notification.get('id')) {
|
||||||
|
leNotif = leNotif.set('markedForDelete', n.get('markedForDelete'));
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
The `mapStateToProps()` function maps various state properties to the
|
return ({
|
||||||
props of our component. We wrap this in `makeMapStateToProps()` so that
|
notification: leNotif,
|
||||||
we only have to call `makeGetNotification()` once instead of every
|
|
||||||
time.
|
|
||||||
|
|
||||||
*/
|
|
||||||
|
|
||||||
const makeMapStateToProps = () => {
|
|
||||||
const getNotification = makeGetNotification();
|
|
||||||
|
|
||||||
const mapStateToProps = (state, props) => ({
|
|
||||||
notification: getNotification(state, props.notification, props.accountId),
|
|
||||||
settings: state.get('local_settings'),
|
settings: state.get('local_settings'),
|
||||||
notifCleaning: state.getIn(['notifications', 'cleaningMode']),
|
notifCleaning: state.getIn(['notifications', 'cleaningMode']),
|
||||||
});
|
});
|
||||||
|
|
||||||
return mapStateToProps;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
|
||||||
|
|
||||||
export default connect(makeMapStateToProps)(Notification);
|
export default connect(mapStateToProps)(Notification);
|
||||||
|
|||||||
@@ -11,11 +11,9 @@ import React from 'react';
|
|||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
|
|
||||||
// Mastodon imports.
|
// Mastodon imports.
|
||||||
import emojify from '../../../mastodon/emoji';
|
|
||||||
import Permalink from '../../../mastodon/components/permalink';
|
import Permalink from '../../../mastodon/components/permalink';
|
||||||
import AccountContainer from '../../../mastodon/containers/account_container';
|
import AccountContainer from '../../../mastodon/containers/account_container';
|
||||||
|
|
||||||
@@ -30,7 +28,7 @@ import NotificationOverlayContainer from '../notification/overlay/container';
|
|||||||
export default class NotificationFollow extends ImmutablePureComponent {
|
export default class NotificationFollow extends ImmutablePureComponent {
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
id : PropTypes.number.isRequired,
|
id : PropTypes.string.isRequired,
|
||||||
account : ImmutablePropTypes.map.isRequired,
|
account : ImmutablePropTypes.map.isRequired,
|
||||||
notification : ImmutablePropTypes.map.isRequired,
|
notification : ImmutablePropTypes.map.isRequired,
|
||||||
};
|
};
|
||||||
@@ -39,15 +37,14 @@ export default class NotificationFollow extends ImmutablePureComponent {
|
|||||||
const { account, notification } = this.props;
|
const { account, notification } = this.props;
|
||||||
|
|
||||||
// Links to the display name.
|
// Links to the display name.
|
||||||
const displayName = account.get('display_name') || account.get('username');
|
const displayName = account.get('display_name_html') || account.get('username');
|
||||||
const displayNameHTML = { __html: emojify(escapeTextContentForBrowser(displayName)) };
|
|
||||||
const link = (
|
const link = (
|
||||||
<Permalink
|
<Permalink
|
||||||
className='notification__display-name'
|
className='notification__display-name'
|
||||||
href={account.get('url')}
|
href={account.get('url')}
|
||||||
title={account.get('acct')}
|
title={account.get('acct')}
|
||||||
to={`/accounts/${account.get('id')}`}
|
to={`/accounts/${account.get('id')}`}
|
||||||
dangerouslySetInnerHTML={displayNameHTML}
|
dangerouslySetInnerHTML={{ __html: displayName }}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ export default class StatusActionBar extends ImmutablePureComponent {
|
|||||||
onEmbed: PropTypes.func,
|
onEmbed: PropTypes.func,
|
||||||
onMuteConversation: PropTypes.func,
|
onMuteConversation: PropTypes.func,
|
||||||
onPin: PropTypes.func,
|
onPin: PropTypes.func,
|
||||||
me: PropTypes.number,
|
me: PropTypes.string,
|
||||||
withDismiss: PropTypes.bool,
|
withDismiss: PropTypes.bool,
|
||||||
intl: PropTypes.object.isRequired,
|
intl: PropTypes.object.isRequired,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -102,6 +102,16 @@ const makeMapStateToProps = () => {
|
|||||||
const mapStateToProps = (state, ownProps) => {
|
const mapStateToProps = (state, ownProps) => {
|
||||||
|
|
||||||
let status = getStatus(state, ownProps.id);
|
let status = getStatus(state, ownProps.id);
|
||||||
|
|
||||||
|
if(status === null) {
|
||||||
|
console.error(`ERROR! NULL STATUS! ${ownProps.id}`);
|
||||||
|
// work-around: find first good status
|
||||||
|
for (let k of state.get('statuses').keys()) {
|
||||||
|
status = getStatus(state, k);
|
||||||
|
if (status !== null) break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let reblogStatus = status.get('reblog', null);
|
let reblogStatus = status.get('reblog', null);
|
||||||
let account = undefined;
|
let account = undefined;
|
||||||
let prepend = undefined;
|
let prepend = undefined;
|
||||||
|
|||||||
@@ -1,13 +1,11 @@
|
|||||||
// Package imports //
|
// Package imports //
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
import classnames from 'classnames';
|
import classnames from 'classnames';
|
||||||
|
|
||||||
// Mastodon imports //
|
// Mastodon imports //
|
||||||
import emojify from '../../../mastodon/emoji';
|
|
||||||
import { isRtl } from '../../../mastodon/rtl';
|
import { isRtl } from '../../../mastodon/rtl';
|
||||||
import Permalink from '../../../mastodon/components/permalink';
|
import Permalink from '../../../mastodon/components/permalink';
|
||||||
|
|
||||||
@@ -32,7 +30,7 @@ export default class StatusContent extends React.PureComponent {
|
|||||||
const node = this.node;
|
const node = this.node;
|
||||||
const links = node.querySelectorAll('a');
|
const links = node.querySelectorAll('a');
|
||||||
|
|
||||||
for (var i = 0; i < links.length; ++i) {
|
for (let i = 0; i < links.length; ++i) {
|
||||||
let link = links[i];
|
let link = links[i];
|
||||||
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
|
let mention = this.props.status.get('mentions').find(item => link.href === item.get('url'));
|
||||||
|
|
||||||
@@ -131,12 +129,8 @@ export default class StatusContent extends React.PureComponent {
|
|||||||
this.state.hidden
|
this.state.hidden
|
||||||
);
|
);
|
||||||
|
|
||||||
const content = { __html: emojify(status.get('content')) };
|
const content = { __html: status.get('contentHtml') };
|
||||||
const spoilerContent = {
|
const spoilerContent = { __html: status.get('spoilerHtml') };
|
||||||
__html: emojify(escapeTextContentForBrowser(
|
|
||||||
status.get('spoiler_text', '')
|
|
||||||
)),
|
|
||||||
};
|
|
||||||
const directionStyle = { direction: 'ltr' };
|
const directionStyle = { direction: 'ltr' };
|
||||||
const classNames = classnames('status__content', {
|
const classNames = classnames('status__content', {
|
||||||
'status__content--with-action': parseClick && !disabled,
|
'status__content--with-action': parseClick && !disabled,
|
||||||
|
|||||||
@@ -117,7 +117,13 @@ export default class StatusGalleryItem extends React.PureComponent {
|
|||||||
onClick={this.handleClick}
|
onClick={this.handleClick}
|
||||||
target='_blank'
|
target='_blank'
|
||||||
>
|
>
|
||||||
<img className={letterbox ? 'letterbox' : ''} src={previewUrl} srcSet={srcSet} sizes={sizes} alt='' />
|
<img
|
||||||
|
className={letterbox ? 'letterbox' : ''}
|
||||||
|
src={previewUrl} srcSet={srcSet}
|
||||||
|
sizes={sizes}
|
||||||
|
alt={attachment.get('description')}
|
||||||
|
title={attachment.get('description')}
|
||||||
|
/>
|
||||||
</a>
|
</a>
|
||||||
);
|
);
|
||||||
} else if (attachment.get('type') === 'gifv') {
|
} else if (attachment.get('type') === 'gifv') {
|
||||||
|
|||||||
@@ -155,12 +155,12 @@ export default class Status extends ImmutablePureComponent {
|
|||||||
};
|
};
|
||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
id : PropTypes.number,
|
id : PropTypes.string,
|
||||||
status : ImmutablePropTypes.map,
|
status : ImmutablePropTypes.map,
|
||||||
account : ImmutablePropTypes.map,
|
account : ImmutablePropTypes.map,
|
||||||
settings : ImmutablePropTypes.map,
|
settings : ImmutablePropTypes.map,
|
||||||
notification : ImmutablePropTypes.map,
|
notification : ImmutablePropTypes.map,
|
||||||
me : PropTypes.number,
|
me : PropTypes.string,
|
||||||
onFavourite : PropTypes.func,
|
onFavourite : PropTypes.func,
|
||||||
onReblog : PropTypes.func,
|
onReblog : PropTypes.func,
|
||||||
onModalReblog : PropTypes.func,
|
onModalReblog : PropTypes.func,
|
||||||
|
|||||||
@@ -22,12 +22,8 @@ Imports:
|
|||||||
import React from 'react';
|
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';
|
||||||
import escapeTextContentForBrowser from 'escape-html';
|
|
||||||
import { FormattedMessage } from 'react-intl';
|
import { FormattedMessage } from 'react-intl';
|
||||||
|
|
||||||
// Mastodon imports //
|
|
||||||
import emojify from '../../../mastodon/emoji';
|
|
||||||
|
|
||||||
/* * * * */
|
/* * * * */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -99,9 +95,7 @@ generate the message.
|
|||||||
>
|
>
|
||||||
<b
|
<b
|
||||||
dangerouslySetInnerHTML={{
|
dangerouslySetInnerHTML={{
|
||||||
__html : emojify(escapeTextContentForBrowser(
|
__html : account.get('display_name_html') || account.get('username'),
|
||||||
account.get('display_name') || account.get('username')
|
|
||||||
)),
|
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</a>
|
</a>
|
||||||
|
|||||||
@@ -52,6 +52,7 @@ const initialState = ImmutableMap({
|
|||||||
layout : 'auto',
|
layout : 'auto',
|
||||||
stretch : true,
|
stretch : true,
|
||||||
navbar_under : false,
|
navbar_under : false,
|
||||||
|
side_arm : 'none',
|
||||||
collapsed : ImmutableMap({
|
collapsed : ImmutableMap({
|
||||||
enabled : true,
|
enabled : true,
|
||||||
auto : ImmutableMap({
|
auto : ImmutableMap({
|
||||||
|
|||||||
@@ -69,6 +69,10 @@ functions are:
|
|||||||
easier to read and to maintain. I leave it to the future readers of
|
easier to read and to maintain. I leave it to the future readers of
|
||||||
this code to determine the extent of my successes in this endeavor.
|
this code to determine the extent of my successes in this endeavor.
|
||||||
|
|
||||||
|
UPDATE 19 Oct 2017: We no longer allow character escapes inside our
|
||||||
|
double-quoted strings for ease of processing. We now internally use
|
||||||
|
the name "ƔAML" in our code to clarify that this is Not Quite YAML.
|
||||||
|
|
||||||
Sending love + warmth eternal,
|
Sending love + warmth eternal,
|
||||||
- kibigo [@kibi@glitch.social]
|
- kibigo [@kibi@glitch.social]
|
||||||
|
|
||||||
@@ -96,10 +100,7 @@ const ALLOWED_CHAR = unirex( // `c-printable` in the YAML 1.2 spec.
|
|||||||
compat_mode ? '[\t\n\r\x20-\x7e\x85\xa0-\ufffd]' : '[\t\n\r\x20-\x7e\x85\xa0-\ud7ff\ue000-\ufffd\u{10000}-\u{10FFFF}]'
|
compat_mode ? '[\t\n\r\x20-\x7e\x85\xa0-\ufffd]' : '[\t\n\r\x20-\x7e\x85\xa0-\ud7ff\ue000-\ufffd\u{10000}-\u{10FFFF}]'
|
||||||
);
|
);
|
||||||
const WHITE_SPACE = /[ \t]/;
|
const WHITE_SPACE = /[ \t]/;
|
||||||
const INDENTATION = / */; // Indentation must be only spaces.
|
|
||||||
const LINE_BREAK = /\r?\n|\r|<br\s*\/?>/;
|
const LINE_BREAK = /\r?\n|\r|<br\s*\/?>/;
|
||||||
const ESCAPE_CHAR = /[0abt\tnvfre "\/\\N_LP]/;
|
|
||||||
const HEXADECIMAL_CHARS = /[0-9a-fA-F]/;
|
|
||||||
const INDICATOR = /[-?:,[\]{}&#*!|>'"%@`]/;
|
const INDICATOR = /[-?:,[\]{}&#*!|>'"%@`]/;
|
||||||
const FLOW_CHAR = /[,[\]{}]/;
|
const FLOW_CHAR = /[,[\]{}]/;
|
||||||
|
|
||||||
@@ -121,7 +122,7 @@ const NEW_LINE = unirex(
|
|||||||
rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK)
|
rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK)
|
||||||
);
|
);
|
||||||
const SOME_NEW_LINES = unirex(
|
const SOME_NEW_LINES = unirex(
|
||||||
'(?:' + rexstr(ANY_WHITE_SPACE) + rexstr(LINE_BREAK) + ')+'
|
'(?:' + rexstr(NEW_LINE) + ')+'
|
||||||
);
|
);
|
||||||
const POSSIBLE_STARTS = unirex(
|
const POSSIBLE_STARTS = unirex(
|
||||||
rexstr(DOCUMENT_START) + rexstr(/<p[^<>]*>/) + '?'
|
rexstr(DOCUMENT_START) + rexstr(/<p[^<>]*>/) + '?'
|
||||||
@@ -131,22 +132,13 @@ const POSSIBLE_ENDS = unirex(
|
|||||||
rexstr(DOCUMENT_END) + '|' +
|
rexstr(DOCUMENT_END) + '|' +
|
||||||
rexstr(/<\/p>/)
|
rexstr(/<\/p>/)
|
||||||
);
|
);
|
||||||
const CHARACTER_ESCAPE = unirex(
|
const QUOTE_CHAR = unirex(
|
||||||
rexstr(/\\/) +
|
'(?=' + rexstr(NOT_LINE_BREAK) + ')[^"]'
|
||||||
'(?:' +
|
|
||||||
rexstr(ESCAPE_CHAR) + '|' +
|
|
||||||
rexstr(/x/) + rexstr(HEXADECIMAL_CHARS) + '{2}' + '|' +
|
|
||||||
rexstr(/u/) + rexstr(HEXADECIMAL_CHARS) + '{4}' + '|' +
|
|
||||||
rexstr(/U/) + rexstr(HEXADECIMAL_CHARS) + '{8}' +
|
|
||||||
')'
|
|
||||||
);
|
);
|
||||||
const ESCAPED_CHAR = unirex(
|
const ANY_QUOTE_CHAR = unirex(
|
||||||
rexstr(/(?!["\\])/) + rexstr(NOT_LINE_BREAK) + '|' +
|
rexstr(QUOTE_CHAR) + '*'
|
||||||
rexstr(CHARACTER_ESCAPE)
|
|
||||||
);
|
|
||||||
const ANY_ESCAPED_CHARS = unirex(
|
|
||||||
rexstr(ESCAPED_CHAR) + '*'
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const ESCAPED_APOS = unirex(
|
const ESCAPED_APOS = unirex(
|
||||||
'(?=' + rexstr(NOT_LINE_BREAK) + ')' + rexstr(/[^']|''/)
|
'(?=' + rexstr(NOT_LINE_BREAK) + ')' + rexstr(/[^']|''/)
|
||||||
);
|
);
|
||||||
@@ -190,120 +182,76 @@ const LATER_VALUE_CHAR = unirex(
|
|||||||
|
|
||||||
/* YAML CONSTRUCTS */
|
/* YAML CONSTRUCTS */
|
||||||
|
|
||||||
const YAML_START = unirex(
|
const ƔAML_START = unirex(
|
||||||
rexstr(ANY_WHITE_SPACE) + rexstr(/---/)
|
rexstr(ANY_WHITE_SPACE) + '---'
|
||||||
);
|
);
|
||||||
const YAML_END = unirex(
|
const ƔAML_END = unirex(
|
||||||
rexstr(ANY_WHITE_SPACE) + rexstr(/(?:---|\.\.\.)/)
|
rexstr(ANY_WHITE_SPACE) + '(?:---|\.\.\.)'
|
||||||
);
|
);
|
||||||
const YAML_LOOKAHEAD = unirex(
|
const ƔAML_LOOKAHEAD = unirex(
|
||||||
'(?=' +
|
'(?=' +
|
||||||
rexstr(YAML_START) +
|
rexstr(ƔAML_START) +
|
||||||
rexstr(ANY_ALLOWED_CHARS) + rexstr(NEW_LINE) +
|
rexstr(ANY_ALLOWED_CHARS) + rexstr(NEW_LINE) +
|
||||||
rexstr(YAML_END) + rexstr(POSSIBLE_ENDS) +
|
rexstr(ƔAML_END) + rexstr(POSSIBLE_ENDS) +
|
||||||
')'
|
')'
|
||||||
);
|
);
|
||||||
const YAML_DOUBLE_QUOTE = unirex(
|
const ƔAML_DOUBLE_QUOTE = unirex(
|
||||||
rexstr(/"/) + rexstr(ANY_ESCAPED_CHARS) + rexstr(/"/)
|
'"' + rexstr(ANY_QUOTE_CHAR) + '"'
|
||||||
);
|
);
|
||||||
const YAML_SINGLE_QUOTE = unirex(
|
const ƔAML_SINGLE_QUOTE = unirex(
|
||||||
rexstr(/'/) + rexstr(ANY_ESCAPED_APOS) + rexstr(/'/)
|
'\'' + rexstr(ANY_ESCAPED_APOS) + '\''
|
||||||
);
|
);
|
||||||
const YAML_SIMPLE_KEY = unirex(
|
const ƔAML_SIMPLE_KEY = unirex(
|
||||||
rexstr(FIRST_KEY_CHAR) + rexstr(LATER_KEY_CHAR) + '*'
|
rexstr(FIRST_KEY_CHAR) + rexstr(LATER_KEY_CHAR) + '*'
|
||||||
);
|
);
|
||||||
const YAML_SIMPLE_VALUE = unirex(
|
const ƔAML_SIMPLE_VALUE = unirex(
|
||||||
rexstr(FIRST_VALUE_CHAR) + rexstr(LATER_VALUE_CHAR) + '*'
|
rexstr(FIRST_VALUE_CHAR) + rexstr(LATER_VALUE_CHAR) + '*'
|
||||||
);
|
);
|
||||||
const YAML_KEY = unirex(
|
const ƔAML_KEY = unirex(
|
||||||
rexstr(YAML_DOUBLE_QUOTE) + '|' +
|
rexstr(ƔAML_DOUBLE_QUOTE) + '|' +
|
||||||
rexstr(YAML_SINGLE_QUOTE) + '|' +
|
rexstr(ƔAML_SINGLE_QUOTE) + '|' +
|
||||||
rexstr(YAML_SIMPLE_KEY)
|
rexstr(ƔAML_SIMPLE_KEY)
|
||||||
);
|
);
|
||||||
const YAML_VALUE = unirex(
|
const ƔAML_VALUE = unirex(
|
||||||
rexstr(YAML_DOUBLE_QUOTE) + '|' +
|
rexstr(ƔAML_DOUBLE_QUOTE) + '|' +
|
||||||
rexstr(YAML_SINGLE_QUOTE) + '|' +
|
rexstr(ƔAML_SINGLE_QUOTE) + '|' +
|
||||||
rexstr(YAML_SIMPLE_VALUE)
|
rexstr(ƔAML_SIMPLE_VALUE)
|
||||||
);
|
);
|
||||||
const YAML_SEPARATOR = unirex(
|
const ƔAML_SEPARATOR = unirex(
|
||||||
rexstr(ANY_WHITE_SPACE) +
|
rexstr(ANY_WHITE_SPACE) +
|
||||||
':' + rexstr(WHITE_SPACE) +
|
':' + rexstr(WHITE_SPACE) +
|
||||||
rexstr(ANY_WHITE_SPACE)
|
rexstr(ANY_WHITE_SPACE)
|
||||||
);
|
);
|
||||||
const YAML_LINE = unirex(
|
const ƔAML_LINE = unirex(
|
||||||
'(' + rexstr(YAML_KEY) + ')' +
|
'(' + rexstr(ƔAML_KEY) + ')' +
|
||||||
rexstr(YAML_SEPARATOR) +
|
rexstr(ƔAML_SEPARATOR) +
|
||||||
'(' + rexstr(YAML_VALUE) + ')'
|
'(' + rexstr(ƔAML_VALUE) + ')'
|
||||||
);
|
);
|
||||||
|
|
||||||
/* FRONTMATTER REGEX */
|
/* FRONTMATTER REGEX */
|
||||||
|
|
||||||
const YAML_FRONTMATTER = unirex(
|
const ƔAML_FRONTMATTER = unirex(
|
||||||
rexstr(POSSIBLE_STARTS) +
|
rexstr(POSSIBLE_STARTS) +
|
||||||
rexstr(YAML_LOOKAHEAD) +
|
rexstr(ƔAML_LOOKAHEAD) +
|
||||||
rexstr(YAML_START) + rexstr(SOME_NEW_LINES) +
|
rexstr(ƔAML_START) + rexstr(SOME_NEW_LINES) +
|
||||||
'(?:' +
|
'(?:' +
|
||||||
'(' + rexstr(INDENTATION) + ')' +
|
rexstr(ANY_WHITE_SPACE) + rexstr(ƔAML_LINE) + rexstr(SOME_NEW_LINES) +
|
||||||
rexstr(YAML_LINE) + rexstr(SOME_NEW_LINES) +
|
'){0,5}' +
|
||||||
'(?:' +
|
rexstr(ƔAML_END) + rexstr(POSSIBLE_ENDS)
|
||||||
'\\1' + rexstr(YAML_LINE) + rexstr(SOME_NEW_LINES) +
|
|
||||||
'){0,4}' +
|
|
||||||
')?' +
|
|
||||||
rexstr(YAML_END) + rexstr(POSSIBLE_ENDS)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
/* SEARCHES */
|
/* SEARCHES */
|
||||||
|
|
||||||
const FIND_YAML_LINES = unirex(
|
const FIND_ƔAML_LINE = unirex(
|
||||||
rexstr(NEW_LINE) + rexstr(INDENTATION) + rexstr(YAML_LINE)
|
rexstr(NEW_LINE) + rexstr(ANY_WHITE_SPACE) + rexstr(ƔAML_LINE)
|
||||||
);
|
);
|
||||||
|
|
||||||
/* STRING PROCESSING */
|
/* STRING PROCESSING */
|
||||||
|
|
||||||
function processString(str) {
|
function processString (str) {
|
||||||
switch (str.charAt(0)) {
|
switch (str.charAt(0)) {
|
||||||
case '"':
|
case '"':
|
||||||
return str
|
return str.substring(1, str.length - 1);
|
||||||
.substring(1, str.length - 1)
|
|
||||||
.replace(/\\0/g, '\x00')
|
|
||||||
.replace(/\\a/g, '\x07')
|
|
||||||
.replace(/\\b/g, '\x08')
|
|
||||||
.replace(/\\t/g, '\x09')
|
|
||||||
.replace(/\\\x09/g, '\x09')
|
|
||||||
.replace(/\\n/g, '\x0a')
|
|
||||||
.replace(/\\v/g, '\x0b')
|
|
||||||
.replace(/\\f/g, '\x0c')
|
|
||||||
.replace(/\\r/g, '\x0d')
|
|
||||||
.replace(/\\e/g, '\x1b')
|
|
||||||
.replace(/\\ /g, '\x20')
|
|
||||||
.replace(/\\"/g, '\x22')
|
|
||||||
.replace(/\\\//g, '\x2f')
|
|
||||||
.replace(/\\\\/g, '\x5c')
|
|
||||||
.replace(/\\N/g, '\x85')
|
|
||||||
.replace(/\\_/g, '\xa0')
|
|
||||||
.replace(/\\L/g, '\u2028')
|
|
||||||
.replace(/\\P/g, '\u2029')
|
|
||||||
.replace(
|
|
||||||
new RegExp(
|
|
||||||
unirex(
|
|
||||||
rexstr(/\\x/) + '(' + rexstr(HEXADECIMAL_CHARS) + '{2})'
|
|
||||||
), 'gu'
|
|
||||||
), (_, n) => String.fromCodePoint('0x' + n)
|
|
||||||
)
|
|
||||||
.replace(
|
|
||||||
new RegExp(
|
|
||||||
unirex(
|
|
||||||
rexstr(/\\u/) + '(' + rexstr(HEXADECIMAL_CHARS) + '{4})'
|
|
||||||
), 'gu'
|
|
||||||
), (_, n) => String.fromCodePoint('0x' + n)
|
|
||||||
)
|
|
||||||
.replace(
|
|
||||||
new RegExp(
|
|
||||||
unirex(
|
|
||||||
rexstr(/\\U/) + '(' + rexstr(HEXADECIMAL_CHARS) + '{8})'
|
|
||||||
), 'gu'
|
|
||||||
), (_, n) => String.fromCodePoint('0x' + n)
|
|
||||||
);
|
|
||||||
case '\'':
|
case '\'':
|
||||||
return str
|
return str
|
||||||
.substring(1, str.length - 1)
|
.substring(1, str.length - 1)
|
||||||
@@ -321,15 +269,18 @@ export function processBio(content) {
|
|||||||
text: content,
|
text: content,
|
||||||
metadata: [],
|
metadata: [],
|
||||||
};
|
};
|
||||||
let yaml = content.match(YAML_FRONTMATTER);
|
let ɣaml = content.match(ƔAML_FRONTMATTER);
|
||||||
if (!yaml) return result;
|
if (!ɣaml) {
|
||||||
else yaml = yaml[0];
|
return result;
|
||||||
let start = content.search(YAML_START);
|
} else {
|
||||||
let end = start + yaml.length - yaml.search(YAML_START);
|
ɣaml = ɣaml[0];
|
||||||
result.text = content.substr(0, start) + content.substr(end);
|
}
|
||||||
|
const start = content.search(ƔAML_START);
|
||||||
|
const end = start + ɣaml.length - ɣaml.search(ƔAML_START);
|
||||||
|
result.text = content.substr(end);
|
||||||
let metadata = null;
|
let metadata = null;
|
||||||
let query = new RegExp(FIND_YAML_LINES, 'g');
|
let query = new RegExp(rexstr(FIND_ƔAML_LINE), 'g'); // Some browsers don't allow flags unless both args are strings
|
||||||
while ((metadata = query.exec(yaml))) {
|
while ((metadata = query.exec(ɣaml))) {
|
||||||
result.metadata.push([
|
result.metadata.push([
|
||||||
processString(metadata[1]),
|
processString(metadata[1]),
|
||||||
processString(metadata[2]),
|
processString(metadata[2]),
|
||||||
@@ -352,63 +303,23 @@ export function createBio(note, data) {
|
|||||||
let val = '' + data[i][1];
|
let val = '' + data[i][1];
|
||||||
|
|
||||||
// Key processing
|
// Key processing
|
||||||
if (key === (key.match(YAML_SIMPLE_KEY) || [])[0]) /* do nothing */;
|
if (key === (key.match(ƔAML_SIMPLE_KEY) || [])[0]) /* do nothing */;
|
||||||
else if (key.indexOf('\'') === -1 && key === (key.match(ANY_ESCAPED_APOS) || [])[0]) key = '\'' + key + '\'';
|
else if (key === (key.match(ANY_QUOTE_CHAR) || [])[0]) key = '"' + key + '"';
|
||||||
else {
|
else {
|
||||||
key = key
|
key = key
|
||||||
.replace(/\x00/g, '\\0')
|
.replace(/'/g, '\'\'')
|
||||||
.replace(/\x07/g, '\\a')
|
.replace(new RegExp(rexstr(NOT_ALLOWED_CHAR), compat_mode ? 'g' : 'gu'), '<EFBFBD>');
|
||||||
.replace(/\x08/g, '\\b')
|
key = '\'' + key + '\'';
|
||||||
.replace(/\x0a/g, '\\n')
|
|
||||||
.replace(/\x0b/g, '\\v')
|
|
||||||
.replace(/\x0c/g, '\\f')
|
|
||||||
.replace(/\x0d/g, '\\r')
|
|
||||||
.replace(/\x1b/g, '\\e')
|
|
||||||
.replace(/\x22/g, '\\"')
|
|
||||||
.replace(/\x5c/g, '\\\\');
|
|
||||||
let badchars = key.match(
|
|
||||||
new RegExp(rexstr(NOT_ALLOWED_CHAR), 'gu')
|
|
||||||
) || [];
|
|
||||||
for (let j = 0; j < badchars.length; j++) {
|
|
||||||
key = key.replace(
|
|
||||||
badchars[i],
|
|
||||||
'\\u' + badchars[i].codePointAt(0).toLocaleString('en', {
|
|
||||||
useGrouping: false,
|
|
||||||
minimumIntegerDigits: 4,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
key = '"' + key + '"';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Value processing
|
// Value processing
|
||||||
if (val === (val.match(YAML_SIMPLE_VALUE) || [])[0]) /* do nothing */;
|
if (val === (val.match(ƔAML_SIMPLE_VALUE) || [])[0]) /* do nothing */;
|
||||||
else if (val.indexOf('\'') === -1 && val === (val.match(ANY_ESCAPED_APOS) || [])[0]) val = '\'' + val + '\'';
|
else if (val === (val.match(ANY_QUOTE_CHAR) || [])[0]) val = '"' + val + '"';
|
||||||
else {
|
else {
|
||||||
val = val
|
key = key
|
||||||
.replace(/\x00/g, '\\0')
|
.replace(/'/g, '\'\'')
|
||||||
.replace(/\x07/g, '\\a')
|
.replace(new RegExp(rexstr(NOT_ALLOWED_CHAR), compat_mode ? 'g' : 'gu'), '<EFBFBD>');
|
||||||
.replace(/\x08/g, '\\b')
|
key = '\'' + key + '\'';
|
||||||
.replace(/\x0a/g, '\\n')
|
|
||||||
.replace(/\x0b/g, '\\v')
|
|
||||||
.replace(/\x0c/g, '\\f')
|
|
||||||
.replace(/\x0d/g, '\\r')
|
|
||||||
.replace(/\x1b/g, '\\e')
|
|
||||||
.replace(/\x22/g, '\\"')
|
|
||||||
.replace(/\x5c/g, '\\\\');
|
|
||||||
let badchars = val.match(
|
|
||||||
new RegExp(rexstr(NOT_ALLOWED_CHAR), 'gu')
|
|
||||||
) || [];
|
|
||||||
for (let j = 0; j < badchars.length; j++) {
|
|
||||||
val = val.replace(
|
|
||||||
badchars[i],
|
|
||||||
'\\u' + badchars[i].codePointAt(0).toLocaleString('en', {
|
|
||||||
useGrouping: false,
|
|
||||||
minimumIntegerDigits: 4,
|
|
||||||
})
|
|
||||||
);
|
|
||||||
}
|
|
||||||
val = '"' + val + '"';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
frontmatter += key + ': ' + val + '\n';
|
frontmatter += key + ': ' + val + '\n';
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="61.076954mm" height="65.47831mm" viewBox="0 0 216.4144 232.00976"><path d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915" fill="#3088d4"/><path d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675" fill="#fff"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216.4144 232.00976"><path d="M211.80734 139.0875c-3.18125 16.36625-28.4925 34.2775-57.5625 37.74875-15.15875 1.80875-30.08375 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.39125 27.9425 21.11625.7225 39.91875-5.20625 39.91875-5.20625l.8675 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23234 213.82 1.40609 165.31125.20859 116.09125c-.365-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67234 3.45375 78.20359.2425 107.86484 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.975 14.7525 32.975 65.0825 0 0 .41375 37.13375-4.59875 62.915" fill="#3088d4"/><path d="M177.50984 80.077v60.94125h-24.14375v-59.15c0-12.46875-5.24625-18.7975-15.74-18.7975-11.6025 0-17.4175 7.5075-17.4175 22.3525v32.37625H96.20734V85.42325c0-14.845-5.81625-22.3525-17.41875-22.3525-10.49375 0-15.74 6.32875-15.74 18.7975v59.15H38.90484V80.077c0-12.455 3.17125-22.3525 9.54125-29.675 6.56875-7.3225 15.17125-11.07625 25.85-11.07625 12.355 0 21.71125 4.74875 27.8975 14.2475l6.01375 10.08125 6.015-10.08125c6.185-9.49875 15.54125-14.2475 27.8975-14.2475 10.6775 0 19.28 3.75375 25.85 11.07625 6.36875 7.3225 9.54 17.22 9.54 29.675" fill="#fff"/></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
@@ -1 +1 @@
|
|||||||
<svg xmlns="http://www.w3.org/2000/svg" width="61.077141mm" height="65.47831mm" viewBox="0 0 216.41507 232.00976"><path d="M211.80683 139.0875c-3.1825 16.36625-28.4925 34.2775-57.5625 37.74875-15.16 1.80875-30.0825 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.3925 27.9425 21.115.7225 39.91625-5.20625 39.91625-5.20625l.86875 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23183 213.82 1.40558 165.31125.20808 116.09125c-.36375-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67058 3.45375 78.20308.2425 107.86433 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.97625 14.7525 32.97625 65.0825 0 0 .4125 37.13375-4.6 62.915" fill="#3088d4"/><path d="M65.68743 96.45938c0 9.01375-7.3075 16.32125-16.3225 16.32125-9.01375 0-16.32-7.3075-16.32-16.32125 0-9.01375 7.30625-16.3225 16.32-16.3225 9.015 0 16.3225 7.30875 16.3225 16.3225M124.52893 96.45938c0 9.01375-7.30875 16.32125-16.3225 16.32125-9.01375 0-16.32125-7.3075-16.32125-16.32125 0-9.01375 7.3075-16.3225 16.32125-16.3225 9.01375 0 16.3225 7.30875 16.3225 16.3225M183.36933 96.45938c0 9.01375-7.3075 16.32125-16.32125 16.32125-9.01375 0-16.32125-7.3075-16.32125-16.32125 0-9.01375 7.3075-16.3225 16.32125-16.3225 9.01375 0 16.32125 7.30875 16.32125 16.3225" fill="#fff"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 216.41507 232.00976"><path d="M211.80683 139.0875c-3.1825 16.36625-28.4925 34.2775-57.5625 37.74875-15.16 1.80875-30.0825 3.47125-45.99875 2.74125-26.0275-1.1925-46.565-6.2125-46.565-6.2125 0 2.53375.15625 4.94625.46875 7.2025 3.38375 25.68625 25.47 27.225 46.3925 27.9425 21.115.7225 39.91625-5.20625 39.91625-5.20625l.86875 19.09s-14.77 7.93125-41.08125 9.39c-14.50875.7975-32.52375-.365-53.50625-5.91875C9.23183 213.82 1.40558 165.31125.20808 116.09125c-.36375-14.61375-.14-28.39375-.14-39.91875 0-50.33 32.97625-65.0825 32.97625-65.0825C49.67058 3.45375 78.20308.2425 107.86433 0h.72875c29.66125.2425 58.21125 3.45375 74.8375 11.09 0 0 32.97625 14.7525 32.97625 65.0825 0 0 .4125 37.13375-4.6 62.915" fill="#3088d4"/><path d="M65.68743 96.45938c0 9.01375-7.3075 16.32125-16.3225 16.32125-9.01375 0-16.32-7.3075-16.32-16.32125 0-9.01375 7.30625-16.3225 16.32-16.3225 9.015 0 16.3225 7.30875 16.3225 16.3225M124.52893 96.45938c0 9.01375-7.30875 16.32125-16.3225 16.32125-9.01375 0-16.32125-7.3075-16.32125-16.32125 0-9.01375 7.3075-16.3225 16.32125-16.3225 9.01375 0 16.3225 7.30875 16.3225 16.3225M183.36933 96.45938c0 9.01375-7.3075 16.32125-16.32125 16.32125-9.01375 0-16.32125-7.3075-16.32125-16.32125 0-9.01375 7.3075-16.3225 16.32125-16.3225 9.01375 0 16.32125 7.30875 16.32125 16.3225" fill="#fff"/></svg>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 5.6 KiB After Width: | Height: | Size: 5.5 KiB |
|
Before Width: | Height: | Size: 25 KiB |
BIN
app/javascript/images/preview.jpg
Normal file
|
After Width: | Height: | Size: 285 KiB |
@@ -122,7 +122,7 @@ export function unfollowAccount(id) {
|
|||||||
dispatch(unfollowAccountRequest(id));
|
dispatch(unfollowAccountRequest(id));
|
||||||
|
|
||||||
api(getState).post(`/api/v1/accounts/${id}/unfollow`).then(response => {
|
api(getState).post(`/api/v1/accounts/${id}/unfollow`).then(response => {
|
||||||
dispatch(unfollowAccountSuccess(response.data));
|
dispatch(unfollowAccountSuccess(response.data, getState().get('statuses')));
|
||||||
}).catch(error => {
|
}).catch(error => {
|
||||||
dispatch(unfollowAccountFail(error));
|
dispatch(unfollowAccountFail(error));
|
||||||
});
|
});
|
||||||
@@ -157,10 +157,11 @@ export function unfollowAccountRequest(id) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function unfollowAccountSuccess(relationship) {
|
export function unfollowAccountSuccess(relationship, statuses) {
|
||||||
return {
|
return {
|
||||||
type: ACCOUNT_UNFOLLOW_SUCCESS,
|
type: ACCOUNT_UNFOLLOW_SUCCESS,
|
||||||
relationship,
|
relationship,
|
||||||
|
statuses,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
import api from '../api';
|
import api from '../api';
|
||||||
import emojione from 'emojione';
|
import { throttle } from 'lodash';
|
||||||
|
import { search as emojiSearch } from '../features/emoji/emoji_mart_search_light';
|
||||||
|
import { useEmoji } from './emojis';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
updateTimeline,
|
updateTimeline,
|
||||||
@@ -15,6 +17,7 @@ export const COMPOSE_SUBMIT_FAIL = 'COMPOSE_SUBMIT_FAIL';
|
|||||||
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
|
export const COMPOSE_REPLY = 'COMPOSE_REPLY';
|
||||||
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
|
export const COMPOSE_REPLY_CANCEL = 'COMPOSE_REPLY_CANCEL';
|
||||||
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
|
export const COMPOSE_MENTION = 'COMPOSE_MENTION';
|
||||||
|
export const COMPOSE_RESET = 'COMPOSE_RESET';
|
||||||
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
|
export const COMPOSE_UPLOAD_REQUEST = 'COMPOSE_UPLOAD_REQUEST';
|
||||||
export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
|
export const COMPOSE_UPLOAD_SUCCESS = 'COMPOSE_UPLOAD_SUCCESS';
|
||||||
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
|
export const COMPOSE_UPLOAD_FAIL = 'COMPOSE_UPLOAD_FAIL';
|
||||||
@@ -23,7 +26,6 @@ export const COMPOSE_UPLOAD_UNDO = 'COMPOSE_UPLOAD_UNDO';
|
|||||||
|
|
||||||
export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR';
|
export const COMPOSE_SUGGESTIONS_CLEAR = 'COMPOSE_SUGGESTIONS_CLEAR';
|
||||||
export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY';
|
export const COMPOSE_SUGGESTIONS_READY = 'COMPOSE_SUGGESTIONS_READY';
|
||||||
export const COMPOSE_SUGGESTIONS_READY_TXT = 'COMPOSE_SUGGESTIONS_READY_TXT';
|
|
||||||
export const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT';
|
export const COMPOSE_SUGGESTION_SELECT = 'COMPOSE_SUGGESTION_SELECT';
|
||||||
|
|
||||||
export const COMPOSE_MOUNT = 'COMPOSE_MOUNT';
|
export const COMPOSE_MOUNT = 'COMPOSE_MOUNT';
|
||||||
@@ -39,6 +41,12 @@ export const COMPOSE_COMPOSING_CHANGE = 'COMPOSE_COMPOSING_CHANGE';
|
|||||||
|
|
||||||
export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT';
|
export const COMPOSE_EMOJI_INSERT = 'COMPOSE_EMOJI_INSERT';
|
||||||
|
|
||||||
|
export const COMPOSE_UPLOAD_CHANGE_REQUEST = 'COMPOSE_UPLOAD_UPDATE_REQUEST';
|
||||||
|
export const COMPOSE_UPLOAD_CHANGE_SUCCESS = 'COMPOSE_UPLOAD_UPDATE_SUCCESS';
|
||||||
|
export const COMPOSE_UPLOAD_CHANGE_FAIL = 'COMPOSE_UPLOAD_UPDATE_FAIL';
|
||||||
|
|
||||||
|
export const COMPOSE_DOODLE_SET = 'COMPOSE_DOODLE_SET';
|
||||||
|
|
||||||
export function changeCompose(text) {
|
export function changeCompose(text) {
|
||||||
return {
|
return {
|
||||||
type: COMPOSE_CHANGE,
|
type: COMPOSE_CHANGE,
|
||||||
@@ -65,6 +73,12 @@ export function cancelReplyCompose() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function resetCompose() {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_RESET,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export function mentionCompose(account, router) {
|
export function mentionCompose(account, router) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch({
|
dispatch({
|
||||||
@@ -146,6 +160,13 @@ export function submitComposeFail(error) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function doodleSet(options) {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_DOODLE_SET,
|
||||||
|
options: options,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export function uploadCompose(files) {
|
export function uploadCompose(files) {
|
||||||
return function (dispatch, getState) {
|
return function (dispatch, getState) {
|
||||||
if (getState().getIn(['compose', 'media_attachments']).size > 3) {
|
if (getState().getIn(['compose', 'media_attachments']).size > 3) {
|
||||||
@@ -169,6 +190,40 @@ export function uploadCompose(files) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export function changeUploadCompose(id, description) {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
dispatch(changeUploadComposeRequest());
|
||||||
|
|
||||||
|
api(getState).put(`/api/v1/media/${id}`, { description }).then(response => {
|
||||||
|
dispatch(changeUploadComposeSuccess(response.data));
|
||||||
|
}).catch(error => {
|
||||||
|
dispatch(changeUploadComposeFail(id, error));
|
||||||
|
});
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export function changeUploadComposeRequest() {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_UPLOAD_CHANGE_REQUEST,
|
||||||
|
skipLoading: true,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
export function changeUploadComposeSuccess(media) {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_UPLOAD_CHANGE_SUCCESS,
|
||||||
|
media: media,
|
||||||
|
skipLoading: true,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export function changeUploadComposeFail(error) {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_UPLOAD_CHANGE_FAIL,
|
||||||
|
error: error,
|
||||||
|
skipLoading: true,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
export function uploadComposeRequest() {
|
export function uploadComposeRequest() {
|
||||||
return {
|
return {
|
||||||
type: COMPOSE_UPLOAD_REQUEST,
|
type: COMPOSE_UPLOAD_REQUEST,
|
||||||
@@ -213,59 +268,42 @@ export function clearComposeSuggestions() {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
let allShortcodes = null; // cached list of all shortcodes for suggestions
|
const fetchComposeSuggestionsAccounts = throttle((dispatch, getState, token) => {
|
||||||
|
api(getState).get('/api/v1/accounts/search', {
|
||||||
|
params: {
|
||||||
|
q: token.slice(1),
|
||||||
|
resolve: false,
|
||||||
|
limit: 4,
|
||||||
|
},
|
||||||
|
}).then(response => {
|
||||||
|
dispatch(readyComposeSuggestionsAccounts(token, response.data));
|
||||||
|
});
|
||||||
|
}, 200, { leading: true, trailing: true });
|
||||||
|
|
||||||
export function fetchComposeSuggestions(token) {
|
const fetchComposeSuggestionsEmojis = (dispatch, getState, token) => {
|
||||||
let leading = token[0];
|
const results = emojiSearch(token.replace(':', ''), { maxResults: 5 });
|
||||||
|
dispatch(readyComposeSuggestionsEmojis(token, results));
|
||||||
if (leading === '@') {
|
|
||||||
// handle search
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
api(getState).get('/api/v1/accounts/search', {
|
|
||||||
params: {
|
|
||||||
q: token.slice(1), // remove the '@'
|
|
||||||
resolve: false,
|
|
||||||
limit: 4,
|
|
||||||
},
|
|
||||||
}).then(response => {
|
|
||||||
dispatch(readyComposeSuggestions(token, response.data));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
} else if (leading === ':') {
|
|
||||||
// shortcode
|
|
||||||
if (!allShortcodes) {
|
|
||||||
allShortcodes = Object.keys(emojione.emojioneList);
|
|
||||||
// TODO when we have custom emojons merged, add them to this shortcode list
|
|
||||||
}
|
|
||||||
return (dispatch) => {
|
|
||||||
const innertxt = token.slice(1);
|
|
||||||
if (innertxt.length > 1) { // prevent searching single letter, causes lag
|
|
||||||
dispatch(readyComposeSuggestionsTxt(token, allShortcodes.filter((sc) => {
|
|
||||||
return sc.indexOf(innertxt) !== -1;
|
|
||||||
}).sort((a, b) => {
|
|
||||||
if (a.indexOf(token) === 0 && b.indexOf(token) === 0) return a.localeCompare(b);
|
|
||||||
if (a.indexOf(token) === 0) return -1;
|
|
||||||
if (b.indexOf(token) === 0) return 1;
|
|
||||||
return a.localeCompare(b);
|
|
||||||
})));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
} else {
|
|
||||||
// hashtag
|
|
||||||
return (dispatch, getState) => {
|
|
||||||
api(getState).get('/api/v1/search', {
|
|
||||||
params: {
|
|
||||||
q: token,
|
|
||||||
resolve: true,
|
|
||||||
},
|
|
||||||
}).then(response => {
|
|
||||||
dispatch(readyComposeSuggestionsTxt(token, response.data.hashtags.map((ht) => `#${ht}`)));
|
|
||||||
});
|
|
||||||
};
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export function readyComposeSuggestions(token, accounts) {
|
export function fetchComposeSuggestions(token) {
|
||||||
|
return (dispatch, getState) => {
|
||||||
|
if (token[0] === ':') {
|
||||||
|
fetchComposeSuggestionsEmojis(dispatch, getState, token);
|
||||||
|
} else {
|
||||||
|
fetchComposeSuggestionsAccounts(dispatch, getState, token);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export function readyComposeSuggestionsEmojis(token, emojis) {
|
||||||
|
return {
|
||||||
|
type: COMPOSE_SUGGESTIONS_READY,
|
||||||
|
token,
|
||||||
|
emojis,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export function readyComposeSuggestionsAccounts(token, accounts) {
|
||||||
return {
|
return {
|
||||||
type: COMPOSE_SUGGESTIONS_READY,
|
type: COMPOSE_SUGGESTIONS_READY,
|
||||||
token,
|
token,
|
||||||
@@ -273,23 +311,23 @@ export function readyComposeSuggestions(token, accounts) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function readyComposeSuggestionsTxt(token, items) {
|
export function selectComposeSuggestion(position, token, suggestion) {
|
||||||
return {
|
|
||||||
type: COMPOSE_SUGGESTIONS_READY_TXT,
|
|
||||||
token,
|
|
||||||
items,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export function selectComposeSuggestion(position, token, accountId) {
|
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const completion = (typeof accountId === 'string') ?
|
let completion, startPosition;
|
||||||
accountId.slice(1) : // text suggestion: discard the leading : or # - the replacing code replaces only what follows
|
|
||||||
getState().getIn(['accounts', accountId, 'acct']);
|
if (typeof suggestion === 'object' && suggestion.id) {
|
||||||
|
completion = suggestion.native || suggestion.colons;
|
||||||
|
startPosition = position - 1;
|
||||||
|
|
||||||
|
dispatch(useEmoji(suggestion));
|
||||||
|
} else {
|
||||||
|
completion = getState().getIn(['accounts', suggestion, 'acct']);
|
||||||
|
startPosition = position;
|
||||||
|
}
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: COMPOSE_SUGGESTION_SELECT,
|
type: COMPOSE_SUGGESTION_SELECT,
|
||||||
position,
|
position: startPosition,
|
||||||
token,
|
token,
|
||||||
completion,
|
completion,
|
||||||
});
|
});
|
||||||
|
|||||||
14
app/javascript/mastodon/actions/emojis.js
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
import { saveSettings } from './settings';
|
||||||
|
|
||||||
|
export const EMOJI_USE = 'EMOJI_USE';
|
||||||
|
|
||||||
|
export function useEmoji(emoji) {
|
||||||
|
return dispatch => {
|
||||||
|
dispatch({
|
||||||
|
type: EMOJI_USE,
|
||||||
|
emoji,
|
||||||
|
});
|
||||||
|
|
||||||
|
dispatch(saveSettings());
|
||||||
|
};
|
||||||
|
};
|
||||||
17
app/javascript/mastodon/actions/height_cache.js
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
export const HEIGHT_CACHE_SET = 'HEIGHT_CACHE_SET';
|
||||||
|
export const HEIGHT_CACHE_CLEAR = 'HEIGHT_CACHE_CLEAR';
|
||||||
|
|
||||||
|
export function setHeight (key, id, height) {
|
||||||
|
return {
|
||||||
|
type: HEIGHT_CACHE_SET,
|
||||||
|
key,
|
||||||
|
id,
|
||||||
|
height,
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
export function clearHeight () {
|
||||||
|
return {
|
||||||
|
type: HEIGHT_CACHE_CLEAR,
|
||||||
|
};
|
||||||
|
};
|
||||||
@@ -42,6 +42,7 @@ const fetchRelatedRelationships = (dispatch, notifications) => {
|
|||||||
|
|
||||||
const unescapeHTML = (html) => {
|
const unescapeHTML = (html) => {
|
||||||
const wrapper = document.createElement('div');
|
const wrapper = document.createElement('div');
|
||||||
|
html = html.replace(/<br \/>|<br>|\n/, ' ');
|
||||||
wrapper.innerHTML = html;
|
wrapper.innerHTML = html;
|
||||||
return wrapper.textContent;
|
return wrapper.textContent;
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
import { debounce } from 'lodash';
|
||||||
|
|
||||||
export const SETTING_CHANGE = 'SETTING_CHANGE';
|
export const SETTING_CHANGE = 'SETTING_CHANGE';
|
||||||
|
export const SETTING_SAVE = 'SETTING_SAVE';
|
||||||
|
|
||||||
export function changeSetting(key, value) {
|
export function changeSetting(key, value) {
|
||||||
return dispatch => {
|
return dispatch => {
|
||||||
@@ -14,10 +16,16 @@ export function changeSetting(key, value) {
|
|||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const debouncedSave = debounce((dispatch, getState) => {
|
||||||
|
if (getState().getIn(['settings', 'saved'])) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const data = getState().get('settings').filter((_, key) => key !== 'saved').toJS();
|
||||||
|
|
||||||
|
axios.put('/api/web/settings', { data }).then(() => dispatch({ type: SETTING_SAVE }));
|
||||||
|
}, 5000, { trailing: true });
|
||||||
|
|
||||||
export function saveSettings() {
|
export function saveSettings() {
|
||||||
return (_, getState) => {
|
return (dispatch, getState) => debouncedSave(dispatch, getState);
|
||||||
axios.put('/api/web/settings', {
|
|
||||||
data: getState().get('settings').toJS(),
|
|
||||||
});
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -23,9 +23,6 @@ export const STATUS_UNMUTE_REQUEST = 'STATUS_UNMUTE_REQUEST';
|
|||||||
export const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS';
|
export const STATUS_UNMUTE_SUCCESS = 'STATUS_UNMUTE_SUCCESS';
|
||||||
export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL';
|
export const STATUS_UNMUTE_FAIL = 'STATUS_UNMUTE_FAIL';
|
||||||
|
|
||||||
export const STATUS_SET_HEIGHT = 'STATUS_SET_HEIGHT';
|
|
||||||
export const STATUSES_CLEAR_HEIGHT = 'STATUSES_CLEAR_HEIGHT';
|
|
||||||
|
|
||||||
export function fetchStatusRequest(id, skipLoading) {
|
export function fetchStatusRequest(id, skipLoading) {
|
||||||
return {
|
return {
|
||||||
type: STATUS_FETCH_REQUEST,
|
type: STATUS_FETCH_REQUEST,
|
||||||
@@ -218,17 +215,3 @@ export function unmuteStatusFail(id, error) {
|
|||||||
error,
|
error,
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
export function setStatusHeight (id, height) {
|
|
||||||
return {
|
|
||||||
type: STATUS_SET_HEIGHT,
|
|
||||||
id,
|
|
||||||
height,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
export function clearStatusesHeight () {
|
|
||||||
return {
|
|
||||||
type: STATUSES_CLEAR_HEIGHT,
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|||||||
@@ -5,8 +5,7 @@ export const STORE_HYDRATE_LAZY = 'STORE_HYDRATE_LAZY';
|
|||||||
|
|
||||||
const convertState = rawState =>
|
const convertState = rawState =>
|
||||||
fromJS(rawState, (k, v) =>
|
fromJS(rawState, (k, v) =>
|
||||||
Iterable.isIndexed(v) ? v.toList() : v.toMap().mapKeys(x =>
|
Iterable.isIndexed(v) ? v.toList() : v.toMap());
|
||||||
Number.isNaN(x * 1) ? x : x * 1));
|
|
||||||
|
|
||||||
export function hydrateStore(rawState) {
|
export function hydrateStore(rawState) {
|
||||||
const state = convertState(rawState);
|
const state = convertState(rawState);
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ export const TIMELINE_SCROLL_TOP = 'TIMELINE_SCROLL_TOP';
|
|||||||
export const TIMELINE_CONNECT = 'TIMELINE_CONNECT';
|
export const TIMELINE_CONNECT = 'TIMELINE_CONNECT';
|
||||||
export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
|
export const TIMELINE_DISCONNECT = 'TIMELINE_DISCONNECT';
|
||||||
|
|
||||||
|
export const TIMELINE_CONTEXT_UPDATE = 'CONTEXT_UPDATE';
|
||||||
|
|
||||||
export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) {
|
export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) {
|
||||||
return {
|
return {
|
||||||
type: TIMELINE_REFRESH_SUCCESS,
|
type: TIMELINE_REFRESH_SUCCESS,
|
||||||
@@ -30,6 +32,16 @@ export function refreshTimelineSuccess(timeline, statuses, skipLoading, next) {
|
|||||||
export function updateTimeline(timeline, status) {
|
export function updateTimeline(timeline, status) {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
const references = status.reblog ? getState().get('statuses').filter((item, itemId) => (itemId === status.reblog.id || item.get('reblog') === status.reblog.id)).map((_, itemId) => itemId) : [];
|
const references = status.reblog ? getState().get('statuses').filter((item, itemId) => (itemId === status.reblog.id || item.get('reblog') === status.reblog.id)).map((_, itemId) => itemId) : [];
|
||||||
|
const parents = [];
|
||||||
|
|
||||||
|
if (status.in_reply_to_id) {
|
||||||
|
let parent = getState().getIn(['statuses', status.in_reply_to_id]);
|
||||||
|
|
||||||
|
while (parent && parent.get('in_reply_to_id')) {
|
||||||
|
parents.push(parent.get('id'));
|
||||||
|
parent = getState().getIn(['statuses', parent.get('in_reply_to_id')]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
dispatch({
|
dispatch({
|
||||||
type: TIMELINE_UPDATE,
|
type: TIMELINE_UPDATE,
|
||||||
@@ -37,6 +49,14 @@ export function updateTimeline(timeline, status) {
|
|||||||
status,
|
status,
|
||||||
references,
|
references,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (parents.length > 0) {
|
||||||
|
dispatch({
|
||||||
|
type: TIMELINE_CONTEXT_UPDATE,
|
||||||
|
status,
|
||||||
|
references: parents,
|
||||||
|
});
|
||||||
|
}
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import 'intl';
|
import 'intl';
|
||||||
import 'intl/locale-data/jsonp/en.js';
|
import 'intl/locale-data/jsonp/en';
|
||||||
import 'es6-symbol/implement';
|
import 'es6-symbol/implement';
|
||||||
import includes from 'array-includes';
|
import includes from 'array-includes';
|
||||||
import assign from 'object-assign';
|
import assign from 'object-assign';
|
||||||
|
|||||||
@@ -0,0 +1,35 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`<Avatar /> Autoplay renders a animated avatar 1`] = `
|
||||||
|
<div
|
||||||
|
className="account__avatar"
|
||||||
|
data-avatar-of="@alice"
|
||||||
|
onMouseEnter={[Function]}
|
||||||
|
onMouseLeave={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"backgroundImage": "url(/animated/alice.gif)",
|
||||||
|
"backgroundSize": "100px 100px",
|
||||||
|
"height": "100px",
|
||||||
|
"width": "100px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Avatar /> Still renders a still avatar 1`] = `
|
||||||
|
<div
|
||||||
|
className="account__avatar"
|
||||||
|
data-avatar-of="@alice"
|
||||||
|
onMouseEnter={[Function]}
|
||||||
|
onMouseLeave={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"backgroundImage": "url(/static/alice.jpg)",
|
||||||
|
"backgroundSize": "100px 100px",
|
||||||
|
"height": "100px",
|
||||||
|
"width": "100px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`<AvatarOverlay renders a overlay avatar 1`] = `
|
||||||
|
<div
|
||||||
|
className="account__avatar-overlay"
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className="account__avatar-overlay-base"
|
||||||
|
data-avatar-of="@alice"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"backgroundImage": "url(/static/alice.jpg)",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
<div
|
||||||
|
className="account__avatar-overlay-overlay"
|
||||||
|
data-avatar-of="@eve@blackhat.lair"
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"backgroundImage": "url(/static/eve.jpg)",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -0,0 +1,114 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`<Button /> adds class "button-secondary" if props.secondary given 1`] = `
|
||||||
|
<button
|
||||||
|
className="button button-secondary"
|
||||||
|
disabled={undefined}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Button /> renders a button element 1`] = `
|
||||||
|
<button
|
||||||
|
className="button"
|
||||||
|
disabled={undefined}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Button /> renders a disabled attribute if props.disabled given 1`] = `
|
||||||
|
<button
|
||||||
|
className="button"
|
||||||
|
disabled={true}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Button /> renders class="button--block" if props.block given 1`] = `
|
||||||
|
<button
|
||||||
|
className="button button--block"
|
||||||
|
disabled={undefined}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Button /> renders the children 1`] = `
|
||||||
|
<button
|
||||||
|
className="button"
|
||||||
|
disabled={undefined}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
<p>
|
||||||
|
children
|
||||||
|
</p>
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Button /> renders the given text 1`] = `
|
||||||
|
<button
|
||||||
|
className="button"
|
||||||
|
disabled={undefined}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
foo
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
|
|
||||||
|
exports[`<Button /> renders the props.text instead of children 1`] = `
|
||||||
|
<button
|
||||||
|
className="button"
|
||||||
|
disabled={undefined}
|
||||||
|
onClick={[Function]}
|
||||||
|
style={
|
||||||
|
Object {
|
||||||
|
"height": "36px",
|
||||||
|
"lineHeight": "36px",
|
||||||
|
"padding": "0 16px",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
>
|
||||||
|
foo
|
||||||
|
</button>
|
||||||
|
`;
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`<DisplayName /> renders display name + account name 1`] = `
|
||||||
|
<span
|
||||||
|
className="display-name"
|
||||||
|
>
|
||||||
|
<strong
|
||||||
|
className="display-name__html"
|
||||||
|
dangerouslySetInnerHTML={
|
||||||
|
Object {
|
||||||
|
"__html": "<p>Foo</p>",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/>
|
||||||
|
|
||||||
|
<span
|
||||||
|
className="display-name__account"
|
||||||
|
>
|
||||||
|
@
|
||||||
|
bar@baz
|
||||||
|
</span>
|
||||||
|
</span>
|
||||||
|
`;
|
||||||
36
app/javascript/mastodon/components/__tests__/avatar-test.js
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
import { fromJS } from 'immutable';
|
||||||
|
import Avatar from '../avatar';
|
||||||
|
|
||||||
|
describe('<Avatar />', () => {
|
||||||
|
const account = fromJS({
|
||||||
|
username: 'alice',
|
||||||
|
acct: 'alice',
|
||||||
|
display_name: 'Alice',
|
||||||
|
avatar: '/animated/alice.gif',
|
||||||
|
avatar_static: '/static/alice.jpg',
|
||||||
|
});
|
||||||
|
|
||||||
|
const size = 100;
|
||||||
|
|
||||||
|
describe('Autoplay', () => {
|
||||||
|
it('renders a animated avatar', () => {
|
||||||
|
const component = renderer.create(<Avatar account={account} animate size={size} />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
describe('Still', () => {
|
||||||
|
it('renders a still avatar', () => {
|
||||||
|
const component = renderer.create(<Avatar account={account} size={size} />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
// TODO add autoplay test if possible
|
||||||
|
});
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
import { fromJS } from 'immutable';
|
||||||
|
import AvatarOverlay from '../avatar_overlay';
|
||||||
|
|
||||||
|
describe('<AvatarOverlay', () => {
|
||||||
|
const account = fromJS({
|
||||||
|
username: 'alice',
|
||||||
|
acct: 'alice',
|
||||||
|
display_name: 'Alice',
|
||||||
|
avatar: '/animated/alice.gif',
|
||||||
|
avatar_static: '/static/alice.jpg',
|
||||||
|
});
|
||||||
|
|
||||||
|
const friend = fromJS({
|
||||||
|
username: 'eve',
|
||||||
|
acct: 'eve@blackhat.lair',
|
||||||
|
display_name: 'Evelyn',
|
||||||
|
avatar: '/animated/eve.gif',
|
||||||
|
avatar_static: '/static/eve.jpg',
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders a overlay avatar', () => {
|
||||||
|
const component = renderer.create(<AvatarOverlay account={account} friend={friend} />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
75
app/javascript/mastodon/components/__tests__/button-test.js
Normal file
@@ -0,0 +1,75 @@
|
|||||||
|
import { shallow } from 'enzyme';
|
||||||
|
import React from 'react';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
import Button from '../button';
|
||||||
|
|
||||||
|
describe('<Button />', () => {
|
||||||
|
it('renders a button element', () => {
|
||||||
|
const component = renderer.create(<Button />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the given text', () => {
|
||||||
|
const text = 'foo';
|
||||||
|
const component = renderer.create(<Button text={text} />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('handles click events using the given handler', () => {
|
||||||
|
const handler = jest.fn();
|
||||||
|
const button = shallow(<Button onClick={handler} />);
|
||||||
|
button.find('button').simulate('click');
|
||||||
|
|
||||||
|
expect(handler.mock.calls.length).toEqual(1);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('does not handle click events if props.disabled given', () => {
|
||||||
|
const handler = jest.fn();
|
||||||
|
const button = shallow(<Button onClick={handler} disabled />);
|
||||||
|
button.find('button').simulate('click');
|
||||||
|
|
||||||
|
expect(handler.mock.calls.length).toEqual(0);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders a disabled attribute if props.disabled given', () => {
|
||||||
|
const component = renderer.create(<Button disabled />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the children', () => {
|
||||||
|
const children = <p>children</p>;
|
||||||
|
const component = renderer.create(<Button>{children}</Button>);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders the props.text instead of children', () => {
|
||||||
|
const text = 'foo';
|
||||||
|
const children = <p>children</p>;
|
||||||
|
const component = renderer.create(<Button text={text}>{children}</Button>);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('renders class="button--block" if props.block given', () => {
|
||||||
|
const component = renderer.create(<Button block />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
|
||||||
|
it('adds class "button-secondary" if props.secondary given', () => {
|
||||||
|
const component = renderer.create(<Button secondary />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
import { fromJS } from 'immutable';
|
||||||
|
import DisplayName from '../display_name';
|
||||||
|
|
||||||
|
describe('<DisplayName />', () => {
|
||||||
|
it('renders display name + account name', () => {
|
||||||
|
const account = fromJS({
|
||||||
|
username: 'bar',
|
||||||
|
acct: 'bar@baz',
|
||||||
|
display_name_html: '<p>Foo</p>',
|
||||||
|
});
|
||||||
|
const component = renderer.create(<DisplayName account={account} />);
|
||||||
|
const tree = component.toJSON();
|
||||||
|
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -23,7 +23,7 @@ export default class Account extends ImmutablePureComponent {
|
|||||||
|
|
||||||
static propTypes = {
|
static propTypes = {
|
||||||
account: ImmutablePropTypes.map.isRequired,
|
account: ImmutablePropTypes.map.isRequired,
|
||||||
me: PropTypes.number.isRequired,
|
me: PropTypes.string.isRequired,
|
||||||
onFollow: PropTypes.func.isRequired,
|
onFollow: PropTypes.func.isRequired,
|
||||||
onBlock: PropTypes.func.isRequired,
|
onBlock: PropTypes.func.isRequired,
|
||||||
onMute: PropTypes.func.isRequired,
|
onMute: PropTypes.func.isRequired,
|
||||||
|
|||||||
42
app/javascript/mastodon/components/autosuggest_emoji.js
Normal file
@@ -0,0 +1,42 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import PropTypes from 'prop-types';
|
||||||
|
import unicodeMapping from '../features/emoji/emoji_unicode_mapping_light';
|
||||||
|
|
||||||
|
const assetHost = process.env.CDN_HOST || '';
|
||||||
|
|
||||||
|
export default class AutosuggestEmoji extends React.PureComponent {
|
||||||
|
|
||||||
|
static propTypes = {
|
||||||
|
emoji: PropTypes.object.isRequired,
|
||||||
|
};
|
||||||
|
|
||||||
|
render () {
|
||||||
|
const { emoji } = this.props;
|
||||||
|
let url;
|
||||||
|
|
||||||
|
if (emoji.custom) {
|
||||||
|
url = emoji.imageUrl;
|
||||||
|
} else {
|
||||||
|
const mapping = unicodeMapping[emoji.native] || unicodeMapping[emoji.native.replace(/\uFE0F$/, '')];
|
||||||
|
|
||||||
|
if (!mapping) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
url = `${assetHost}/emoji/${mapping.filename}.svg`;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className='autosuggest-emoji'>
|
||||||
|
<img
|
||||||
|
className='emojione'
|
||||||
|
src={url}
|
||||||
|
alt={emoji.native || emoji.colons}
|
||||||
|
/>
|
||||||
|
|
||||||
|
{emoji.colons}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,17 +1,18 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
|
import AutosuggestAccountContainer from '../features/compose/containers/autosuggest_account_container';
|
||||||
import AutosuggestShortcode from '../features/compose/components/autosuggest_shortcode';
|
import AutosuggestEmoji from './autosuggest_emoji';
|
||||||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
import { isRtl } from '../rtl';
|
import { isRtl } from '../rtl';
|
||||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||||
import Textarea from 'react-textarea-autosize';
|
import Textarea from 'react-textarea-autosize';
|
||||||
|
import classNames from 'classnames';
|
||||||
|
|
||||||
const textAtCursorMatchesToken = (str, caretPosition) => {
|
const textAtCursorMatchesToken = (str, caretPosition) => {
|
||||||
let word;
|
let word;
|
||||||
|
|
||||||
let left = str.slice(0, caretPosition).search(/\S+$/);
|
let left = str.slice(0, caretPosition).search(/[^\s\u200B]+$/);
|
||||||
let right = str.slice(caretPosition).search(/\s/);
|
let right = str.slice(caretPosition).search(/[\s\u200B]/);
|
||||||
|
|
||||||
if (right < 0) {
|
if (right < 0) {
|
||||||
word = str.slice(left);
|
word = str.slice(left);
|
||||||
@@ -19,12 +20,11 @@ const textAtCursorMatchesToken = (str, caretPosition) => {
|
|||||||
word = str.slice(left, right + caretPosition);
|
word = str.slice(left, right + caretPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!word || word.trim().length < 2 || ['@', ':', '#'].indexOf(word[0]) === -1) {
|
if (!word || word.trim().length < 3 || ['@', ':'].indexOf(word[0]) === -1) {
|
||||||
return [null, null];
|
return [null, null];
|
||||||
}
|
}
|
||||||
|
|
||||||
word = word.trim().toLowerCase();
|
word = word.trim().toLowerCase();
|
||||||
// was: .slice(1); - we leave the leading char there, handler can decide what to do based on it
|
|
||||||
|
|
||||||
if (word.length > 0) {
|
if (word.length > 0) {
|
||||||
return [left + 1, word];
|
return [left + 1, word];
|
||||||
@@ -43,7 +43,6 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
onSuggestionSelected: PropTypes.func.isRequired,
|
onSuggestionSelected: PropTypes.func.isRequired,
|
||||||
onSuggestionsClearRequested: PropTypes.func.isRequired,
|
onSuggestionsClearRequested: PropTypes.func.isRequired,
|
||||||
onSuggestionsFetchRequested: PropTypes.func.isRequired,
|
onSuggestionsFetchRequested: PropTypes.func.isRequired,
|
||||||
onLocalSuggestionsFetchRequested: PropTypes.func.isRequired,
|
|
||||||
onChange: PropTypes.func.isRequired,
|
onChange: PropTypes.func.isRequired,
|
||||||
onKeyUp: PropTypes.func,
|
onKeyUp: PropTypes.func,
|
||||||
onKeyDown: PropTypes.func,
|
onKeyDown: PropTypes.func,
|
||||||
@@ -67,13 +66,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
|
|
||||||
if (token !== null && this.state.lastToken !== token) {
|
if (token !== null && this.state.lastToken !== token) {
|
||||||
this.setState({ lastToken: token, selectedSuggestion: 0, tokenStart });
|
this.setState({ lastToken: token, selectedSuggestion: 0, tokenStart });
|
||||||
if (token[0] === ':') {
|
this.props.onSuggestionsFetchRequested(token);
|
||||||
// faster debounce for shortcodes.
|
|
||||||
// hashtags have long debounce because they're fetched from server.
|
|
||||||
this.props.onLocalSuggestionsFetchRequested(token);
|
|
||||||
} else {
|
|
||||||
this.props.onSuggestionsFetchRequested(token);
|
|
||||||
}
|
|
||||||
} else if (token === null) {
|
} else if (token === null) {
|
||||||
this.setState({ lastToken: null });
|
this.setState({ lastToken: null });
|
||||||
this.props.onSuggestionsClearRequested();
|
this.props.onSuggestionsClearRequested();
|
||||||
@@ -132,14 +125,22 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
this.props.onKeyDown(e);
|
this.props.onKeyDown(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onKeyUp = e => {
|
||||||
|
if (e.key === 'Escape' && this.state.suggestionsHidden) {
|
||||||
|
document.querySelector('.ui').parentElement.focus();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.props.onKeyUp) {
|
||||||
|
this.props.onKeyUp(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
onBlur = () => {
|
onBlur = () => {
|
||||||
this.setState({ suggestionsHidden: true });
|
this.setState({ suggestionsHidden: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
onSuggestionClick = (e) => {
|
onSuggestionClick = (e) => {
|
||||||
// leave suggestion string unchanged if it's a hash / shortcode suggestion. convert account number to int.
|
const suggestion = this.props.suggestions.get(e.currentTarget.getAttribute('data-index'));
|
||||||
const suggestionStr = e.currentTarget.getAttribute('data-index');
|
|
||||||
const suggestion = [':', '#'].indexOf(suggestionStr[0]) !== -1 ? suggestionStr : Number(suggestionStr);
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion);
|
this.props.onSuggestionSelected(this.state.tokenStart, this.state.lastToken, suggestion);
|
||||||
this.textarea.focus();
|
this.textarea.focus();
|
||||||
@@ -162,36 +163,39 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
componentDidUpdate () {
|
renderSuggestion = (suggestion, i) => {
|
||||||
if (this.refs.selected) {
|
const { selectedSuggestion } = this.state;
|
||||||
if (this.refs.selected.scrollIntoViewIfNeeded)
|
let inner, key;
|
||||||
this.refs.selected.scrollIntoViewIfNeeded();
|
|
||||||
else
|
if (typeof suggestion === 'object') {
|
||||||
this.refs.selected.scrollIntoView({ behavior: 'auto', block: 'nearest' });
|
inner = <AutosuggestEmoji emoji={suggestion} />;
|
||||||
|
key = suggestion.id;
|
||||||
|
} else {
|
||||||
|
inner = <AutosuggestAccountContainer id={suggestion} />;
|
||||||
|
key = suggestion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div role='button' tabIndex='0' key={key} data-index={i} className={classNames('autosuggest-textarea__suggestions__item', { selected: i === selectedSuggestion })} onMouseDown={this.onSuggestionClick}>
|
||||||
|
{inner}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
render () {
|
render () {
|
||||||
const { value, suggestions, disabled, placeholder, onKeyUp, autoFocus } = this.props;
|
const { value, suggestions, disabled, placeholder, autoFocus } = this.props;
|
||||||
const { suggestionsHidden, selectedSuggestion } = this.state;
|
const { suggestionsHidden } = this.state;
|
||||||
const style = { direction: 'ltr' };
|
const style = { direction: 'ltr' };
|
||||||
|
|
||||||
if (isRtl(value)) {
|
if (isRtl(value)) {
|
||||||
style.direction = 'rtl';
|
style.direction = 'rtl';
|
||||||
}
|
}
|
||||||
|
|
||||||
let makeItem = (suggestion) => {
|
|
||||||
if (suggestion[0] === ':') return <AutosuggestShortcode shortcode={suggestion} />;
|
|
||||||
if (suggestion[0] === '#') return suggestion; // hashtag
|
|
||||||
|
|
||||||
// else - accounts are always returned as IDs with no prefix
|
|
||||||
return <AutosuggestAccountContainer id={suggestion} />;
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className='autosuggest-textarea'>
|
<div className='autosuggest-textarea'>
|
||||||
<label>
|
<label>
|
||||||
<span style={{ display: 'none' }}>{placeholder}</span>
|
<span style={{ display: 'none' }}>{placeholder}</span>
|
||||||
|
|
||||||
<Textarea
|
<Textarea
|
||||||
inputRef={this.setTextarea}
|
inputRef={this.setTextarea}
|
||||||
className='autosuggest-textarea__textarea'
|
className='autosuggest-textarea__textarea'
|
||||||
@@ -201,7 +205,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
value={value}
|
value={value}
|
||||||
onChange={this.onChange}
|
onChange={this.onChange}
|
||||||
onKeyDown={this.onKeyDown}
|
onKeyDown={this.onKeyDown}
|
||||||
onKeyUp={onKeyUp}
|
onKeyUp={this.onKeyUp}
|
||||||
onBlur={this.onBlur}
|
onBlur={this.onBlur}
|
||||||
onPaste={this.onPaste}
|
onPaste={this.onPaste}
|
||||||
style={style}
|
style={style}
|
||||||
@@ -209,19 +213,7 @@ export default class AutosuggestTextarea extends ImmutablePureComponent {
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}>
|
<div className={`autosuggest-textarea__suggestions ${suggestionsHidden || suggestions.isEmpty() ? '' : 'autosuggest-textarea__suggestions--visible'}`}>
|
||||||
{suggestions.map((suggestion, i) => (
|
{suggestions.map(this.renderSuggestion)}
|
||||||
<div
|
|
||||||
ref={i === selectedSuggestion ? 'selected' : null}
|
|
||||||
role='button'
|
|
||||||
tabIndex='0'
|
|
||||||
key={suggestion}
|
|
||||||
data-index={suggestion}
|
|
||||||
className={`autosuggest-textarea__suggestions__item ${i === selectedSuggestion ? 'selected' : ''}`}
|
|
||||||
onMouseDown={this.onSuggestionClick}
|
|
||||||
>
|
|
||||||
{makeItem(suggestion)}
|
|
||||||
</div>
|
|
||||||
))}
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import Motion from 'react-motion/lib/Motion';
|
import Motion from '../features/ui/util/optional_motion';
|
||||||
import spring from 'react-motion/lib/spring';
|
import spring from 'react-motion/lib/spring';
|
||||||
import PropTypes from 'prop-types';
|
import PropTypes from 'prop-types';
|
||||||
|
|
||||||
|
|||||||