lolsob-rspec
parent
1d9d518fd4
commit
5122f9ab3b
|
@ -50,6 +50,8 @@ export function updateNotifications(notification, intlMessages, intlLocale) {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const excludeTypesFromSettings = state => state.getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
|
||||||
|
|
||||||
export function refreshNotifications() {
|
export function refreshNotifications() {
|
||||||
return (dispatch, getState) => {
|
return (dispatch, getState) => {
|
||||||
dispatch(refreshNotificationsRequest());
|
dispatch(refreshNotificationsRequest());
|
||||||
|
@ -61,7 +63,7 @@ export function refreshNotifications() {
|
||||||
params.since_id = ids.first().get('id');
|
params.since_id = ids.first().get('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
params.exclude_types = getState().getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
|
params.exclude_types = excludeTypesFromSettings(getState());
|
||||||
|
|
||||||
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
api(getState).get('/api/v1/notifications', { params }).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
@ -109,7 +111,7 @@ export function expandNotifications() {
|
||||||
|
|
||||||
const params = {};
|
const params = {};
|
||||||
|
|
||||||
params.exclude_types = getState().getIn(['settings', 'notifications', 'shows']).filter(enabled => !enabled).keySeq().toJS();
|
params.exclude_types = excludeTypesFromSettings(getState());
|
||||||
|
|
||||||
api(getState).get(url, params).then(response => {
|
api(getState).get(url, params).then(response => {
|
||||||
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
const next = getLinks(response).refs.find(link => link.rel === 'next');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
import LinkHeader from 'http-link-header';
|
import LinkHeader from './link_header';
|
||||||
|
|
||||||
export const getLinks = response => {
|
export const getLinks = response => {
|
||||||
const value = response.headers.link;
|
const value = response.headers.link;
|
||||||
|
|
|
@ -65,7 +65,7 @@ const Account = React.createClass({
|
||||||
<div className='account'>
|
<div className='account'>
|
||||||
<div style={{ display: 'flex' }}>
|
<div style={{ display: 'flex' }}>
|
||||||
<Permalink key={account.get('id')} className='account__display-name' href={account.get('url')} to={`/accounts/${account.get('id')}`}>
|
<Permalink key={account.get('id')} className='account__display-name' href={account.get('url')} to={`/accounts/${account.get('id')}`}>
|
||||||
<div style={{ float: 'left', marginLeft: '12px', marginRight: '10px' }}><Avatar src={account.get('avatar')} staticSrc={status.getIn(['account', 'avatar_static'])} size={36} /></div>
|
<div style={{ float: 'left', marginLeft: '12px', marginRight: '10px' }}><Avatar src={account.get('avatar')} staticSrc={account.get('avatar_static')} size={36} /></div>
|
||||||
<DisplayName account={account} />
|
<DisplayName account={account} />
|
||||||
</Permalink>
|
</Permalink>
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||||
|
|
||||||
const AutosuggestAccount = ({ account }) => (
|
const AutosuggestAccount = ({ account }) => (
|
||||||
<div style={{ overflow: 'hidden' }} className='autosuggest-account'>
|
<div style={{ overflow: 'hidden' }} className='autosuggest-account'>
|
||||||
<div style={{ float: 'left', marginRight: '5px' }}><Avatar src={account.get('avatar')} staticSrc={status.getIn(['account', 'avatar_static'])} size={18} /></div>
|
<div style={{ float: 'left', marginRight: '5px' }}><Avatar src={account.get('avatar')} staticSrc={account.get('avatar_static')} size={18} /></div>
|
||||||
<DisplayName account={account} />
|
<DisplayName account={account} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
|
@ -33,7 +33,7 @@ const AccountAuthorize = ({ intl, account, onAuthorize, onReject }) => {
|
||||||
<div>
|
<div>
|
||||||
<div style={outerStyle}>
|
<div style={outerStyle}>
|
||||||
<Permalink href={account.get('url')} to={`/accounts/${account.get('id')}`} className='detailed-status__display-name' style={{ display: 'block', overflow: 'hidden', marginBottom: '15px' }}>
|
<Permalink href={account.get('url')} to={`/accounts/${account.get('id')}`} className='detailed-status__display-name' style={{ display: 'block', overflow: 'hidden', marginBottom: '15px' }}>
|
||||||
<div style={{ float: 'left', marginRight: '10px' }}><Avatar src={account.get('avatar')} staticSrc={status.getIn(['account', 'avatar_static'])} size={48} /></div>
|
<div style={{ float: 'left', marginRight: '10px' }}><Avatar src={account.get('avatar')} staticSrc={account.get('avatar_static')} size={48} /></div>
|
||||||
<DisplayName account={account} />
|
<DisplayName account={account} />
|
||||||
</Permalink>
|
</Permalink>
|
||||||
|
|
||||||
|
|
|
@ -79,14 +79,14 @@ const Notification = React.createClass({
|
||||||
const link = <Permalink className='notification__display-name' style={linkStyle} href={account.get('url')} title={account.get('acct')} to={`/accounts/${account.get('id')}`} dangerouslySetInnerHTML={displayNameHTML} />;
|
const link = <Permalink className='notification__display-name' style={linkStyle} href={account.get('url')} title={account.get('acct')} to={`/accounts/${account.get('id')}`} dangerouslySetInnerHTML={displayNameHTML} />;
|
||||||
|
|
||||||
switch(notification.get('type')) {
|
switch(notification.get('type')) {
|
||||||
case 'follow':
|
case 'follow':
|
||||||
return this.renderFollow(account, link);
|
return this.renderFollow(account, link);
|
||||||
case 'mention':
|
case 'mention':
|
||||||
return this.renderMention(notification);
|
return this.renderMention(notification);
|
||||||
case 'favourite':
|
case 'favourite':
|
||||||
return this.renderFavourite(notification, link);
|
return this.renderFavourite(notification, link);
|
||||||
case 'reblog':
|
case 'reblog':
|
||||||
return this.renderReblog(notification, link);
|
return this.renderReblog(notification, link);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,33 @@
|
||||||
|
import Link from 'http-link-header';
|
||||||
|
import querystring from 'querystring';
|
||||||
|
|
||||||
|
Link.parseAttrs = (link, parts) => {
|
||||||
|
let match = null
|
||||||
|
let attr = ''
|
||||||
|
let value = ''
|
||||||
|
let attrs = ''
|
||||||
|
|
||||||
|
let uriAttrs = /<(.*)>;\s*(.*)/gi.exec(parts)
|
||||||
|
|
||||||
|
if(uriAttrs) {
|
||||||
|
attrs = uriAttrs[2]
|
||||||
|
link = Link.parseParams(link, uriAttrs[1])
|
||||||
|
}
|
||||||
|
|
||||||
|
while(match = Link.attrPattern.exec(attrs)) {
|
||||||
|
attr = match[1].toLowerCase()
|
||||||
|
value = match[4] || match[3] || match[2]
|
||||||
|
|
||||||
|
if( /\*$/.test(attr)) {
|
||||||
|
Link.setAttr(link, attr, Link.parseExtendedValue(value))
|
||||||
|
} else if(/%/.test(value)) {
|
||||||
|
Link.setAttr(link, attr, querystring.decode(value))
|
||||||
|
} else {
|
||||||
|
Link.setAttr(link, attr, value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return link
|
||||||
|
};
|
||||||
|
|
||||||
|
export default Link;
|
|
@ -30,7 +30,7 @@
|
||||||
"escape-html": "^1.0.3",
|
"escape-html": "^1.0.3",
|
||||||
"eventsource": "^0.2.1",
|
"eventsource": "^0.2.1",
|
||||||
"express": "^4.14.1",
|
"express": "^4.14.1",
|
||||||
"http-link-header": "^0.5.0",
|
"http-link-header": "^0.8.0",
|
||||||
"immutable": "^3.8.1",
|
"immutable": "^3.8.1",
|
||||||
"intl": "^1.2.5",
|
"intl": "^1.2.5",
|
||||||
"jsdom": "^9.11.0",
|
"jsdom": "^9.11.0",
|
||||||
|
|
79
yarn.lock
79
yarn.lock
|
@ -1281,7 +1281,7 @@ babel-template@^6.3.0:
|
||||||
babylon "^6.11.0"
|
babylon "^6.11.0"
|
||||||
lodash "^4.2.0"
|
lodash "^4.2.0"
|
||||||
|
|
||||||
babel-traverse@^6.16.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-traverse@^6.23.1:
|
babel-traverse@^6.16.0, babel-traverse@^6.22.0, babel-traverse@^6.22.1, babel-traverse@^6.23.0, babel-traverse@^6.23.1:
|
||||||
version "6.23.1"
|
version "6.23.1"
|
||||||
resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48"
|
resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.23.1.tgz#d3cb59010ecd06a97d81310065f966b699e14f48"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -1295,30 +1295,7 @@ babel-traverse@^6.16.0, babel-traverse@^6.22.0, babel-traverse@^6.23.0, babel-tr
|
||||||
invariant "^2.2.0"
|
invariant "^2.2.0"
|
||||||
lodash "^4.2.0"
|
lodash "^4.2.0"
|
||||||
|
|
||||||
babel-traverse@^6.22.1:
|
babel-types@^6.16.0, babel-types@^6.19.0, babel-types@^6.22.0, babel-types@^6.23.0, babel-types@^6.9.0:
|
||||||
version "6.22.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/babel-traverse/-/babel-traverse-6.22.1.tgz#3b95cd6b7427d6f1f757704908f2fc9748a5f59f"
|
|
||||||
dependencies:
|
|
||||||
babel-code-frame "^6.22.0"
|
|
||||||
babel-messages "^6.22.0"
|
|
||||||
babel-runtime "^6.22.0"
|
|
||||||
babel-types "^6.22.0"
|
|
||||||
babylon "^6.15.0"
|
|
||||||
debug "^2.2.0"
|
|
||||||
globals "^9.0.0"
|
|
||||||
invariant "^2.2.0"
|
|
||||||
lodash "^4.2.0"
|
|
||||||
|
|
||||||
babel-types@^6.16.0, babel-types@^6.22.0:
|
|
||||||
version "6.22.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.22.0.tgz#2a447e8d0ea25d2512409e4175479fd78cc8b1db"
|
|
||||||
dependencies:
|
|
||||||
babel-runtime "^6.22.0"
|
|
||||||
esutils "^2.0.2"
|
|
||||||
lodash "^4.2.0"
|
|
||||||
to-fast-properties "^1.0.1"
|
|
||||||
|
|
||||||
babel-types@^6.19.0, babel-types@^6.23.0, babel-types@^6.9.0:
|
|
||||||
version "6.23.0"
|
version "6.23.0"
|
||||||
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf"
|
resolved "https://registry.yarnpkg.com/babel-types/-/babel-types-6.23.0.tgz#bb17179d7538bad38cd0c9e115d340f77e7e9acf"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -1334,15 +1311,7 @@ babelify@^7.3.0:
|
||||||
babel-core "^6.0.14"
|
babel-core "^6.0.14"
|
||||||
object-assign "^4.0.0"
|
object-assign "^4.0.0"
|
||||||
|
|
||||||
babylon@^6.11.0:
|
babylon@^6.11.0, babylon@^6.15.0, babylon@^6.16.1:
|
||||||
version "6.11.4"
|
|
||||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.11.4.tgz#75e1f52187efa0cde5a541a7f7fdda38f6eb5bd2"
|
|
||||||
|
|
||||||
babylon@^6.15.0:
|
|
||||||
version "6.15.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.15.0.tgz#ba65cfa1a80e1759b0e89fb562e27dccae70348e"
|
|
||||||
|
|
||||||
babylon@^6.16.1:
|
|
||||||
version "6.16.1"
|
version "6.16.1"
|
||||||
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3"
|
resolved "https://registry.yarnpkg.com/babylon/-/babylon-6.16.1.tgz#30c5a22f481978a9e7f8cdfdf496b11d94b404d3"
|
||||||
|
|
||||||
|
@ -2159,12 +2128,6 @@ d@1:
|
||||||
dependencies:
|
dependencies:
|
||||||
es5-ext "^0.10.9"
|
es5-ext "^0.10.9"
|
||||||
|
|
||||||
d@^0.1.1, d@~0.1.1:
|
|
||||||
version "0.1.1"
|
|
||||||
resolved "https://registry.yarnpkg.com/d/-/d-0.1.1.tgz#da184c535d18d8ee7ba2aa229b914009fae11309"
|
|
||||||
dependencies:
|
|
||||||
es5-ext "~0.10.2"
|
|
||||||
|
|
||||||
dashdash@^1.12.0:
|
dashdash@^1.12.0:
|
||||||
version "1.14.0"
|
version "1.14.0"
|
||||||
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.0.tgz#29e486c5418bf0f356034a993d51686a33e84141"
|
resolved "https://registry.yarnpkg.com/dashdash/-/dashdash-1.14.0.tgz#29e486c5418bf0f356034a993d51686a33e84141"
|
||||||
|
@ -2461,7 +2424,7 @@ error-ex@^1.2.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
is-arrayish "^0.2.1"
|
is-arrayish "^0.2.1"
|
||||||
|
|
||||||
es-abstract@^1.3.2, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1:
|
es-abstract@^1.3.2:
|
||||||
version "1.6.1"
|
version "1.6.1"
|
||||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.6.1.tgz#bb8a2064120abcf928a086ea3d9043114285ec99"
|
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.6.1.tgz#bb8a2064120abcf928a086ea3d9043114285ec99"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -2470,7 +2433,7 @@ es-abstract@^1.3.2, es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1:
|
||||||
is-callable "^1.1.3"
|
is-callable "^1.1.3"
|
||||||
is-regex "^1.0.3"
|
is-regex "^1.0.3"
|
||||||
|
|
||||||
es-abstract@^1.7.0:
|
es-abstract@^1.4.3, es-abstract@^1.5.0, es-abstract@^1.5.1, es-abstract@^1.7.0:
|
||||||
version "1.7.0"
|
version "1.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c"
|
resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.7.0.tgz#dfade774e01bfcd97f96180298c449c8623fb94c"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -2494,26 +2457,11 @@ es5-ext@^0.10.14, es5-ext@^0.10.9, es5-ext@~0.10.14:
|
||||||
es6-iterator "2"
|
es6-iterator "2"
|
||||||
es6-symbol "~3.1"
|
es6-symbol "~3.1"
|
||||||
|
|
||||||
es5-ext@^0.10.7, es5-ext@~0.10.11, es5-ext@~0.10.2:
|
|
||||||
version "0.10.12"
|
|
||||||
resolved "https://registry.yarnpkg.com/es5-ext/-/es5-ext-0.10.12.tgz#aa84641d4db76b62abba5e45fd805ecbab140047"
|
|
||||||
dependencies:
|
|
||||||
es6-iterator "2"
|
|
||||||
es6-symbol "~3.1"
|
|
||||||
|
|
||||||
es5-shim@^4.5.9:
|
es5-shim@^4.5.9:
|
||||||
version "4.5.9"
|
version "4.5.9"
|
||||||
resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.5.9.tgz#2a1e2b9e583ff5fed0c20a3ee2cbf3f75230a5c0"
|
resolved "https://registry.yarnpkg.com/es5-shim/-/es5-shim-4.5.9.tgz#2a1e2b9e583ff5fed0c20a3ee2cbf3f75230a5c0"
|
||||||
|
|
||||||
es6-iterator@2:
|
es6-iterator@2, es6-iterator@^2.0.1, es6-iterator@~2.0.1:
|
||||||
version "2.0.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.0.tgz#bd968567d61635e33c0b80727613c9cb4b096bac"
|
|
||||||
dependencies:
|
|
||||||
d "^0.1.1"
|
|
||||||
es5-ext "^0.10.7"
|
|
||||||
es6-symbol "3"
|
|
||||||
|
|
||||||
es6-iterator@^2.0.1, es6-iterator@~2.0.1:
|
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512"
|
resolved "https://registry.yarnpkg.com/es6-iterator/-/es6-iterator-2.0.1.tgz#8e319c9f0453bf575d374940a655920e59ca5512"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -2550,14 +2498,7 @@ es6-shim@^0.35.1:
|
||||||
version "0.35.1"
|
version "0.35.1"
|
||||||
resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.1.tgz#a23524009005b031ab4a352ac196dfdfd1144ab7"
|
resolved "https://registry.yarnpkg.com/es6-shim/-/es6-shim-0.35.1.tgz#a23524009005b031ab4a352ac196dfdfd1144ab7"
|
||||||
|
|
||||||
es6-symbol@3, es6-symbol@^3.0.2, es6-symbol@~3.1:
|
es6-symbol@3.1.1, es6-symbol@^3.0.2, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1, es6-symbol@~3.1.1:
|
||||||
version "3.1.0"
|
|
||||||
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.0.tgz#94481c655e7a7cad82eba832d97d5433496d7ffa"
|
|
||||||
dependencies:
|
|
||||||
d "~0.1.1"
|
|
||||||
es5-ext "~0.10.11"
|
|
||||||
|
|
||||||
es6-symbol@3.1.1, es6-symbol@^3.1, es6-symbol@^3.1.1, es6-symbol@~3.1.1:
|
|
||||||
version "3.1.1"
|
version "3.1.1"
|
||||||
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
|
resolved "https://registry.yarnpkg.com/es6-symbol/-/es6-symbol-3.1.1.tgz#bf00ef4fdab6ba1b46ecb7b629b4c7ed5715cc77"
|
||||||
dependencies:
|
dependencies:
|
||||||
|
@ -3244,9 +3185,9 @@ http-errors@~1.5.1:
|
||||||
setprototypeof "1.0.2"
|
setprototypeof "1.0.2"
|
||||||
statuses ">= 1.3.1 < 2"
|
statuses ">= 1.3.1 < 2"
|
||||||
|
|
||||||
http-link-header@^0.5.0:
|
http-link-header@^0.8.0:
|
||||||
version "0.5.0"
|
version "0.8.0"
|
||||||
resolved "https://registry.yarnpkg.com/http-link-header/-/http-link-header-0.5.0.tgz#68598d92c55d3dac7d3e6ae405142fecf7bd3303"
|
resolved "https://registry.yarnpkg.com/http-link-header/-/http-link-header-0.8.0.tgz#a22b41a0c9b1e2d8fac1bf1b697c6bd532d5f5e4"
|
||||||
|
|
||||||
http-signature@~1.1.0:
|
http-signature@~1.1.0:
|
||||||
version "1.1.1"
|
version "1.1.1"
|
||||||
|
|
Loading…
Reference in New Issue