Skip to content

Commit

Permalink
Merge branch 'release/0.108.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
sloria committed May 8, 2017
2 parents fe69121 + 341df45 commit 37a04e6
Show file tree
Hide file tree
Showing 82 changed files with 1,971 additions and 614 deletions.
29 changes: 29 additions & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,35 @@
Changelog
*********

0.108.0 (2017-05-08)
====================
- [My Projects] Icon for Uncategorized disappears when project/component is highlighted
- Comment pane should not appear in anonymous view-only links
- Moving multiple GitHub files into folder fails
- Incorrect heading text is displayed in copy or move "taking longer than expected" message
- Files added to OSF Storage display incorrect time stamps
- Update Social Links to ImpactStory
- & in file name causes registration to fail
- Prereg banner on Dashboard misbehaves on mobile and requires hard refresh to show correct color
- Retractions should show the date retracted in the metadata
- Update Default to Collapsed Preview Pane on My Projects Page
- Add Search by User Name and Search by Email to Admin App
- Finish user serialization
- Add Banner to Private Project That Has Preprint
- Generate Account Confirmation + Password reset Links in Admin App
- Redirect osf.io/explore (and osf.io/explore/activity) to osf.io/activity
- Better way to surface registration form
- Improve wording on move/replace file modal
- Change Default Language on Wiki without Content
- Update Language when there are no components on a project
- Change text prompt if no tags applied
- Change Project Description Prompt text
- Change No License Prompt Text
- Improve Language for Non-Admins on Registrations Tab
- Add timestamp to APIv2 file versions
- Make wiki versioning more clear to users


0.107.0 (2017-04-28)
====================

Expand Down
54 changes: 42 additions & 12 deletions README-docker-compose.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,15 +185,15 @@ Ubuntu: Skip install of docker-sync, fswatch, and unison. instead...

- Once the requirements have all been installed, you can start the OSF in the background with

```
```bash
$ docker-sync start
# Wait until you see "Nothing to do: replicas have not changed since last sync."
$ docker-compose up -d assets admin_assets mfr wb fakecas sharejs worker web api admin preprints registries
```

- To view the logs for a given container:

```
```bash
$ docker-compose logs -f --tail 100 web
```

Expand Down Expand Up @@ -233,12 +233,12 @@ import ipdb; ipdb.set_trace()

You should run the `web` and/or `api` container (depending on which codebase the breakpoint is in) using:

```
```bash
# Kill the already-running web container
docker-compose kill web
$ docker-compose kill web
# Run a web container. App logs and breakpoints will show up here.
docker-compose run --service-ports web
$ docker-compose run --service-ports web
```

**IMPORTANT: While attached to the running app, CTRL-c will stop the container.** To detach from the container and leave it running, **use CTRL-p CTRL-q**. Use `docker attach` to re-attach to the container, passing the *container-name* (which you can get from `docker-compose ps`), e.g. `docker attach osf_web_run_1`.
Expand Down Expand Up @@ -286,6 +286,36 @@ Delete a container _(does not remove volumes)_:
List containers and status:
- `$ docker-compose ps`

### Backing up your database
In certain cases, you may wish to remove all docker container images, but preserve a copy of the database used by your
local OSF instance. For example, this is helpful if you have test data that you would like to use after
resetting docker. To back up your database, follow the following sequence of commands:

1. Install Postgres on your local machine, outside of docker. (eg `brew install postgres`) To avoid migrations, the
version you install must match the one used by the docker container.
([as of this writing](https://github.com/CenterForOpenScience/osf.io/blob/ce1702cbc95eb7777e5aaf650658a9966f0e6b0c/docker-compose.yml#L53), Postgres 9.6)
2. Start postgres locally. This must be on a different port than the one used by [docker postgres](https://github.com/CenterForOpenScience/osf.io/blob/ce1702cbc95eb7777e5aaf650658a9966f0e6b0c/docker-compose.yml#L61).
Eg, `pg_ctl -D /usr/local/var/postgres start -o "-p 5433"`
3. Verify that the postgres docker container is running (`docker-compose up -d postgres`)
4. Tell your local (non-docker) version of postgres to connect to (and back up) data from the instance in docker
(defaults to port 5432):
`pg_dump --username postgres --compress 9 --create --clean --format d --jobs 4 --host localhost --file ~/Desktop/osf_backup osf`

(shorthand: `pg_dump -U postgres -Z 9 -C --c -Fd --j 4 -h localhost --f ~/Desktop/osf_backup osf`)


#### Restoring your database
To restore a local copy of your database for use inside docker, make sure to start both local and dockerized postgres
(as shown above). For best results, start from a clean postgres container with no other data. (see below for
instructions on dropping postgres data volumes)

When ready, run the restore command from a local terminal:
```bash
$ pg_restore --username postgres --clean --dbname osf --format d --jobs 4 --host localhost ~/Desktop/osf_backup
```

(shorthand) `pg_restore -U postgres -c -d osf -Fd -j 4 -h localhost ~/Desktop/osf_backup`

## Cleanup & Docker Reset

Resetting the Environment:
Expand All @@ -303,15 +333,15 @@ Delete a persistent storage volume:
## Updating

```bash
git stash # if you have any changes that need to be stashed
git pull upstream develop # (replace upstream with the name of your remote)
git stash pop # unstash changes
$ git stash # if you have any changes that need to be stashed
$ git pull upstream develop # (replace upstream with the name of your remote)
$ git stash pop # unstash changes
# If you get an out of space error
docker image prune
$ docker image prune
# Pull latest images
docker-compose pull
$ docker-compose pull
docker-compose up requirements mfr_requirements wb_requirements
$ docker-compose up requirements mfr_requirements wb_requirements
# Run db migrations
docker-compose run --rm web python manage.py migrate
$ docker-compose run --rm web python manage.py migrate
```
2 changes: 2 additions & 0 deletions addons/github/apps.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ def github_hgrid_data(node_settings, auth, **kwargs):
except NotFoundError:
logger.error('Could not access GitHub repo')
return None
except GitHubError:
return
if repo.private:
return None

Expand Down
5 changes: 4 additions & 1 deletion addons/github/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,10 @@ def short_url(self):
@property
def is_private(self):
connection = GitHubClient(external_account=self.external_account)
return connection.repo(user=self.user, repo=self.repo).private
try:
return connection.repo(user=self.user, repo=self.repo).private
except GitHubError:
return

# TODO: Delete me and replace with serialize_settings / Knockout
def to_json(self, user):
Expand Down
2 changes: 1 addition & 1 deletion addons/wiki/static/wikiPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ function ViewWidget(visible, version, viewText, rendered, contentURL, allowMathj
request.done(function (resp) {
if(self.visible()) {
var $markdownElement = $('#wikiViewRender');
var rawContent = resp.wiki_content || '*No wiki content*';
var rawContent = resp.wiki_content || '*Add important information, links, or images here to describe your project.*';
if (resp.rendered_before_update) {
// Use old md renderer. Don't mathjaxify
self.allowMathjaxification(false);
Expand Down
8 changes: 5 additions & 3 deletions addons/wiki/templates/edit.mako
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## Use full page width
<%def name="container_class()">container-xxl</%def>

% if (user['can_comment'] or node['has_comments']):
% if (user['can_comment'] or node['has_comments']) and not node['anonymous']:
<%include file="include/comment_pane_template.mako"/>
% endif

Expand Down Expand Up @@ -83,6 +83,8 @@

<div class="pull-right">
<!-- Version Picker -->
<span>Wiki Version:</span>
<div style="display: inline-block">
<select class="form-control" data-bind="value:viewVersion" id="viewVersionSelect">
% if user['can_edit_wiki_body']:
<option value="preview" ${'selected' if version_settings['view'] == 'preview' else ''}>Preview</option>
Expand All @@ -98,7 +100,7 @@
% endfor
% endif
</select>

</div>
</div>

</div>
Expand All @@ -110,7 +112,7 @@
% if wiki_content:
${wiki_content}
% else:
<p><em>No wiki content</em></p>
<p class="text-muted"><em>Add important information, links, or images here to describe your project.</em></p>
% endif
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion addons/wiki/templates/wiki_widget.mako
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
% if wiki_content:
${wiki_content}
% else:
<p><em>No wiki content</em></p>
<p class="text-muted"><em>Add important information, links, or images here to describe your project.</em></p>
% endif
</div>

Expand Down
2 changes: 1 addition & 1 deletion addons/wiki/tests/test_wiki.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,7 +341,7 @@ def test_project_dashboard_shows_no_wiki_content_text(self):
project = ProjectFactory(creator=self.user)
url = project.web_url_for('view_project')
res = self.app.get(url, auth=self.user.auth)
assert_in('No wiki content', res)
assert_in('Add important information, links, or images here to describe your project.', res)

def test_project_dashboard_wiki_wname_get_shows_non_ascii_characters(self):
# Regression test for:
Expand Down
2 changes: 1 addition & 1 deletion admin/base/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def get(self, request, *args, **kwargs):
AttributeError(
'{} with id "{}" not found.'.format(
self.context_object_name.title(),
kwargs.get('spam_id')
kwargs.get('guid')
)
)
)
3 changes: 3 additions & 0 deletions admin/pre_reg/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,9 @@ class CommentUpdateView(PermissionRequiredMixin, UpdateView):
permission_required = ('osf.view_prereg', 'osf.administer_prereg')
raise_exception = True

def get_object(self, *args, **kwargs):
return DraftRegistration.load(self.kwargs.get('draft_pk'))

def post(self, request, *args, **kwargs):
try:
data = json.loads(request.body).get('schema_data', {})
Expand Down
2 changes: 1 addition & 1 deletion admin/preprints/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class PreprintFormView(PermissionRequiredMixin, GuidFormView):
"""
template_name = 'preprints/search.html'
object_type = 'preprint'
permission_required = 'osf.view_node'
permission_required = 'osf.view_preprintservice'
raise_exception = True

@property
Expand Down
21 changes: 21 additions & 0 deletions admin/static/css/base.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
p input {
padding: 5px 5px 5px 5px;
margin-left: 10px;
width: 80%;
}

p select {
padding: 5px 5px 5px 5px;
margin-left: 10px;
width: 80%;
}

p textarea {
padding: 5px 5px 5px 5px;
margin-left: 10px;
width: 80%;
}

form p label {
width: 10%;
}
22 changes: 22 additions & 0 deletions admin/templates/users/get_link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal">x</button>
<h3>{{ title }} for user {{ username }}</h3>
</div>
<div class="modal-body">
{% if user_link %}
<p>{{ user_link }}</p>
{% endif %}
{% if node_claim_links %}
<ul>
{% for link in node_claim_links %}
<li>{{ link }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default"
data-dismiss="modal">
Cancel
</button>
</div>
12 changes: 12 additions & 0 deletions admin/templates/users/list.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{% extends 'base.html' %}
{% load static %}
{% block title %}
<title>User Search Results</title>
{% endblock title %}
{% block content %}
{% include 'users/user_list.html' %}

{% if not users|length %}
<h3>No results found</h3>
{% endif %}
{% endblock content %}
42 changes: 19 additions & 23 deletions admin/templates/users/search.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{% extends 'base.html' %}
{% load static %}
{% load node_extras %}
{% block top_includes %}
<link rel="stylesheet" type="text/css" href="/static/css/base.css" />
{% endblock %}
{% block title %}
<title>User Search</title>
{% endblock title %}
Expand All @@ -10,33 +13,26 @@
<h3>User Search</h3>
</div>
<div class="row">
<form action="{% url 'users:search' %}" method="post">
{% csrf_token %}
{% if form.errors %}
<div class="alert alert-danger">{{ form.errors }}</div>
{% endif %}
<div class="form-group">
<label for="guid">User GUID:</label>
{{ form.guid }}
</div>
<div class="form-group">
<label for="name">User name:</label>
<input type="text" id="name" disabled/>
</div>
<div class="form-group">
<label for="email">User email:</label>
<input type="text" id="email" disabled/>
</div>
<input type="submit" class="btn btn-primary" value="Submit" />
</form>
<div class="col-md-6">
<form action="{% url 'users:search' %}" method="post">
{% csrf_token %}
{{ form.as_p }}
<input type="submit" class="btn btn-primary" value="Submit" />
</form>
</div>
</div>
<div class="row">
<h3>User Workshop Follow-up</h3>
<div class="col-md-12">
<h3>User Workshop Follow-up</h3>
</div>
</div>
<div class="row">
<a href="{% url 'users:workshop' %}" class="btn btn-default">
Go
</a>
<div class="col-md-12">
<a href="{% url 'users:workshop' %}" class="btn btn-default">
Go
</a>

</div>
</div>
</div>
{% endblock content %}
Loading

0 comments on commit 37a04e6

Please sign in to comment.