Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/unlisted posts privacy #138

Merged
merged 3 commits into from
Apr 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions app/views/layouts/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,12 @@
</script>
<!-- End Piwik Code -->

<script type="text/javascript">
if("<%= ENV["RAILS_ENV"] %>" !== "development" && typeof window.__REACT_DEVTOOLS_GLOBAL_HOOK__ === "object") {
window.__REACT_DEVTOOLS_GLOBAL_HOOK__.inject = function () {}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This disables the React Dev Tools on any environment that is not "development" facebook/react-devtools#191 (comment)

}
</script>

</head>

<body>
Expand Down
3 changes: 2 additions & 1 deletion app/views/shared/_footer.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@
blogPage: @blog_page,
author: (@display_author || @author || @post && @post.author).as_json(
only: :display_name
)
),
privatePost: @post && @post.unlisted
}) %>
1 change: 1 addition & 0 deletions client/app/components/authors/HeaderContainer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ const HeaderContainer = ({
pages={pages}
authorGuestbookEntriesUrl={authorGuestbookEntriesUrl}
currentUrl={currentUrl}
privatePost={privatePost}
/>
);

Expand Down
6 changes: 4 additions & 2 deletions client/app/components/shared/Footer.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import PropTypes from "prop-types";
import React from "react";
import "./Footer.scss";

const Footer = ({ blogPage, author }) => (
const Footer = ({ blogPage, author, privatePost }) => (
<div id="footer" className={blogPage ? "footer--blog-page" : ""}>
<div className="footer__container">
<p className="p3">Listed Blogging Platform</p>
Expand All @@ -12,7 +12,7 @@ const Footer = ({ blogPage, author }) => (
{" "}
{(new Date()).getFullYear()}
{" "}
{author.display_name}
{!privatePost && author.display_name}
</p>
)}
<p className="p3">
Expand All @@ -31,11 +31,13 @@ Footer.propTypes = {
display_name: PropTypes.string.isRequired,
}),
blogPage: PropTypes.bool,
privatePost: PropTypes.bool,
};

Footer.defaultProps = {
author: null,
blogPage: false,
privatePost: false,
};

export default (props) => <Footer {...props} />;