Fix uploading for avatar plugin

pull/6376/head
Oliver Günther 6 years ago
parent 2ab1a51d7a
commit dcea0602a3
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 6
      frontend/legacy/webpack.config.js
  2. 13
      frontend/src/app/angular4-modules.ts
  3. 1
      frontend/src/app/components/api/op-file-upload/op-file-upload.service.ts
  4. 2
      frontend/src/app/modules/common/notifications/notification.component.html
  5. 3
      frontend/src/app/modules/hal/http/openproject-header-interceptor.ts
  6. 2
      lib/open_project/plugins/frontend_linking/generator.rb

@ -132,11 +132,11 @@ function getLegacyWebpackConfig() {
},
resolve: {
// Resolve symlinks from dynamically linked plugins
symlinks: true,
// Don't map symlinks from dynamically linked plugins to their real paths
symlinks: false,
modules: [
'node_modules',
path.resolve(__dirname, '..', 'node_modules')
],
extensions: ['.ts', '.tsx', '.js'],

@ -208,11 +208,11 @@ import {AttributeHelpTextModal} from "./modules/common/help-texts/attribute-help
import {CopyToClipboardDirective} from 'core-app/modules/common/copy-to-clipboard/copy-to-clipboard.directive';
import {WorkPackageEmbeddedTableEntryComponent} from "core-components/wp-table/embedded/wp-embedded-table-entry.component";
import {LinkedPluginsModule} from "core-app/modules/plugins/linked-plugins.module";
import {HookService} from "core-app/modules/plugins/hook-service";
@NgModule({
imports: [
BrowserModule,
UpgradeModule,
FormsModule,
// UI router routes configuration
UIRouterModule.forRoot(),
@ -539,7 +539,7 @@ import {LinkedPluginsModule} from "core-app/modules/plugins/linked-plugins.modul
})
export class OpenProjectModule {
// noinspection JSUnusedGlobalSymbols
ngDoBootstrap(appRef:ApplicationRef) {
ngDoBootstrap(appRef:ApplicationRef, injector:Injector) {
// Already done in openproject-app.ts
// this.upgrade.bootstrap(document.body, ['openproject'], {strictDi: false});
@ -554,6 +554,15 @@ export class OpenProjectModule {
{ tagName: 'op-ckeditor-form', cls: OpCkeditorFormComponent },
{ tagName: 'copy-to-clipboard', cls: CopyToClipboardDirective },
);
// Call hook service to allow modules to bootstrap additional elements.
// We can't use ngDoBootstrap in nested modules since they are not called.
const hookService = (appRef as any)._injector.get(HookService);
hookService
.call('openProjectAngularBootstrap')
.forEach((results:{tagName:string, cls:any}[]) => {
bootstrapOptional(appRef, ...results);
});
}
}

@ -95,6 +95,7 @@ export class OpenProjectFileUploadService {
body: formData,
// Observe the response, not the body
observe: 'response',
withCredentials: true,
// Subscribe to progress events. subscribe() will fire multiple times!
reportProgress: true
}

@ -26,7 +26,7 @@
*ngFor="let upload of data"
[upload]="upload"
(onSuccess)="onUploadSuccess()"
(onError)="onUploadError()">
(onError)="onUploadError($event)">
</notifications-upload-progress>
</ul>
</div>

@ -15,11 +15,12 @@ export class OpenProjectHeaderInterceptor implements HttpInterceptor {
.set('X-Requested-With', 'XMLHttpRequest');
if (csrf_token) {
newHeaders.set('X-CSRF-TOKEN', csrf_token);
newHeaders = newHeaders.set('X-CSRF-TOKEN', csrf_token);
}
// Clone the request to add the new header
const clonedRequest = req.clone({
withCredentials: true,
headers: newHeaders
});

@ -100,8 +100,6 @@ module ::OpenProject::Plugins
puts "Linking legacy frontend of OpenProject plugin #{name} to #{target}."
FileUtils.ln_sf(source, target)
end
generate_plugin_module(plugins)
end
end

Loading…
Cancel
Save