From 238233440f8fc820301086d2716f8a93e02e28e3 Mon Sep 17 00:00:00 2001 From: Eugen Rochko Date: Thu, 22 Dec 2016 23:03:57 +0100 Subject: [PATCH] Follow call on locked account creates follow request instead Reflect "requested" relationship in API and UI Reflect inability of private posts to be reblogged in the UI Disable Webfinger for locked accounts --- .../components/components/icon_button.jsx | 17 ++++++----- .../components/status_action_bar.jsx | 2 +- .../features/account/components/header.jsx | 19 ++++++++---- .../features/status/components/action_bar.jsx | 2 +- app/assets/stylesheets/components.scss | 3 +- app/assets/stylesheets/forms.scss | 10 +++++++ app/controllers/api/v1/accounts_controller.rb | 3 ++ app/controllers/stream_entries_controller.rb | 4 ++- app/controllers/xrd_controller.rb | 2 +- app/lib/feed_manager.rb | 10 +++++++ app/models/account.rb | 6 ++++ app/models/follow_request.rb | 19 ++++++++++++ app/models/status.rb | 2 +- app/services/follow_service.rb | 29 ++++++++++--------- app/services/reblog_service.rb | 2 +- app/views/api/v1/accounts/relationship.rabl | 1 + app/views/api/v1/accounts/show.rabl | 6 ++-- app/views/settings/profiles/show.html.haml | 12 ++++---- config/initializers/simple_form.rb | 8 ++--- config/locales/simple_form.en.yml | 4 +++ .../20161222204147_create_follow_requests.rb | 12 ++++++++ db/schema.rb | 10 ++++++- spec/fabricators/follow_request_fabricator.rb | 3 ++ spec/models/follow_request_spec.rb | 6 ++++ 24 files changed, 145 insertions(+), 47 deletions(-) create mode 100644 app/models/follow_request.rb create mode 100644 db/migrate/20161222204147_create_follow_requests.rb create mode 100644 spec/fabricators/follow_request_fabricator.rb create mode 100644 spec/models/follow_request_spec.rb diff --git a/app/assets/javascripts/components/components/icon_button.jsx b/app/assets/javascripts/components/components/icon_button.jsx index d8f00f5d8b..e9a7228e4d 100644 --- a/app/assets/javascripts/components/components/icon_button.jsx +++ b/app/assets/javascripts/components/components/icon_button.jsx @@ -5,17 +5,19 @@ const IconButton = React.createClass({ propTypes: { title: React.PropTypes.string.isRequired, icon: React.PropTypes.string.isRequired, - onClick: React.PropTypes.func.isRequired, + onClick: React.PropTypes.func, size: React.PropTypes.number, active: React.PropTypes.bool, style: React.PropTypes.object, - activeStyle: React.PropTypes.object + activeStyle: React.PropTypes.object, + disabled: React.PropTypes.bool }, getDefaultProps () { return { size: 18, - active: false + active: false, + disabled: false }; }, @@ -23,8 +25,10 @@ const IconButton = React.createClass({ handleClick (e) { e.preventDefault(); - this.props.onClick(); - e.stopPropagation(); + + if (!this.props.disabled) { + this.props.onClick(); + } }, render () { @@ -37,7 +41,6 @@ const IconButton = React.createClass({ width: `${this.props.size * 1.28571429}px`, height: `${this.props.size}px`, lineHeight: `${this.props.size}px`, - cursor: 'pointer', ...this.props.style }; @@ -46,7 +49,7 @@ const IconButton = React.createClass({ } return ( -