Skip to content

Commit

Permalink
Release 1.9.2
Browse files Browse the repository at this point in the history
  • Loading branch information
billy clark authored Oct 12, 2021
2 parents 581aa52 + 805aded commit aa0751c
Show file tree
Hide file tree
Showing 16 changed files with 184 additions and 127 deletions.
4 changes: 4 additions & 0 deletions docker/app/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,10 @@ COPY docker/app/entrypoint.sh /

COPY --from=composer-builder /composer/vendor /var/www/html/vendor

# patch exception handling from Symfony to actually show exceptions instead of swallowing them
COPY docker/app/symfony-exceptions.patch /
RUN patch -p4 -i /symfony-exceptions.patch

RUN echo "${BUILD_VERSION}" > /var/www/html/build-version.txt \
&& sed -i /var/www/html/version.php -e "s/^\\(define('VERSION', '\\).*;\$/\\1${BUILD_VERSION}'\\);/"

Expand Down
1 change: 1 addition & 0 deletions docker/app/customizations.php.ini
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
memory_limit = 256M
post_max_size = 60M
upload_max_filesize = 60M
xdebug.log_level = 0
85 changes: 85 additions & 0 deletions docker/app/symfony-exceptions.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
--- a/var/www/html/vendor/symfony/debug/ExceptionHandler.php 2019-07-23 15:39:19.000000000 +0700
+++ b/var/www/html/vendor/symfony/debug/ExceptionHandler.php 2021-09-27 15:08:37.000000000 +0700
@@ -103,7 +103,7 @@
* The latter takes precedence and any output from the former is cancelled,
* if and only if nothing bad happens in this handling path.
*/
- public function handle(\Exception $exception)
+ public function handle(\Error $exception)
{
if (null === $this->handler || $exception instanceof OutOfMemoryException) {
$this->sendPhpResponse($exception);
@@ -144,7 +144,7 @@
try {
\call_user_func($this->handler, $exception);
$this->caughtLength = $caughtLength;
- } catch (\Exception $e) {
+ } catch (\Error $e) {
if (!$caughtLength) {
// All handlers failed. Let PHP handle that now.
throw $exception;
@@ -158,7 +158,7 @@
* This method uses plain PHP functions like header() and echo to output
* the response.
*
- * @param \Exception|FlattenException $exception An \Exception or FlattenException instance
+ * @param \Error|FlattenException $exception An \Error or FlattenException instance
*/
public function sendPhpResponse($exception)
{
@@ -180,7 +180,7 @@
/**
* Gets the full HTML content associated with the given exception.
*
- * @param \Exception|FlattenException $exception An \Exception or FlattenException instance
+ * @param \Error|FlattenException $exception An \Error or FlattenException instance
*
* @return string The HTML content as a string
*/
@@ -250,7 +250,7 @@

$content .= "</tbody>\n</table>\n</div>\n";
}
- } catch (\Exception $e) {
+ } catch (\Error $e) {
// something nasty happened and we cannot throw an exception anymore
if ($this->debug) {
$title = sprintf('Exception thrown when handling an exception (%s: %s)', \get_class($e), $this->escapeHtml($e->getMessage()));
@@ -390,7 +390,7 @@
} else {
try {
$link = $fmt->format($path, $line);
- } catch (\Exception $e) {
+ } catch (\Error $e) {
return sprintf('<span class="block trace-file-path">in <span title="%s%3$s"><strong>%s</strong>%s</span></span>', $this->escapeHtml($path), $file, 0 < $line ? ' line '.$line : '');
}
}
--- a/var/www/html/vendor/symfony/debug/Exception/FlattenException.php 2019-07-23 15:39:19.000000000 +0700
+++ b/var/www/html/vendor/symfony/debug/Exception/FlattenException.php 2021-09-27 15:09:06.000000000 +0700
@@ -33,7 +33,7 @@
private $file;
private $line;

- public static function create(\Exception $exception, $statusCode = null, array $headers = [])
+ public static function create(\Error $exception, $statusCode = null, array $headers = [])
{
$e = new static();
$e->setMessage($exception->getMessage());
@@ -59,7 +59,7 @@

$previous = $exception->getPrevious();

- if ($previous instanceof \Exception) {
+ if ($previous instanceof \Error) {
$e->setPrevious(static::create($previous));
} elseif ($previous instanceof \Throwable) {
$e->setPrevious(static::create(new FatalThrowableError($previous)));
@@ -178,7 +178,7 @@
return $this->trace;
}

- public function setTraceFromException(\Exception $exception)
+ public function setTraceFromException(\Error $exception)
{
$this->setTrace($exception->getTrace(), $exception->getFile(), $exception->getLine());
}
8 changes: 5 additions & 3 deletions src/Site/OAuth/OAuthBase.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@ public function findUserModelByOAuthId(string $oauthId)
return $userModel;
}

public static function setSilexAuthToken(UserModel $userModel, Application $app): string
public static function doSilexLogin(UserModel $userModel, Application $app): string
{
$roles = AuthUserProvider::getSiteRoles($userModel, $app['website']);
$oauthUser = new UserWithId($userModel->username, '', $userModel->username, $roles);
$oauthToken = new UsernamePasswordToken($oauthUser, '', 'site', $oauthUser->getRoles());
$tokenStorage = $app['security.token_storage'];
$userModel->last_login = time();
$userModel->write();
if (!is_null($tokenStorage) && $tokenStorage instanceof TokenStorageInterface) {
$tokenStorage->setToken($oauthToken);
return true;
Expand Down Expand Up @@ -277,7 +279,7 @@ protected function loginWithOAuthToken(Application $app, AbstractProvider $provi
// so that any changes made by Validate::check won't be overwritten by our write() call
Validate::check($app, $userModel->validationKey);
}
$success = $this->setSilexAuthToken($userModel, $app);
$success = $this->doSilexLogin($userModel, $app);
if (! $success) {
$this->addErrorMessage($app, 'Sorry, we couldn\'t process the ' . ucwords($this->getProviderName()) . ' login data. This may be a temporary failure, so please try again. If the problem persists, try logging in with a username and password instead.');
}
Expand All @@ -286,7 +288,7 @@ protected function loginWithOAuthToken(Application $app, AbstractProvider $provi
}
} else {
// OAuth ID found in our user model
$success = $this->setSilexAuthToken($userModel, $app);
$success = $this->doSilexLogin($userModel, $app);
if (! $success) {
$this->addErrorMessage($app, 'Sorry, we couldn\'t process the ' . ucwords($this->getProviderName()) . ' login data. This may be a temporary failure, so please try again. If the problem persists, try logging in with a username and password instead.');
}
Expand Down
26 changes: 2 additions & 24 deletions src/Site/views/languageforge/container/languageforge.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<div id="primary-navigation" class="fixed-nav-bar" data-ng-cloak data-ng-controller="navbarController as $ctrl">
<nav class="navbar navbar-expand navbar-dark align-items-stretch">
<span class="navbar-brand d-md-inline-block mr-auto">
<img class="navbar-logo" src="/Site/views/languageforge/theme/default/image/lf_logo_medium.png">
<img class="navbar-logo" title="v{{ version }}" src="/Site/views/languageforge/theme/default/image/lf_logo_medium.png">
<a class="website-title" href="/">{{ app.website.name }}</a>
</span>
<ul class="nav navbar-nav">
Expand Down Expand Up @@ -127,7 +127,7 @@
<div id="primary-navigation" class="logged-out" data-ng-cloak data-ng-controller="navbarController as $ctrl">
<nav class="fixed-nav-bar navbar navbar-expand navbar-dark align-items-stretch logged-out">
<span class="navbar-brand d-md-inline-block mr-auto">
<img class="navbar-logo" src="/Site/views/languageforge/theme/default/image/lf_logo_medium.png">
<img class="navbar-logo" title="v{{ version }}" src="/Site/views/languageforge/theme/default/image/lf_logo_medium.png">
<a class="" href="/">{{ app.website.name }}</a>
</span>
<ul class="nav navbar-nav">
Expand All @@ -151,28 +151,6 @@
{% endif %}
{% endblock %}

{% block footer %}
<footer class="footer">
<div class="d-flex">
<div class="d-none d-sm-flex align-items-end">
<div>
<a href="https://inter.payap.ac.th/"><img src="/Site/views/shared/image/payap_logo.png"
alt="Payap University Logo" width="85" height="25" /></a>
<a href="http://www.sil.org"><img src="/Site/views/shared/image/sil_logo_small.png"
alt="SIL International Logo" width="25" height="30" /></a>
</div>
</div>
<div class="d-flex flex-grow justify-content-end align-items-end">
<small>
v {{ version }}.
Copyright <span class="notranslate">{{ "now"|date("Y") }}</span> <a href="http://www.sil.org" class="links">SIL International</a>.
<a href="/terms_and_conditions" class="links">Terms and conditions</a>.
</small>
</div>
</div>
</footer>
{% endblock %}

{% block analytics %}
{% if 'languageforge.org' in http_host %}
<script>
Expand Down
21 changes: 0 additions & 21 deletions src/Site/views/shared/_global.scss
Original file line number Diff line number Diff line change
Expand Up @@ -173,27 +173,6 @@ nav {
@include button-variant(white, #ADADAD, #E6E6E6);
}

.footer{
background-color: $theme-primary;
color: white;
padding: 0.5em;
margin-top: 0.5em;

.links{
color: white;
border-bottom: 1px dotted white;
text-decoration: none;
}

.footerimages {
padding-bottom: 10px;
}

img {
margin-right: 5px;
}
}

// TODO: Remove hack for modal box issue as a result of ui.bootstrap
.modal-select-language {

Expand Down
35 changes: 20 additions & 15 deletions src/angular-app/languageforge/lexicon/editor/_editor.scss
Original file line number Diff line number Diff line change
Expand Up @@ -293,12 +293,12 @@ dc-entry .card {
}
}
.lexiconItemListContainer {
@include media-breakpoint-up(sm) {
@include media-breakpoint-up(md) {
margin-bottom: 5px;
height: calc(100vh - 310px);
height: calc(100vh - 260px);
}
@include media-breakpoint-down(sm) {
height: calc(100vh - 260px);
height: calc(100vh - 220px);
}
overflow: auto;
}
Expand All @@ -321,8 +321,12 @@ dc-entry .card {

#lexAppEditView {
#compactEntryListContainer {
height: calc(100vh - 400px);
height: calc(100vh - 325px);
overflow: auto;

.list-group-item {
padding: .25rem 1.25rem;
}
}
.word-definition-title {
margin-bottom: 5px;
Expand Down Expand Up @@ -721,7 +725,7 @@ dc-entry .card {
position: relative;
overflow-y: hidden;
min-height: 40px;
height: 55px;
height: 50px;
border-bottom: solid 1px darkgrey;
width: 100%;
line-height: 1.2em;
Expand All @@ -736,10 +740,8 @@ dc-entry .card {
}

.entryItemView {
/* TODO: review this in light of animation and the footer staying at the bottom. IJH 2014-09
The view is used in edit and comment view */
min-height: 580px;

min-height: 580px;
.field-container {
position: relative;
.comment-bubble-group {
Expand Down Expand Up @@ -782,13 +784,16 @@ dc-entry .card {
}

.entryItemView {
i.fa-times {
cursor: pointer;
color: #888;
}
button i.fa-times {
color: inherit;
}
.form-group {
margin-bottom: 5px;
}
i.fa-times {
cursor: pointer;
color: #888;
}
button i.fa-times {
color: inherit;
}
}

#lexAppCommentView .commentCount {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
@import '../../../../../Site/views/languageforge/theme/default/sass/variables';
@import '../../../../../../node_modules/bootstrap/scss/functions';
@import '../../../../../../node_modules/bootstrap/scss/variables';
@import '../../../../../../node_modules/bootstrap/scss/mixins';

#lexAppEditView {
display: flex;
Expand All @@ -19,11 +22,12 @@
overflow-y: scroll;
overflow-x: hidden;

@include media-breakpoint-up(sm) {
height: calc(100vh - 296px);
@include media-breakpoint-up(md) {
height: calc(100vh - 230px);
}

@include media-breakpoint-down(sm) {
height: calc(100vh - 270px);
height: calc(100vh - 215px);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ export class LexiconEditorController implements angular.IController {
if (this.hasUnsavedChanges()) {
this.saveCurrentEntry();
}
// destroy listeners when leaving editor page
angular.element(window).unbind('keyup', (e: Event) => {});
};

this.show.entryListModifiers = !(this.$window.localStorage.getItem('viewFilter') == null ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@
<b>Invite a new member</b>
<div class="inline-invite-form" style="margin-top: 8px;">
<label>via: </label>
<input type="email" class="form-control" placeholder="Email" ng-model="$ctrl.inviteEmail">
<button type="button" class="btn btn-primary"
ng-click="$ctrl.sendEmailInvite()" data-ng-disabled="$ctrl.inviteEmailDisabled()">
<i class="fa fa-paper-plane"></i>
</button>
<input type="email" ng-form="email" class="form-control" placeholder="Email" ng-model="$ctrl.inviteEmail">
<role-dropdown class="sm-no-margin"
ng-if="$ctrl.currentUserIsManager"
target="'email_invite'"
roles="$ctrl.emailInviteRoles"
selected-role="$ctrl.emailInviteRole"
on-role-changed="$ctrl.onRoleChanged($event)"></role-dropdown>
<button type="button" class="btn btn-primary"
ng-click="$ctrl.sendEmailInvite()" data-ng-disabled="! ($ctrl.inviteEmail && email.$valid)">
<i class="fa fa-paper-plane pr-1"></i> Send
</button>
</div>

<div ng-if="$ctrl.currentUserIsManager || !$ctrl.inviteLink">
Expand All @@ -33,6 +33,10 @@
roles="$ctrl.reusableInviteLinkRoles"
selected-role="$ctrl.getInviteRole()"
on-role-changed="$ctrl.onRoleChanged($event)"></role-dropdown>
<button type="button" class="btn btn-primary"
ng-click="$ctrl.copy()" data-ng-disabled="! $ctrl.inviteLink">
<i class="fa fa-clipboard pr-1"></i> Copy
</button>
</div>
</div>
</div>
Loading

0 comments on commit aa0751c

Please sign in to comment.