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

Remove "Refresh codename" feature #6195

Merged
merged 1 commit into from
Dec 10, 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
Original file line number Diff line number Diff line change
Expand Up @@ -290,7 +290,6 @@
/var/www/securedrop/static/i/font-awesome/info-circle-black.png r,
/var/www/securedrop/static/i/font-awesome/lock-black.png r,
/var/www/securedrop/static/i/font-awesome/refresh-blue.png r,
/var/www/securedrop/static/i/font-awesome/refresh-white.png r,
/var/www/securedrop/static/i/font-awesome/times-white.png r,
/var/www/securedrop/static/i/font-awesome/white/exclamation-circle.svg r,
/var/www/securedrop/static/i/font-awesome/white/guard.svg r,
Expand Down
18 changes: 1 addition & 17 deletions securedrop/sass/source.sass
Original file line number Diff line number Diff line change
Expand Up @@ -276,22 +276,6 @@ p#max-file-size
margin-bottom: 10px
margin-top: 5px

#regenerate-submit
span
font-size: 0

&:after
content: ""
display: inline-block
background:
image: url(/static/i/font-awesome/refresh-white.png)
position: center
repeat: no-repeat
size: contain
opacity: 0.9
height: 20px
width: 20px

#cancel
&:before
content: ""
Expand Down Expand Up @@ -323,4 +307,4 @@ p#max-file-size

background:
image: url(/static/icons/chevron-left.png)
size: contain
size: contain
2 changes: 1 addition & 1 deletion securedrop/source_app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def make_blueprint(config: SDConfig) -> Blueprint:
def index() -> str:
return render_template('index.html')

@view.route('/generate', methods=('GET', 'POST'))
@view.route('/generate', methods=('GET',))
def generate() -> Union[str, werkzeug.Response]:
if SessionManager.is_user_logged_in(db_session=db.session):
flash(gettext(
Expand Down
10 changes: 1 addition & 9 deletions securedrop/source_templates/generate.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,6 @@ <h1>{{ gettext('Welcome') }}</h1>
<h2 id="codename-heading" class="visually-hidden">{{ gettext('Codename') }}</h2>
<mark id="codename" class="codename"
aria-describedby="codename-instructions codename-explanation">{{ codename }}</mark>
<div class="pull-right">
<form id="regenerate-form" method="post">
<input name="csrf_token" type="hidden" value="{{ csrf_token() }}">
<button type="submit" id="regenerate-submit" class="small">
<span>{{ gettext('Refresh codename') }}</span>
</button>
</form>
</div>
</section>

<p class="explanation">
Expand All @@ -38,4 +30,4 @@ <h2 id="codename-heading" class="visually-hidden">{{ gettext('Codename') }}</h2>
{{ gettext('SUBMIT DOCUMENTS') }}
</button>
</form>
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion securedrop/source_templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -108,4 +108,4 @@ <h2 id="return-visit-heading" class="welcome-text">

</body>

</html>
</html>
Binary file removed securedrop/static/i/font-awesome/refresh-white.png
Binary file not shown.
2 changes: 1 addition & 1 deletion securedrop/tests/functional/source_navigation_steps.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def _source_clicks_submit_documents_on_homepage(self):
assert self._is_on_generate_page()

def _source_regenerates_codename(self):
self.safe_click_by_id("regenerate-submit")
self.driver.refresh()
Copy link
Member Author

Choose a reason for hiding this comment

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

From my read, test_refreshed_duplicate_generate_pages is still useful even without the "refresh codename" feature (for example, it tests that the user is redirected to the lookup page when they have already logged in in a separate tab), so I have simply altered the behavior here to reload the page instead.


def _source_chooses_to_submit_documents(self):
self._source_clicks_submit_documents_on_homepage()
Expand Down
2 changes: 1 addition & 1 deletion securedrop/tests/functional/test_source.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ def test_duplicate_generate_pages(self):

def test_refreshed_duplicate_generate_pages(self):
# Test generation of multiple codenames in different browser tabs, including behavior
# of refreshing the codemae in each tab. Ref. issue 4458.
# of refreshing the codename in each tab. Ref. issue 4458.

# Generate a codename in Tab A
assert len(self.driver.window_handles) == 1
Expand Down