Merge pull request #349 from NicolasConstant/develop

1.0.3 PR
This commit is contained in:
Nicolas Constant 2021-01-21 04:18:01 +01:00 committed by GitHub
commit f152a3dc6f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 14 additions and 47 deletions

View File

@ -1,6 +1,6 @@
{
"name": "sengi",
"version": "1.0.2",
"version": "1.0.3",
"license": "AGPL-3.0-or-later",
"main": "main-electron.js",
"description": "A multi-account desktop client for Mastodon and Pleroma",

View File

@ -150,7 +150,8 @@
min-height: 80px;
display: block;
margin: 0 10px 0 $avatar-column-space;
padding: 3px 5px 12px 5px;
padding: 3px 5px 14px 5px;
overflow-wrap: break-word;
text-decoration: none;
text-align: center;

View File

@ -100,54 +100,20 @@ export class StatusComponent implements OnInit {
ngOnInit() {
}
// private checkContentWarning(status: Status) {
// let cwPolicy = this.toolsService.getSettings().contentWarningPolicy;
// let splittedContent = [];
// if ((cwPolicy.policy === ContentWarningPolicyEnum.HideAll && cwPolicy.addCwOnContent.length > 0)
// || (cwPolicy.policy === ContentWarningPolicyEnum.AddOnAllContent && cwPolicy.removeCwOnContent.length > 0)
// || (cwPolicy.hideCompletlyContent && cwPolicy.hideCompletlyContent.length > 0)) {
// let parser = new DOMParser();
// let dom = parser.parseFromString((status.content + ' ' + status.spoiler_text).replace("<br/>", " ").replace("<br>", " ").replace(/\n/g, ' '), 'text/html')
// let contentToParse = dom.body.textContent;
// splittedContent = contentToParse.toLowerCase().split(' ');
// }
// if (cwPolicy.policy === ContentWarningPolicyEnum.None && (status.sensitive || status.spoiler_text)) {
// this.setContentWarning(status);
// } else if (cwPolicy.policy === ContentWarningPolicyEnum.HideAll) {
// let detected = cwPolicy.addCwOnContent.filter(x => splittedContent.find(y => y == x || y == `#${x}`));
// if (!detected || detected.length === 0) {
// this.status.sensitive = false;
// } else {
// if (!status.spoiler_text) {
// status.spoiler_text = detected.join(' ');
// }
// this.setContentWarning(status);
// }
// } else if (cwPolicy.policy === ContentWarningPolicyEnum.AddOnAllContent) {
// let detected = cwPolicy.removeCwOnContent.filter(x => splittedContent.find(y => y == x || y == `#${x}`));
// if (detected && detected.length > 0) {
// this.status.sensitive = false;
// } else {
// this.setContentWarning(status);
// }
// }
// if (cwPolicy.hideCompletlyContent && cwPolicy.hideCompletlyContent.length > 0) {
// let detected = cwPolicy.hideCompletlyContent.filter(x => splittedContent.find(y => y == x || y == `#${x}`));
// if (detected && detected.length > 0) {
// this.hideStatus = true;
// }
// }
// }
private setContentWarning(status: StatusWrapper) {
this.hideStatus = status.hide;
this.isContentWarned = status.applyCw;
this.contentWarningText = this.emojiConverter.applyEmojis(this.displayedStatus.emojis, status.status.spoiler_text, EmojiTypeEnum.medium);
let spoiler = this.htmlEncode(status.status.spoiler_text);
this.contentWarningText = this.emojiConverter.applyEmojis(this.displayedStatus.emojis, spoiler, EmojiTypeEnum.medium);
}
private htmlEncode(str: string): string {
var encodedStr = str.replace(/[\u00A0-\u9999<>\&]/gim, function (i) {
return '&#' + i.charCodeAt(0) + ';';
});
return encodedStr;
}
removeContentWarning(): boolean {