Skip to content

Commit

Permalink
Enable recipients whistleblowers to leave comments even if report sta…
Browse files Browse the repository at this point in the history
…tus is closed (#4293)
  • Loading branch information
evilaliv3 committed Nov 5, 2024
1 parent 93ec1d5 commit cb5f366
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 44 deletions.
1 change: 0 additions & 1 deletion backend/globaleaks/handlers/whistleblower/wbtip.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ def create_comment(session, tid, user_id, content):
itip = db_get(session,
models.InternalTip,
(models.InternalTip.id == user_id,
models.InternalTip.status != 'closed',
models.InternalTip.tid == tid))

itip.update_date = itip.last_access = datetime_now()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,18 @@
</div>
@if (!collapsed) {
<div class="card-body">
@if (tipService.tip.status !== 'closed') {
<div class="row">
<div class="col-md-12 clearfix">
<textarea id="TipCommunicationCommentsInput" [(ngModel)]="newCommentContent" name="newCommentContent" maxlength="4096" class="form-control" autocomplete="off"></textarea>
<span class="float-end">{{newCommentContent.length ? newCommentContent.length : '0'}}/4096</span>
</div>
<div class="col-md-12 clearfix">
<button id="comment-action-send" class="btn btn-primary" (click)="newComment()" [disabled]="!newCommentContent">
<i class="fa-solid fa-comment"></i>
<span>{{'Send'|translate}}</span>
</button>
</div>
<div class="row">
<div class="col-md-12 clearfix">
<textarea id="TipCommunicationCommentsInput" [(ngModel)]="newCommentContent" name="newCommentContent" maxlength="4096" class="form-control" autocomplete="off"></textarea>
<span class="float-end">{{newCommentContent.length ? newCommentContent.length : '0'}}/4096</span>
</div>
}
<div class="col-md-12 clearfix">
<button id="comment-action-send" class="btn btn-primary" (click)="newComment()" [disabled]="!newCommentContent">
<i class="fa-solid fa-comment"></i>
<span>{{'Send'|translate}}</span>
</button>
</div>
</div>
@if (tipService.tip.comments && tipService.tip.comments.length) {
<div>
@for (comment of getSortedComments(comments | orderBy:'creation_date': true | filter : 'visibility' : key) | slice: (currentCommentsPage-1) * itemsPerPage : (currentCommentsPage-1) * itemsPerPage + itemsPerPage; track comment; let index = $index) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,37 +19,35 @@
</div>
</div>
}
@if (tip.status !== 'closed') {
<div>
<div>{{'Upload a file:'|translate}}</div>
<div class="form">
<div class="input-group">
<span class="input-group-prepend">
<span class="input-group-text rounded-end-0">{{'Description'|translate}}</span>
</span>
<input type="text" class="form-control" id="upload_description" [(ngModel)]="file_upload_description" />
<span class="input-group-append" [ngClass]="{'disabled': !file_upload_description}">
<input #uploader [attr.id]="fileInput" id="customFile" type="file" flowButton [style.display]="'none'" class="custom-file-input" (change)="onFileSelected(uploader.files)" />
<label [attr.for]="fileInput" for="customFile" class="btn btn-primary rounded-start-0 m-0">
<i class="fa-solid fa-upload "></i>
<span>{{'Upload'|translate}}</span>
</label>
</span>
</div>
@if (showError) {
<div>
<br>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<div>
<span>{{'File size not accepted.'|translate}}</span> {{errorFile?.name}} {{'Maximum file size is:' | translate}} {{appDataService.public.node.maximum_filesize}} MB
</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" (click)="dismissError();errorFile?.cancel(); showError=false"></button>
<div>
<div>{{'Upload a file:'|translate}}</div>
<div class="form">
<div class="input-group">
<span class="input-group-prepend">
<span class="input-group-text rounded-end-0">{{'Description'|translate}}</span>
</span>
<input type="text" class="form-control" id="upload_description" [(ngModel)]="file_upload_description" />
<span class="input-group-append" [ngClass]="{'disabled': !file_upload_description}">
<input #uploader [attr.id]="fileInput" id="customFile" type="file" flowButton [style.display]="'none'" class="custom-file-input" (change)="onFileSelected(uploader.files)" />
<label [attr.for]="fileInput" for="customFile" class="btn btn-primary rounded-start-0 m-0">
<i class="fa-solid fa-upload "></i>
<span>{{'Upload'|translate}}</span>
</label>
</span>
</div>
@if (showError) {
<div>
<br>
<div class="alert alert-danger alert-dismissible fade show" role="alert">
<div>
<span>{{'File size not accepted.'|translate}}</span> {{errorFile?.name}} {{'Maximum file size is:' | translate}} {{appDataService.public.node.maximum_filesize}} MB
</div>
<button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close" (click)="dismissError();errorFile?.cancel(); showError=false"></button>
</div>
}
</div>
</div>
}
</div>
}
</div>
}
</div>
</div>
}
</div>

0 comments on commit cb5f366

Please sign in to comment.