@@ -54,4 +54,4 @@ const ComposerDrawer = React.createClass({
});
-export default ComposerDrawer;
+export default ComposeForm;
diff --git a/app/assets/javascripts/components/components/drawer.jsx b/app/assets/javascripts/components/components/drawer.jsx
new file mode 100644
index 0000000000..8e2201ebe2
--- /dev/null
+++ b/app/assets/javascripts/components/components/drawer.jsx
@@ -0,0 +1,17 @@
+import PureRenderMixin from 'react-addons-pure-render-mixin';
+
+const Drawer = React.createClass({
+
+ mixins: [PureRenderMixin],
+
+ render () {
+ return (
+
+ {this.props.children}
+
+ );
+ }
+
+});
+
+export default Drawer;
diff --git a/app/assets/javascripts/components/components/follow_form.jsx b/app/assets/javascripts/components/components/follow_form.jsx
new file mode 100644
index 0000000000..0563c511f1
--- /dev/null
+++ b/app/assets/javascripts/components/components/follow_form.jsx
@@ -0,0 +1,40 @@
+import IconButton from './icon_button';
+import PureRenderMixin from 'react-addons-pure-render-mixin';
+
+const FollowForm = React.createClass({
+
+ propTypes: {
+ text: React.PropTypes.string.isRequired,
+ is_submitting: React.PropTypes.bool,
+ onChange: React.PropTypes.func.isRequired,
+ onSubmit: React.PropTypes.func.isRequired
+ },
+
+ mixins: [PureRenderMixin],
+
+ handleChange (e) {
+ this.props.onChange(e.target.value);
+ },
+
+ handleKeyUp (e) {
+ if (e.keyCode === 13) {
+ this.props.onSubmit();
+ }
+ },
+
+ handleSubmit () {
+ this.props.onSubmit();
+ },
+
+ render () {
+ return (
+
+ );
+ }
+
+});
+
+export default FollowForm;
diff --git a/app/assets/javascripts/components/components/frontend.jsx b/app/assets/javascripts/components/components/frontend.jsx
index 90ad02dd5f..3532b66743 100644
--- a/app/assets/javascripts/components/components/frontend.jsx
+++ b/app/assets/javascripts/components/components/frontend.jsx
@@ -1,6 +1,8 @@
-import ColumnsArea from './columns_area';
-import ComposerDrawerContainer from '../containers/composer_drawer_container';
-import PureRenderMixin from 'react-addons-pure-render-mixin';
+import ColumnsArea from './columns_area';
+import Drawer from './drawer';
+import ComposeFormContainer from '../containers/compose_form_container';
+import FollowFormContainer from '../containers/follow_form_container';
+import PureRenderMixin from 'react-addons-pure-render-mixin';
const Frontend = React.createClass({
@@ -9,7 +11,14 @@ const Frontend = React.createClass({
render () {
return (
);
diff --git a/app/assets/javascripts/components/containers/composer_drawer_container.jsx b/app/assets/javascripts/components/containers/compose_form_container.jsx
similarity index 87%
rename from app/assets/javascripts/components/containers/composer_drawer_container.jsx
rename to app/assets/javascripts/components/containers/compose_form_container.jsx
index e9cef99b26..534830c278 100644
--- a/app/assets/javascripts/components/containers/composer_drawer_container.jsx
+++ b/app/assets/javascripts/components/containers/compose_form_container.jsx
@@ -1,5 +1,5 @@
import { connect } from 'react-redux';
-import ComposerDrawer from '../components/composer_drawer';
+import ComposeForm from '../components/compose_form';
import { changeCompose, submitCompose, cancelReplyCompose } from '../actions/compose';
const mapStateToProps = function (state, props) {
@@ -26,4 +26,4 @@ const mapDispatchToProps = function (dispatch) {
}
};
-export default connect(mapStateToProps, mapDispatchToProps)(ComposerDrawer);
+export default connect(mapStateToProps, mapDispatchToProps)(ComposeForm);
diff --git a/app/assets/javascripts/components/containers/follow_form_container.jsx b/app/assets/javascripts/components/containers/follow_form_container.jsx
new file mode 100644
index 0000000000..b5f787aba9
--- /dev/null
+++ b/app/assets/javascripts/components/containers/follow_form_container.jsx
@@ -0,0 +1,24 @@
+import { connect } from 'react-redux';
+import FollowForm from '../components/follow_form';
+import { changeFollow, submitFollow } from '../actions/follow';
+
+const mapStateToProps = function (state, props) {
+ return {
+ text: state.getIn(['follow', 'text']),
+ is_submitting: state.getIn(['follow', 'is_submitting'])
+ };
+};
+
+const mapDispatchToProps = function (dispatch) {
+ return {
+ onChange: function (text) {
+ dispatch(changeFollow(text));
+ },
+
+ onSubmit: function () {
+ dispatch(submitFollow());
+ }
+ }
+};
+
+export default connect(mapStateToProps, mapDispatchToProps)(FollowForm);
diff --git a/app/assets/javascripts/components/reducers/timelines.jsx b/app/assets/javascripts/components/reducers/timelines.jsx
index 983518df7a..616411186b 100644
--- a/app/assets/javascripts/components/reducers/timelines.jsx
+++ b/app/assets/javascripts/components/reducers/timelines.jsx
@@ -9,6 +9,8 @@ function updateMatchingStatuses(state, needle, callback) {
return list.map(function (status) {
if (status.get('id') === needle.get('id')) {
return callback(status);
+ } else if (status.getIn(['reblog', 'id'], null) === needle.get('id')) {
+ return status.set('reblog', callback(status.get('reblog')));
}
return status;
diff --git a/app/assets/stylesheets/components.scss b/app/assets/stylesheets/components.scss
index f17160161f..39b5711832 100644
--- a/app/assets/stylesheets/components.scss
+++ b/app/assets/stylesheets/components.scss
@@ -28,7 +28,7 @@
}
}
-.compose-drawer__textarea {
+.compose-form__textarea, .follow-form__input {
background: #fff;
&:disabled {
diff --git a/app/models/account.rb b/app/models/account.rb
index 8b6300e355..af8b6cc3d4 100644
--- a/app/models/account.rb
+++ b/app/models/account.rb
@@ -59,11 +59,11 @@ class Account < ApplicationRecord
end
def favourited?(status)
- (status.reblog? ? status.reblog : status).favourites.where(account: self).count == 1
+ (status.reblog? ? status.reblog : status).favourites.where(account: self).count > 0
end
def reblogged?(status)
- (status.reblog? ? status.reblog : status).reblogs.where(account: self).count == 1
+ (status.reblog? ? status.reblog : status).reblogs.where(account: self).count > 0
end
def keypair