Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump faker from 2.17.0 to 2.18.0 #757

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
f809d92
[Change] 日本語検索に関する最適化
highemerly Sep 13, 2019
f17bf7e
[Change] 投票投稿時のWeb/API上のパラメータを修正
highemerly Sep 13, 2019
2835853
[Add] Announcement機能をマージ
highemerly Sep 13, 2019
0d87a2c
[Change] .gitignoreに独自関連機能関連ファイルを追加
highemerly Nov 30, 2019
ebe7168
[Fix] 本家announcementsの導入に伴うCSSのclass name空間重複に関する問題を修正
highemerly Jan 26, 2020
06ef07e
[Add] サイトテーマにInstanceTicker type12 (ごま味) を追加
highemerly Jan 26, 2020
286e671
[Change] タイムライン取得上限値を400から1200に変更
highemerly Jan 28, 2020
b9d4ce7
[Add] 独自CSSを mods/handon.scss として組み込み
highemerly Jan 28, 2020
bf9aaf4
[Change] アカウント登録申請理由に関する表現を変更
highemerly Feb 16, 2020
1654e72
[Change] トレンドタグの選出条件を緩くした
highemerly Apr 5, 2020
6af343f
プロフィール絵文字を追加 (best-friends/mastodon)
highemerly May 8, 2021
a1c0217
[Add] カスタム絵文字のみの投稿をスタンプのように拡大表示
highemerly Nov 3, 2020
36420c0
[Fix] 通知カラムでDMマークの色が変わらなかった問題を修正
highemerly Nov 3, 2020
a8b3c6d
[Fix] InstanceTickerを有効にしても自インスタンスではティッカーを表示しない設定を通知欄にも適用
highemerly Nov 3, 2020
e5de73c
[Add] HTL上にDMを表示しないオプションを追加(かつデフォルトに設定)
highemerly May 8, 2021
f7c7287
Rails6のautoload周りの仕様がよく分からないので暫定対処
highemerly May 9, 2021
10ca423
[Change] TL上にブックマーク登録用のアクションボタンを追加
highemerly May 9, 2021
6fc87e3
[Fix] Rails6で別ドメインからのアクセスをはじく問題を修正
highemerly May 16, 2021
61c48ed
Bump faker from 2.17.0 to 2.18.0
dependabot[bot] May 16, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 4 additions & 0 deletions .gitignore
Expand Up @@ -65,3 +65,7 @@ yarn-debug.log

# Ignore Docker option files
docker-compose.override.yml

# Add by highemerly
public/announcements.json
public/server-info.html
2 changes: 1 addition & 1 deletion Gemfile
Expand Up @@ -115,7 +115,7 @@ end
group :test do
gem 'capybara', '~> 3.35'
gem 'climate_control', '~> 0.2'
gem 'faker', '~> 2.17'
gem 'faker', '~> 2.18'
gem 'microformats', '~> 4.2'
gem 'rails-controller-testing', '~> 1.0'
gem 'rspec-sidekiq', '~> 3.1'
Expand Down
4 changes: 2 additions & 2 deletions Gemfile.lock
Expand Up @@ -211,7 +211,7 @@ GEM
tzinfo
excon (0.76.0)
fabrication (2.22.0)
faker (2.17.0)
faker (2.18.0)
i18n (>= 1.6, < 2)
faraday (1.3.0)
faraday-net_http (~> 1.0)
Expand Down Expand Up @@ -704,7 +704,7 @@ DEPENDENCIES
dotenv-rails (~> 2.7)
ed25519 (~> 1.2)
fabrication (~> 2.22)
faker (~> 2.17)
faker (~> 2.18)
fast_blank (~> 1.0)
fastimage
fog-core (<= 2.1.0)
Expand Down
27 changes: 9 additions & 18 deletions app/chewy/statuses_index.rb
Expand Up @@ -2,30 +2,21 @@

class StatusesIndex < Chewy::Index
settings index: { refresh_interval: '15m' }, analysis: {
filter: {
english_stop: {
type: 'stop',
stopwords: '_english_',
},
english_stemmer: {
type: 'stemmer',
language: 'english',
},
english_possessive_stemmer: {
type: 'stemmer',
language: 'possessive_english',
tokenizer: {
kuromoji_user_dict: {
type: 'kuromoji_tokenizer',
user_dictionary: 'userdic.txt',
},
},
analyzer: {
content: {
tokenizer: 'uax_url_email',
type: 'custom',
tokenizer: 'kuromoji_user_dict',
filter: %w(
english_possessive_stemmer
lowercase
asciifolding
kuromoji_baseform
kuromoji_stemmer
cjk_width
english_stop
english_stemmer
lowercase
),
},
},
Expand Down
1 change: 1 addition & 0 deletions app/controllers/settings/preferences_controller.rb
Expand Up @@ -53,6 +53,7 @@ def user_settings_params
:setting_advanced_layout,
:setting_use_blurhash,
:setting_use_pending_items,
:setting_hidden_direct,
:setting_trends,
:setting_crop_images,
notification_emails: %i(follow follow_request reblog favourite mention digest report pending_account trending_tag),
Expand Down
9 changes: 8 additions & 1 deletion app/javascript/mastodon/actions/compose.js
Expand Up @@ -451,7 +451,11 @@ export function fetchComposeSuggestions(token) {
return (dispatch, getState) => {
switch (token[0]) {
case ':':
fetchComposeSuggestionsEmojis(dispatch, getState, token);
if (token[1] == '@') {
fetchComposeSuggestionsAccounts(dispatch, getState, token.substr(1, token.length));
} else {
fetchComposeSuggestionsEmojis(dispatch, getState, token);
}
break;
case '#':
fetchComposeSuggestionsTags(dispatch, getState, token);
Expand Down Expand Up @@ -500,6 +504,9 @@ export function selectComposeSuggestion(position, token, suggestion, path) {
} else if (suggestion.type === 'account') {
completion = getState().getIn(['accounts', suggestion.id, 'acct']);
startPosition = position;
if (token[0] == ':') {
completion = `@${completion}:`;
}
}

dispatch({
Expand Down
4 changes: 2 additions & 2 deletions app/javascript/mastodon/components/status.js
Expand Up @@ -464,8 +464,8 @@ class Status extends ImmutablePureComponent {
<div className={classNames('status__wrapper', `status__wrapper-${status.get('visibility')}`, { 'status__wrapper-reply': !!status.get('in_reply_to_id'), unread, focusable: !this.props.muted })} tabIndex={this.props.muted ? null : 0} data-featured={featured ? 'true' : null} aria-label={textForScreenReader(intl, status, rebloggedByText)} ref={this.handleRef}>
{prepend}

<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), muted: this.props.muted })} data-id={status.get('id')}>
<div className='status__expand' onClick={this.handleExpandClick} role='presentation' />
<div className={classNames('status', `status-${status.get('visibility')}`, { 'status-reply': !!status.get('in_reply_to_id'), muted: this.props.muted, read: unread === false })} data-id={status.get('id')}>
<div className='status__expand' onClick={this.handleClick} role='presentation' />
<div className='status__info'>
<a href={status.get('url')} className='status__relative-time' target='_blank' rel='noopener noreferrer'>
<span className='status__visibility-icon'><Icon id={visibilityIcon.icon} title={visibilityIcon.text} /></span>
Expand Down
6 changes: 2 additions & 4 deletions app/javascript/mastodon/components/status_action_bar.js
Expand Up @@ -240,14 +240,11 @@ class StatusActionBar extends ImmutablePureComponent {

menu.push(null);

menu.push({ text: intl.formatMessage(status.get('bookmarked') ? messages.removeBookmark : messages.bookmark), action: this.handleBookmarkClick });

if (writtenByMe && publicStatus) {
menu.push({ text: intl.formatMessage(status.get('pinned') ? messages.unpin : messages.pin), action: this.handlePinClick });
menu.push(null);
}

menu.push(null);

if (writtenByMe || withDismiss) {
menu.push({ text: intl.formatMessage(mutingConversation ? messages.unmuteConversation : messages.muteConversation), action: this.handleConversationMuteClick });
menu.push(null);
Expand Down Expand Up @@ -326,6 +323,7 @@ class StatusActionBar extends ImmutablePureComponent {
<IconButton className='status__action-bar-button' title={replyTitle} icon={status.get('in_reply_to_account_id') === status.getIn(['account', 'id']) ? 'reply' : replyIcon} onClick={this.handleReplyClick} counter={status.get('replies_count')} obfuscateCount />
<IconButton className={classNames('status__action-bar-button', { reblogPrivate })} disabled={!publicStatus && !reblogPrivate} active={status.get('reblogged')} pressed={status.get('reblogged')} title={reblogTitle} icon='retweet' onClick={this.handleReblogClick} />
<IconButton className='status__action-bar-button star-icon' animate active={status.get('favourited')} pressed={status.get('favourited')} title={intl.formatMessage(messages.favourite)} icon='star' onClick={this.handleFavouriteClick} />
<IconButton className='status__action-bar-button bookmark-icon' active={status.get('bookmarked')} title={intl.formatMessage(messages.bookmark)} icon='bookmark' onClick={this.handleBookmarkClick} />

{shareButton}

Expand Down
120 changes: 120 additions & 0 deletions app/javascript/mastodon/features/compose/components/announcements.js
@@ -0,0 +1,120 @@
import React from 'react';
import ImmutablePropTypes from 'react-immutable-proptypes';
import Immutable from 'immutable';
import { Link } from 'react-router-dom';
import axios from 'axios';
import classnames from 'classnames';

class Announcement extends React.PureComponent {

static propTypes = {
item: ImmutablePropTypes.map,
}

render() {
const { item } = this.props;

const contents = [];
contents.push(<div key='body' className='announcements2__body'>{item.get('body')}</div>);
if (item.get('icon')) {
contents.push(
<div key='icon' className='announcements2__icon'>
<img src={item.get('icon')} alt='' />
</div>
);
}

const href = item.get('href');

const classname = classnames({
'announcements2__item': true,
'announcements2__item--clickable': !!href,
});

if (!href) {
return (<div className={classname}>{contents}</div>);
} else if (href.startsWith('/web/')) {
return (<Link to={item.get('href').slice(4)} className={classname}>{contents}</Link>);
} else {
return (<a href={item.get('href')} target='_blank' className={classname}>{contents}</a>);
}
}

}

export default class Announcements extends React.PureComponent {

state = {
items: Announcements.cache || Immutable.Map(),
}

static isCacheControlled = false
static lastDate = null
static cache = null

constructor () {
super();
this.refresh();
}

componentWillUnmount() {
this.cancelPolling();
}

setPolling = () => {
this.timer = setTimeout(this.refresh, 2 * 60 * 1000);
}

cancelPolling = () => {
if (this.timer !== null) {
clearTimeout(this.timer);
this.timer = null;
}
}

deleteServiceWorkerCache = () => {
// files in /system/ will be cached by SW
if (self.caches) {
return caches.open('mastodon-system')
.then(cache => cache.delete(window.origin + '/system/announcements.json'))
.catch(() => {});
} else {
return Promise.resolve();
}
}

refresh = () => {
this.timer = null;

axios.get('/announcements.json', {
headers: {
'If-Modified-Since': !Announcements.isCacheControlled && Announcements.lastDate || '',
},
})
.then(resp => {
Announcements.isCacheControlled = !!resp.headers['cache-control'];
Announcements.lastDate = resp.headers['last-modified'];
return resp;
})
.then(resp => this.setState({ items: Announcements.cache = Immutable.fromJS(resp.data) || {} }))
.catch(err => err.response.status !== 304 && console.warn(err))
.then(this.deleteServiceWorkerCache)
.then(this.setPolling)
.catch(err => err && console.warn(err));
}

render() {
const { items } = this.state;

return (
<ul className='announcements2'>
{items.entrySeq().map(([key, item]) =>
(<li key={key}>
<Announcement item={item} />
</li>)
)}
</ul>
);
}

}
Expand Up @@ -157,13 +157,16 @@ class PollForm extends ImmutablePureComponent {
</ul>

<div className='poll__footer'>
<button disabled={options.size >= 4} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>
<button disabled={options.size >= 16} className='button button-secondary' onClick={this.handleAddOption}><Icon id='plus' /> <FormattedMessage {...messages.add_option} /></button>

{/* eslint-disable-next-line jsx-a11y/no-onchange */}
<select value={expiresIn} onChange={this.handleSelectDuration}>
<option value={60}>{intl.formatMessage(messages.minutes, { number: 1 })}</option>
<option value={300}>{intl.formatMessage(messages.minutes, { number: 5 })}</option>
<option value={600}>{intl.formatMessage(messages.minutes, { number: 10 })}</option>
<option value={1800}>{intl.formatMessage(messages.minutes, { number: 30 })}</option>
<option value={3600}>{intl.formatMessage(messages.hours, { number: 1 })}</option>
<option value={7200}>{intl.formatMessage(messages.hours, { number: 2 })}</option>
<option value={21600}>{intl.formatMessage(messages.hours, { number: 6 })}</option>
<option value={86400}>{intl.formatMessage(messages.days, { number: 1 })}</option>
<option value={259200}>{intl.formatMessage(messages.days, { number: 3 })}</option>
Expand Down
3 changes: 2 additions & 1 deletion app/javascript/mastodon/features/compose/index.js
Expand Up @@ -16,6 +16,7 @@ import { openModal } from 'mastodon/actions/modal';
import elephantUIPlane from '../../../images/elephant_ui_plane.svg';
import { mascot } from '../../initial_state';
import Icon from 'mastodon/components/icon';
import Announcements from './components/announcements';
import { logOut } from 'mastodon/utils/log_out';

const messages = defineMessages({
Expand Down Expand Up @@ -127,7 +128,7 @@ class Compose extends React.PureComponent {
<NavigationContainer onClose={this.onBlur} />

<ComposeFormContainer />

<Announcements />
<div className='drawer__inner__mastodon'>
<img alt='' draggable='false' src={mascot || elephantUIPlane} />
</div>
Expand Down
15 changes: 13 additions & 2 deletions app/javascript/mastodon/features/emoji/emoji.js
Expand Up @@ -23,9 +23,11 @@ const emojify = (str, customEmojis = {}) => {
const tagCharsWithoutEmojis = '<&';
const tagCharsWithEmojis = Object.keys(customEmojis).length ? '<&:' : '<&';
let rtn = '', tagChars = tagCharsWithEmojis, invisible = 0;
let contentNaturalFlag, contentEmojiFlag = false;
for (;;) {
let match, i = 0, tag;
while (i < str.length && (tag = tagChars.indexOf(str[i])) === -1 && (invisible || !(match = trie.search(str.slice(i))))) {
contentNaturalFlag = true;
i += str.codePointAt(i) < 65536 ? 1 : 2;
}
let rend, replacement = '';
Expand All @@ -42,7 +44,9 @@ const emojify = (str, customEmojis = {}) => {
// if you want additional emoji handler, add statements below which set replacement and return true.
if (shortname in customEmojis) {
const filename = autoPlayGif ? customEmojis[shortname].url : customEmojis[shortname].static_url;
replacement = `<img draggable="false" class="emojione custom-emoji" alt="${shortname}" title="${shortname}" src="${filename}" data-original="${customEmojis[shortname].url}" data-static="${customEmojis[shortname].static_url}" />`;
const classname = contentEmojiFlag ? 'emojione custom-emoji' : 'emojione handon-emojione-first custom-emoji';
contentEmojiFlag = true;
replacement = `<img draggable="false" class="${classname}" alt="${shortname}" title="${shortname}" src="${filename}" data-original="${customEmojis[shortname].url}" data-static="${customEmojis[shortname].static_url}" />`;
return true;
}
return false;
Expand Down Expand Up @@ -73,7 +77,9 @@ const emojify = (str, customEmojis = {}) => {
} else { // matched to unicode emoji
const { filename, shortCode } = unicodeMapping[match];
const title = shortCode ? `:${shortCode}:` : '';
replacement = `<img draggable="false" class="emojione" alt="${match}" title="${title}" src="${assetHost}/emoji/${emojiFilename(filename)}.svg" />`;
const classname = contentEmojiFlag ? 'emojione' : 'emojione handon-emojione-first';
contentEmojiFlag = true;
replacement = `<img draggable="false" class="${classname}" alt="${match}" title="${title}" src="${assetHost}/emoji/${emojiFilename(filename)}.svg" />`;
rend = i + match.length;
// If the matched character was followed by VS15 (for selecting text presentation), skip it.
if (str.codePointAt(rend) === 65038) {
Expand All @@ -83,6 +89,11 @@ const emojify = (str, customEmojis = {}) => {
rtn += str.slice(0, i) + replacement;
str = str.slice(rend);
}

//add stamp feature for emoji
if (!contentNaturalFlag) {
return '<span class="handon-emoji-only-content">' + rtn + str + '</span>';
}
return rtn + str;
};

Expand Down
Expand Up @@ -5,6 +5,7 @@ import SearchContainer from 'mastodon/features/compose/containers/search_contain
import ComposeFormContainer from 'mastodon/features/compose/containers/compose_form_container';
import NavigationContainer from 'mastodon/features/compose/containers/navigation_container';
import LinkFooter from './link_footer';
import Announcements from 'mastodon/features/compose/components/announcements';
import { changeComposing } from 'mastodon/actions/compose';

export default @connect()
Expand All @@ -28,6 +29,7 @@ class ComposePanel extends React.PureComponent {
<SearchContainer openInRoute />
<NavigationContainer onClose={this.onBlur} />
<ComposeFormContainer singleColumn />
<Announcements />
<LinkFooter withHotkeys />
</div>
);
Expand Down
3 changes: 3 additions & 0 deletions app/javascript/styles/application.scss
Expand Up @@ -26,3 +26,6 @@
@import 'mastodon/dashboard';
@import 'mastodon/rtl';
@import 'mastodon/accessibility';

@import 'mods/handon';
@import 'mods/announcements.scss'
5 changes: 5 additions & 0 deletions app/javascript/styles/contrast-instance-ticker-type12.scss
@@ -0,0 +1,5 @@
@import 'contrast/variables';
@import 'application';
@import 'contrast/diff';
@import 'mods/instance-ticker';
@import url("https://miy.pw/css/12.css");
3 changes: 3 additions & 0 deletions app/javascript/styles/mastodon-instance-ticker-type12.scss
@@ -0,0 +1,3 @@
@import 'application';
@import 'mods/instance-ticker';
@import url("https://miy.pw/css/12.css");
@@ -0,0 +1,5 @@
@import 'mastodon-light/variables';
@import 'application';
@import 'mastodon-light/diff';
@import 'mods/instance-ticker';
@import url("https://miy.pw/css/12.css");