Skip to content

Commit

Permalink
Merge pull request #594 from CPSSD/a/fixroguefollowbutton
Browse files Browse the repository at this point in the history
Fix a few random small bugs
  • Loading branch information
Aaron Delaney authored Apr 17, 2019
2 parents 4bda091 + 67dd10a commit f0cf0f7
Show file tree
Hide file tree
Showing 9 changed files with 33 additions and 15 deletions.
13 changes: 12 additions & 1 deletion chump/rabble_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,16 @@
"denied_follow": "Follow denied",
"read_more_text": "Read more",
"reblog_success": "Post reblogged",
"incorrect_credentials": "Incorrect credentials"
"incorrect_credentials": "Incorrect credentials",
"profile": "Profile",
"follow_nav": "Follow",
"like": "Like",
"unlike": "Unlike",
"reblog": "Reblog",
"reblogged": "Reblogged",
"add_tag": "Add a tag",
"blank_fields": "Blank fields are left unchanged",
"current_password": "Enter your current password",
"custom_css": "Custom CSS",
"edit": "Edit"
}
6 changes: 3 additions & 3 deletions chump/src/components/account_edit.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ export class AccountEdit extends RootComponent<IAccountEditProps, IAccountEditSt
onSubmit={this.handleUpdate}
>
<fieldset>
<legend>Blank fields are left unchanged</legend>
<legend>{config.blank_fields}</legend>
<div className="pure-control-group">
<label htmlFor="newPassword">{config.new_password}</label>
<input
Expand Down Expand Up @@ -170,7 +170,7 @@ export class AccountEdit extends RootComponent<IAccountEditProps, IAccountEditSt
/>
</div>
<div className="pure-control-group">
<label htmlFor="name">{"Custom CSS"}</label>
<label htmlFor="name">{config.custom_css}</label>
<textarea
id="custom_css"
placeholder=".article-title { color: red }"
Expand All @@ -191,7 +191,7 @@ export class AccountEdit extends RootComponent<IAccountEditProps, IAccountEditSt
/>
</div>

<legend>Enter your current user account</legend>
<legend>{config.current_password}</legend>
<div className="pure-control-group">
<label htmlFor="name">{config.password}</label>
<input
Expand Down
1 change: 1 addition & 0 deletions chump/src/components/create_article_form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ export class CreateArticleForm extends RootComponent<IFormProps, IFormState> {
onChange={this.handleTagInputChange}
onlyUnique={true}
maxTags={7}
inputProps={{ className: "react-tagsinput-input", placeholder: config.add_tag }}
/>
<textarea
name="blogText"
Expand Down
2 changes: 1 addition & 1 deletion chump/src/components/edit_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class EditButton extends RootComponent<IEditProps, IEditState> {
className="pure-button pure-input-1-3 pure-button-primary primary-button"
onClick={this.handleEdit}
>
<Edit/> Edit
<Edit/> {config.edit}
</button>
</div>
);
Expand Down
10 changes: 7 additions & 3 deletions chump/src/components/follow_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,13 @@ export class FollowButton extends RootComponent<IFormProps, IFormState> {
}

public render() {
const sameUser = (this.props.follower === this.props.followed &&
this.props.followed_host === "");
if (this.props.follower === "" || sameUser) {
const noFollower = (typeof this.props.follower === "undefined" ||
this.props.follower === "");

const noHost = (typeof this.props.followed_host === "undefined" ||
this.props.followed_host === "");

if (noFollower || (this.props.follower === this.props.followed && noHost)) {
return null;
}
return (
Expand Down
4 changes: 2 additions & 2 deletions chump/src/components/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
</li>
<li className="pure-menu-item">
<Link to="/follow" className="pure-menu-link nav-action">
<UserPlus size="1em"/> {config.follow_text}
<UserPlus size="1em"/> {config.follow_nav}
</Link>
</li>
</ul>
Expand Down Expand Up @@ -173,7 +173,7 @@ class Header extends React.Component<IHeaderProps, IHeaderState> {
<ul id="dropdown" className="menu-dropdown pure-menu-children" style={{display: this.state.display}}>
<li className="pure-menu-item">
<Link to={`/@${this.props.username}`} className="pure-menu-link" onClick={this.resetDropdown}>
Profile
{config.profile}
</Link>
</li>
<li className="pure-menu-item">
Expand Down
4 changes: 2 additions & 2 deletions chump/src/components/like_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export class LikeButton extends RootComponent<ILikeButtonProps, ILikeButtonState
className="pure-button pure-input-1-3 pure-button-primary primary-button"
onClick={this.handleClick}
>
{this.state.likesCount} <ThumbsUp/> Like
{this.state.likesCount} <ThumbsUp/> {config.like}
</button>
);
}
Expand All @@ -61,7 +61,7 @@ export class LikeButton extends RootComponent<ILikeButtonProps, ILikeButtonState
className="pure-button pure-input-1-3 pure-button-primary primary-button"
onClick={this.handleClick}
>
{this.state.likesCount} <ThumbsUp/> Unlike
{this.state.likesCount} <ThumbsUp/> {config.unlike}
</button>
);
}
Expand Down
4 changes: 2 additions & 2 deletions chump/src/components/reblog_button.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export class Reblog extends RootComponent<IReblogProps, IReblogState> {
type="submit"
className="pure-button pure-button-primary primary-button"
>
{this.state.sharesCount} <Repeat size="1em"/> Reblog
{this.state.sharesCount} <Repeat size="1em"/> {config.reblog}
</button>
);
}
Expand All @@ -75,7 +75,7 @@ export class Reblog extends RootComponent<IReblogProps, IReblogState> {
className="pure-button pure-button-primary primary-button"
disabled={true}
>
{this.state.sharesCount} <Repeat size="1em"/> | Reblogged
{this.state.sharesCount} <Repeat size="1em"/> | {config.reblogged}
</button>
);
}
Expand Down
4 changes: 3 additions & 1 deletion services/utils/users.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ def parse_actor_details(self, actor_uri):
self._logger.warning(f'No actor doc found for user {actor_uri}.')
return None, None, None
handle = actor_doc['preferredUsername']
summary = actor_doc['summary']
summary = ""
if 'summary' in actor_doc:
summary = actor_doc['summary']
host = self._activ_util.normalise_hostname(urlparse(actor_uri).netloc)
return host, handle, summary

Expand Down

0 comments on commit f0cf0f7

Please sign in to comment.