This commit is contained in:
		@@ -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() {
 | 
			
		||||
  return (dispatch, getState) => {
 | 
			
		||||
    dispatch(refreshNotificationsRequest());
 | 
			
		||||
@@ -61,7 +63,7 @@ export function refreshNotifications() {
 | 
			
		||||
      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 => {
 | 
			
		||||
      const next = getLinks(response).refs.find(link => link.rel === 'next');
 | 
			
		||||
@@ -109,7 +111,7 @@ export function expandNotifications() {
 | 
			
		||||
 | 
			
		||||
    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 => {
 | 
			
		||||
      const next = getLinks(response).refs.find(link => link.rel === 'next');
 | 
			
		||||
 
 | 
			
		||||
@@ -1,5 +1,5 @@
 | 
			
		||||
import axios from 'axios';
 | 
			
		||||
import LinkHeader from 'http-link-header';
 | 
			
		||||
import LinkHeader from './link_header';
 | 
			
		||||
 | 
			
		||||
export const getLinks = response => {
 | 
			
		||||
  const value = response.headers.link;
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ const Account = React.createClass({
 | 
			
		||||
      <div className='account'>
 | 
			
		||||
        <div style={{ display: 'flex' }}>
 | 
			
		||||
          <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} />
 | 
			
		||||
          </Permalink>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -4,7 +4,7 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
 | 
			
		||||
 | 
			
		||||
const AutosuggestAccount = ({ 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} />
 | 
			
		||||
  </div>
 | 
			
		||||
);
 | 
			
		||||
 
 | 
			
		||||
@@ -33,7 +33,7 @@ const AccountAuthorize = ({ intl, account, onAuthorize, onReject }) => {
 | 
			
		||||
    <div>
 | 
			
		||||
      <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' }}>
 | 
			
		||||
          <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} />
 | 
			
		||||
        </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} />;
 | 
			
		||||
 | 
			
		||||
    switch(notification.get('type')) {
 | 
			
		||||
      case 'follow':
 | 
			
		||||
        return this.renderFollow(account, link);
 | 
			
		||||
      case 'mention':
 | 
			
		||||
        return this.renderMention(notification);
 | 
			
		||||
      case 'favourite':
 | 
			
		||||
        return this.renderFavourite(notification, link);
 | 
			
		||||
      case 'reblog':
 | 
			
		||||
        return this.renderReblog(notification, link);
 | 
			
		||||
    case 'follow':
 | 
			
		||||
      return this.renderFollow(account, link);
 | 
			
		||||
    case 'mention':
 | 
			
		||||
      return this.renderMention(notification);
 | 
			
		||||
    case 'favourite':
 | 
			
		||||
      return this.renderFavourite(notification, link);
 | 
			
		||||
    case 'reblog':
 | 
			
		||||
      return this.renderReblog(notification, link);
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										33
									
								
								app/assets/javascripts/components/link_header.jsx
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								app/assets/javascripts/components/link_header.jsx
									
									
									
									
									
										Normal file
									
								
							@@ -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;
 | 
			
		||||
		Reference in New Issue
	
	Block a user