added redraft

This commit is contained in:
Nicolas Constant 2019-07-06 00:20:03 -04:00
parent 2d01b3297e
commit 020fbd9de3
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
7 changed files with 25 additions and 10 deletions

View File

@ -30,9 +30,12 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
}
private _status: string = '';
@Input('status')
set status(value: string) {
this.countStatusChar(value);
this._status = value;
if (value) {
this.countStatusChar(value);
this._status = value;
}
}
get status(): string {
return this._status;

View File

@ -3,5 +3,6 @@
<app-create-status (onClose)="closeColumn()"
[isDirectMention]="isDirectMention"
[replyingUserHandle]="userHandle"></app-create-status>
[replyingUserHandle]="userHandle"
[status]="status"></app-create-status>
</div>

View File

@ -11,6 +11,7 @@ export class AddNewStatusComponent implements OnInit {
@Input() isDirectMention: boolean;
@Input() userHandle: string;
@Input() status: string;
constructor(private readonly navigationService: NavigationService) {
}

View File

@ -17,7 +17,8 @@
(browseThreadEvent)="browseThread($event)"></app-manage-account>
<app-add-new-status *ngIf="openPanel === 'createNewStatus'"
[isDirectMention]="isDirectMention"
[userHandle]="userHandle"></app-add-new-status>
[userHandle]="userHandle"
[status]="statusContent"></app-add-new-status>
<app-add-new-account *ngIf="openPanel === 'addNewAccount'"></app-add-new-account>
<app-search *ngIf="openPanel === 'search'"
(browseAccountEvent)="browseAccount($event)"

View File

@ -23,6 +23,7 @@ export class FloatingColumnComponent implements OnInit, OnDestroy {
isDirectMention: boolean;
userHandle: string;
statusContent: string;
openPanel: string = '';
@ -52,6 +53,7 @@ export class FloatingColumnComponent implements OnInit, OnDestroy {
} else {
this.isDirectMention = event.action === LeftPanelAction.DM;
this.userHandle = event.userHandle;
this.statusContent = event.statusContent;
this.openPanel = 'createNewStatus';
}
break;

View File

@ -405,12 +405,12 @@ export class ActionBarComponent implements OnInit, OnDestroy {
return this.mastodonService.deleteStatus(selectedAccount, status.id);
})
.then(() => {
if (redraft) {
this.navigationService.redraft(this.displayedStatus.content)
}
const deletedStatus = new StatusWrapper(this.displayedStatus, selectedAccount);
this.notificationService.deleteStatus(deletedStatus);
if (redraft) {
//TODO
}
})
.catch(err => {
this.notificationService.notifyHttpError(err);

View File

@ -36,6 +36,11 @@ export class NavigationService {
this.activatedPanelSubject.next(newEvent);
}
redraft(statusContent: string){
const newEvent = new OpenLeftPanelEvent(LeftPanelType.CreateNewStatus, LeftPanelAction.Redraft, null, statusContent.replace(/<[^>]*>/g, ''));
this.activatedPanelSubject.next(newEvent);
}
columnSelected(index: number): void {
this.columnSelectedSubject.next(index);
}
@ -53,14 +58,16 @@ export class OpenLeftPanelEvent {
constructor(
public type: LeftPanelType,
public action: LeftPanelAction = LeftPanelAction.None,
public userHandle: string = null ) {
public userHandle: string = null,
public statusContent: string = null) {
}
}
export enum LeftPanelAction {
None = 0,
DM = 1,
Mention = 2
Mention = 2,
Redraft = 3,
}
export enum LeftPanelType {