Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Merge pull request #5076 from punamdahiya/5074_non_owned_shot_banner
Browse files Browse the repository at this point in the history
Fixes #5074 - Hide Signin banner on non-owned shot if authenticated
  • Loading branch information
punamdahiya authored Oct 29, 2018
2 parents 27bb443 + c77a872 commit c7e3be4
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 11 deletions.
1 change: 0 additions & 1 deletion server/src/pages/shot/controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ function shouldShowPromo(model) {
function updateModel(authData) {
Object.assign(model, authData);
model.isExtInstalled = true;
model.isFxaAuthenticated = model.accountId && model.accountId === model.shotAccountId;
}

exports.launch = function(data) {
Expand Down
3 changes: 0 additions & 3 deletions server/src/pages/shot/model.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ exports.createModel = function(req) {
}
const title = req.getText("shotPageTitle", {originalTitle: req.shot.title});
const enableAnnotations = req.config.enableAnnotations;
const isFxaAuthenticated = req.accountId && req.accountId === req.shot.accountId;
const copyImageErrorMessage = {
title: req.getText("copyImageErrorTitle"),
message: req.getText("copyImageErrorMessage"),
Expand All @@ -28,7 +27,6 @@ exports.createModel = function(req) {
productName: req.config.productName,
isExtInstalled: !!req.deviceId,
isOwner: req.shot.isOwner,
isFxaAuthenticated,
gaId: req.config.gaId,
deviceId: req.deviceId,
buildTime,
Expand Down Expand Up @@ -57,7 +55,6 @@ exports.createModel = function(req) {
productName: req.config.productName,
isExtInstalled: !!req.deviceId,
isOwner: req.shot.isOwner,
isFxaAuthenticated,
gaId: req.config.gaId,
deviceId: req.deviceId,
shotAccountId: req.shot.accountId,
Expand Down
6 changes: 3 additions & 3 deletions server/src/pages/shot/shotpage-header.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ exports.ShotPageHeader = class ShotPageHeader extends React.Component {
if (this.props.isOwner) {
return (
<div className="shot-fxa-signin">
<SignInButton isFxaAuthenticated={this.props.isFxaAuthenticated} initialPage={this.props.shot.id}
<SignInButton isFxaAuthenticated={this.props.hasFxa} initialPage={this.props.shot.id}
staticLink={this.props.staticLink} />
</div>
);
Expand All @@ -114,7 +114,7 @@ exports.ShotPageHeader = class ShotPageHeader extends React.Component {

return (
<Header shouldGetFirefox={this.props.shouldGetFirefox} isOwner={this.props.isOwner}
hasFxa={this.props.isFxaAuthenticated}>
hasFxa={this.props.hasFxa}>
{ myShotsText }
{ shotInfo }
{ shotActions }
Expand All @@ -129,7 +129,7 @@ exports.ShotPageHeader.propTypes = {
children: PropTypes.node,
isOwner: PropTypes.bool,
shot: PropTypes.object,
isFxaAuthenticated: PropTypes.bool,
hasFxa: PropTypes.bool,
expireTime: PropTypes.number,
shouldGetFirefox: PropTypes.bool,
shotActions: PropTypes.array,
Expand Down
8 changes: 4 additions & 4 deletions server/src/pages/shot/view.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,12 +381,12 @@ class Body extends React.Component {
</div> : null;
const favImgSrc = this.props.expireTime ? this.props.staticLink("/static/img/icon-heart-outline.svg") :
this.props.staticLink("/static/img/icon-heart.svg");
const inactive = this.props.isFxaAuthenticated ? "" : "inactive";
const inactive = this.props.hasFxa ? "" : "inactive";

favoriteShotButton = <div className="favorite-shot-button" key="favorite-shot-button">
<Localized id="shotPagefavoriteButton" attrs={{title: true}}>
<button className={`button transparent nav-button ${inactive}`}
disabled={!this.props.isFxaAuthenticated} onClick={this.onClickFavorite.bind(this)}>
disabled={!this.props.hasFxa} onClick={this.onClickFavorite.bind(this)}>
<img src={favImgSrc} />
</button>
</Localized></div>;
Expand Down Expand Up @@ -443,7 +443,7 @@ class Body extends React.Component {
return (
<reactruntime.BodyTemplate {...this.props}>
<div id="frame" className="inverse-color-scheme full-height column-space">
<ShotPageHeader isOwner={this.props.isOwner} isFxaAuthenticated={this.props.isFxaAuthenticated}
<ShotPageHeader isOwner={this.props.isOwner} hasFxa={this.props.hasFxa}
shot={this.props.shot} expireTime={this.props.expireTime} shouldGetFirefox={renderGetFirefox}
staticLink={this.props.staticLink} shotActions={shotActions}>
{ !this.props.isOwner ? downloadButton : null }
Expand Down Expand Up @@ -572,7 +572,7 @@ Body.propTypes = {
isExtInstalled: PropTypes.bool,
isMobile: PropTypes.bool,
isOwner: PropTypes.bool,
isFxaAuthenticated: PropTypes.bool,
hasFxa: PropTypes.bool,
loginFailed: PropTypes.bool,
pngToJpegCutoff: PropTypes.number,
retentionTime: PropTypes.number,
Expand Down

0 comments on commit c7e3be4

Please sign in to comment.