Skip to content

Commit d5d32ad

Browse files
author
billy clark
committed
Merge branch 'develop'
2 parents 7b16411 + 262bd5a commit d5d32ad

File tree

7 files changed

+63
-250
lines changed

7 files changed

+63
-250
lines changed

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,5 @@
66
"phpcs.composerJsonPath": "src",
77
"php.suggest.basic": false,
88
"git.ignoreLimitWarning": true,
9+
"makefile.makeDirectory": "docker",
910
}

src/Api/Model/Languageforge/Lexicon/Command/LexUploadCommands.php

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,11 @@ public static function uploadAudioFile($projectId, $mediaType, $tmpFilePath)
132132
$data->fileName = $fileNamePrefix . '_' . $fileName; //if the file has been converted, $fileName = converted file
133133
$response->result = true;
134134

135-
//Uncomment to ensure that only one format for each audio file is stored in the assets. We want to keep up to two formats right now (09-2022): the original and if needed, a FLEx-compatible one
136-
// if (array_key_exists('previousFilename', $_POST)) {
137-
// $previousFilename = $_POST['previousFilename'];
138-
// self::deleteMediaFile($projectId, $mediaType, $previousFilename);
139-
// }
135+
//If this audio upload is replacing old audio, the previous file(s) for the entry are deleted from the assets
136+
if (array_key_exists('previousFilename', $_POST)) {
137+
$previousFilename = $_POST['previousFilename'];
138+
self::deleteMediaFile($projectId, $mediaType, $previousFilename);
139+
}
140140
} else {
141141
$data = new ErrorResult();
142142
$data->errorType = 'UserMessage';
@@ -279,8 +279,16 @@ public static function deleteMediaFile($projectId, $mediaType, $fileName) {
279279
$data->errorMessage = $errorMsg;
280280
return $response;
281281
}
282-
$filePath = $folderPath . '/' . $fileName;
282+
283+
//Path to the specific file the entry points to
284+
$filePath = "$folderPath/$fileName";
285+
//Put any other stored versions of the file (e.g. the same file saved in other formats) in an array
286+
$fileNameWithoutExt = preg_replace('/\\.[^.\\s]{3,4}$/', '', $fileName);
287+
$versionsOfTheSameFile = glob("$folderPath/$fileNameWithoutExt.*");
288+
283289
if (file_exists($filePath) and ! is_dir($filePath)) {
290+
291+
//Delete the file the entry points to and create the server response
284292
if (unlink($filePath)) {
285293
$data = new MediaResult();
286294
$data->path = $folderPath;
@@ -291,8 +299,17 @@ public static function deleteMediaFile($projectId, $mediaType, $fileName) {
291299
$data->errorType = 'UserMessage';
292300
$data->errorMessage = "$fileName could not be deleted. Contact your Site Administrator.";
293301
}
302+
303+
//Delete any other stored versions of the file
304+
foreach ($versionsOfTheSameFile as $aVersionOfThisFile){
305+
if($aVersionOfThisFile != $filePath){ //because $filePath, the one the entry points to, was already deleted above
306+
unlink($aVersionOfThisFile);
307+
}
308+
}
309+
294310
return $response;
295311
}
312+
296313
$data = new ErrorResult();
297314
$data->errorType = 'UserMessage';
298315
$data->errorMessage = "$fileName does not exist in this project. Contact your Site Administrator.";

src/Site/views/languageforge/theme/default/sass/_global.scss

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,17 @@
6565
}
6666
}
6767

68-
// for very small devices such as iPhone 5
69-
@media (max-width: 350px) {
68+
// for small and extra small devices
69+
@include media-breakpoint-down(sm) {
7070
.btn span {
7171
display: none;
7272
}
7373
#shareBtn, #settingsBtn {
7474
padding-right: 0;
75+
76+
span {
77+
display: none;
78+
}
7579
}
7680
}
7781

@@ -200,11 +204,15 @@
200204
font-size: 25px;
201205
line-height: 25px;
202206
font-weight: bold;
207+
white-space: nowrap;
208+
overflow: hidden;
209+
text-overflow: ellipsis;
203210
@include media-breakpoint-down(sm) {
204211
font-size: 18px;
205212
line-height: 18px;
206213
}
207214
}
215+
overflow: hidden;
208216
}
209217
}
210218
.breadcrumbs {

src/angular-app/bellows/shared/audio-recorder/audio-recorder.component.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,16 @@ export class AudioRecorderController implements angular.IController {
5555
}
5656
);
5757

58+
//Stopping the media stream tracks releases the red recording indicator from browser tabs
59+
this.mediaRecorder.addEventListener("stop",
60+
() => {
61+
stream.getTracks().forEach(function(track) {
62+
track.stop();
63+
});
64+
}
65+
);
66+
67+
5868
this.recordingStartTime = new Date();
5969

6070
this.interval = this.$interval(() => {

src/composer.lock

Lines changed: 19 additions & 168 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)