Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spelling #493

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/app/app.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -160,8 +160,8 @@ export class AppComponent implements OnInit, OnDestroy {
enhancedTutorialActive: boolean;
enhancedTutorialVisible: boolean;
private checkEnhancedTutorial() {
let enhancedTutorialDesactivated = JSON.parse(localStorage.getItem('tutorial'));
if (!this.floatingColumnActive && !this.tutorialActive && !enhancedTutorialDesactivated) {
let enhancedTutorialDeactivated = JSON.parse(localStorage.getItem('tutorial'));
if (!this.floatingColumnActive && !this.tutorialActive && !enhancedTutorialDeactivated) {
setTimeout(() => {
this.enhancedTutorialActive = true;
setTimeout(() => {
Expand Down
4 changes: 2 additions & 2 deletions src/app/app.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import { StreamsState } from "./states/streams.state";
import { StatusComponent } from "./components/stream/status/status.component";
import { MastodonService } from "./services/mastodon.service";
import { MastodonWrapperService } from "./services/mastodon-wrapper.service";
import { AttachementsComponent } from './components/stream/status/attachements/attachements.component';
import { AttachementsComponent } from './components/stream/status/attachments/attachments.component';
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've tried to rename the corresponding files/directories below...

import { SettingsComponent } from './components/floating-column/settings/settings.component';
import { AddNewAccountComponent } from './components/floating-column/add-new-account/add-new-account.component';
import { SearchComponent } from './components/floating-column/search/search.component';
Expand Down Expand Up @@ -82,7 +82,7 @@ import { NotificationComponent } from './components/floating-column/manage-accou
import { ServiceWorkerModule } from '@angular/service-worker';
import { environment } from '../environments/environment';
import { BookmarksComponent } from './components/floating-column/manage-account/bookmarks/bookmarks.component';
import { AttachementImageComponent } from './components/stream/status/attachements/attachement-image/attachement-image.component';
import { AttachementImageComponent } from './components/stream/status/attachments/attachment-image/attachment-image.component';
import { EnsureHttpsPipe } from './pipes/ensure-https.pipe';
import { UserFollowsComponent } from './components/stream/user-follows/user-follows.component';
import { AccountComponent } from './components/common/account/account.component';
Expand Down
4 changes: 2 additions & 2 deletions src/app/components/common/timeline-base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export abstract class TimelineBase extends BrowseBase {
statuses: StatusWrapper[] = [];
bufferStream: Status[] = [];
protected bufferWasCleared: boolean;
streamPositionnedAtTop: boolean = true;
streamPositionedAtTop: boolean = true;
protected isProcessingInfiniteScroll: boolean;

protected hideBoosts: boolean;
Expand Down Expand Up @@ -59,7 +59,7 @@ export abstract class TimelineBase extends BrowseBase {
const atBottom = element.scrollHeight <= element.clientHeight + element.scrollTop + 1000;
const atTop = element.scrollTop === 0;

this.streamPositionnedAtTop = false;
this.streamPositionedAtTop = false;
if (atBottom && !this.isProcessingInfiniteScroll) {
this.scrolledToBottom();
} else if (atTop) {
Expand Down
24 changes: 12 additions & 12 deletions src/app/components/create-status/create-status.component.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ describe('CreateStatusComponent', () => {
expect(result.length).toBe(1);
});

it('should cound URL correctly', () => {
it('should count URL correctly', () => {
const newLine = String.fromCharCode(13, 10);
const status = `qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd https://google.com/testqsdqsdqsdqsdqsdqsdqsdqdqsdqsdqsdqsdqs dsqd qsd qsd dsqdqs dqs dqsd qsd qsd qsd qsd qsd qs dqsdsq qsd qsd qs dsqds qqs d dqs dqs dqs dqqsd qsd qsd qsd sqd qsd qsd sqd qds dsqd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s`;

Expand All @@ -173,15 +173,15 @@ describe('CreateStatusComponent', () => {
expect((<any>component).charCountLeft).toBe(0);
});

it('should cound URL correctly - new lines', () => {
it('should count URL correctly - new lines', () => {
const status = `qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd\nhttps://google.com/testqsdqsdqsdqsdqsdqsdqsdqdqsdqsdqsdqsdqs\ndsqd qsd qsd dsqdqs dqs dqsd qsd qsd qsd qsd qsd qs dqsdsq qsd qsd qs dsqds qqs d dqs dqs dqs dqqsd qsd qsd qsd sqd qsd qsd sqd qds dsqd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s`;

(<any>component).maxCharLength = 500;
(<any>component).countStatusChar(status);
expect((<any>component).charCountLeft).toBe(0);
});

it('should cound URL correctly - dual post', () => {
it('should count URL correctly - dual post', () => {
const status = `qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd https://google.com/testqsdqsdqsdqsdqsdqsdqsdqdqsdqsdqsdqsdqs dsqd qsd qsd dsqdqs dqs dqsd qsd qsd qsd qsd qsd qs dqsdsq qsd qsd qs dsqds qqs d dqs dqs dqs dqqsd qsd qsd qsd sqd qsd qsd sqd qds dsqd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsdd dqsd qs s`;

(<any>component).maxCharLength = 512;
Expand All @@ -190,7 +190,7 @@ describe('CreateStatusComponent', () => {
expect((<any>component).postCounts).toBe(2);
});

it('should cound URL correctly - triple post', () => {
it('should count URL correctly - triple post', () => {
const status = `qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd https://google.com/testqsdqsdqsdqsdqsdqsdqsdqdqsdqsdqsdqsdqs dsqd qsd qsd dsqdqs dqs dqsd qsd qsd qsd qsd qsd qs dqsdsq qsd qsd qs dsqds qqs d dqs dqs dqs dqqsd qsd qsd qsd sqd qsd qsd sqd qds dsqd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd qsd qsd qs dqsd qsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsd qsd qsddq sqd qsd qsdqs dqsd qsd qsd qsd qsd qsd qsd dsqd qsd qsd dsqdqs fqd dsq sq dsq qsd q qsd qsd qs dqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsdd dqsd qs s dsqs sd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsdd dqsd qs s dsqs sd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsdd dqsd qs s dsqs sd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsqs dqs qsd qsd qss sq ss s dqsd qsd sqd qsqsd qsd qsdd dqsd qs s dsqs sd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd qs qsd qsd qsd qsd sqd qsd qsd sqd qsd qsd qsd qsd qsd qsd qsd qsd qsd qsd sd`;

(<any>component).maxCharLength = 512;
Expand Down Expand Up @@ -231,31 +231,31 @@ describe('CreateStatusComponent', () => {
expect(result[1]).toBe('http://www.joelonsoftware.com/2003/10/08/the-absolute-minimum-every-software-developer-absolutely-positively-must-know-about-unicode-and-character-sets-no-excuses/');
});

it('should tranform external mentions properly - mastodon', () => {
it('should transform external mentions properly - mastodon', () => {
let mastodonMention = '<p>test <span class="h-card"><a href="https://mastodon.social/@sengi_app" class="u-url mention">@<span>sengi_app</span></a></span> qsdqds qsd qsd qsd q <span class="h-card"><a href="https://mastodon.social/@test" class="u-url mention">@<span>test</span></a></span> <span class="h-card"><a href="https://mastodon.social/@no" class="u-url">@<span>no</span></a></span></p>';

const result = <string>(<any>component).tranformHtmlRepliesToReplies(mastodonMention);
const result = <string>(<any>component).transformHtmlRepliesToReplies(mastodonMention);
expect(result).toBe('<p>test @sengi_app@mastodon.social qsdqds qsd qsd qsd q @test@mastodon.social <span class="h-card"><a href="https://mastodon.social/@no" class="u-url">@<span>no</span></a></span></p>');
});

it('should tranform external mentions properly - mastodon 2', () => {
it('should transform external mentions properly - mastodon 2', () => {
let mastodonMention = '<p>test <span class="h-card"><a href="https://pleroma.site/users/sengi_app" class="u-url mention">@<span>sengi_app</span></a></span> qsdqds qsd qsd qsd q <span class="h-card"><a href="https://pleroma.site/users/test" class="u-url mention">@<span>test</span></a></span> <span class="h-card"><a href="https://pleroma.site/users/no" class="u-url">@<span>no</span></a></span></p>';

const result = <string>(<any>component).tranformHtmlRepliesToReplies(mastodonMention);
const result = <string>(<any>component).transformHtmlRepliesToReplies(mastodonMention);
expect(result).toBe('<p>test @sengi_app@pleroma.site qsdqds qsd qsd qsd q @test@pleroma.site <span class="h-card"><a href="https://pleroma.site/users/no" class="u-url">@<span>no</span></a></span></p>');
});

it('should tranform external mentions properly - pleroma', () => {
it('should transform external mentions properly - pleroma', () => {
let pleromaMention = '<p>test <span class="h-card"><a data-user="50504" class="u-url mention" href="https://mastodon.social/@sengi_app" rel="ugc">@<span>sengi_app</span></a></span> qsdqds qsd qsd qsd q <span class="h-card"><a data-user="50504" class="u-url mention" href="https://mastodon.social/@test" rel="ugc">@<span>test</span></a></span> <span class="h-card"><a href="https://mastodon.social/@no" class="u-url">@<span>no</span></a></span></p>';

const result = <string>(<any>component).tranformHtmlRepliesToReplies(pleromaMention);
const result = <string>(<any>component).transformHtmlRepliesToReplies(pleromaMention);
expect(result).toBe('<p>test @sengi_app@mastodon.social qsdqds qsd qsd qsd q @test@mastodon.social <span class="h-card"><a href="https://mastodon.social/@no" class="u-url">@<span>no</span></a></span></p>');
});

it('should tranform external mentions properly - pleroma 2', () => {
it('should transform external mentions properly - pleroma 2', () => {
let pleromaMention = '<p>test <span class="h-card"><a data-user="50504" class="u-url mention" href="https://pleroma.site/users/sengi_app" rel="ugc">@<span>sengi_app</span></a></span> qsdqds qsd qsd qsd q <span class="h-card"><a data-user="50504" class="u-url mention" href="https://pleroma.site/users/test" rel="ugc">@<span>test</span></a></span> <span class="h-card"><a href="https://pleroma.site/users/no" class="u-url">@<span>no</span></a></span></p>';

const result = <string>(<any>component).tranformHtmlRepliesToReplies(pleromaMention);
const result = <string>(<any>component).transformHtmlRepliesToReplies(pleromaMention);
expect(result).toBe('<p>test @sengi_app@pleroma.site qsdqds qsd qsd qsd q @test@pleroma.site <span class="h-card"><a href="https://pleroma.site/users/no" class="u-url">@<span>no</span></a></span></p>');
});

Expand Down
24 changes: 12 additions & 12 deletions src/app/components/create-status/create-status.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
const newLine = String.fromCharCode(13, 10);
let content = value.status.content;

content = this.tranformHtmlRepliesToReplies(content);
content = this.transformHtmlRepliesToReplies(content);

while (content.includes('<p>') || content.includes('</p>') || content.includes('<br>') || content.includes('<br/>') || content.includes('<br />')) {
content = content.replace('<p>', '').replace('</p>', newLine + newLine).replace('<br />', newLine).replace('<br/>', newLine).replace('<br>', newLine);
Expand Down Expand Up @@ -294,10 +294,10 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
const lastChar = status.substr(caretPosition - 1, 1);
const lastCharIsSpace = lastChar === ' ';

const splitedStatus = status.split(/(\r\n|\n|\r)/);
const splitStatus = status.split(/(\r\n|\n|\r)/);
let offset = 0;
let currentSection = '';
for (let x of splitedStatus) {
for (let x of splitStatus) {
const sectionLength = x.length;
if (offset + sectionLength >= caretPosition) {
currentSection = x;
Expand Down Expand Up @@ -640,7 +640,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {

let mentionExtraChars = this.getMentionExtraChars(status);
let urlExtraChar = this.getLinksExtraChars(status);
let trucatedStatus = `${status}`;
let truncatedStatus = `${status}`;
let results = [];

let aggregateMention = '';
Expand All @@ -652,23 +652,23 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
let currentMaxCharLength = this.maxCharLength + mentionExtraChars + urlExtraChar - this.getCwLength();
let maxChars = currentMaxCharLength - 6;

while (trucatedStatus.length > currentMaxCharLength) {
const nextIndex = trucatedStatus.lastIndexOf(' ', maxChars);
while (truncatedStatus.length > currentMaxCharLength) {
const nextIndex = truncatedStatus.lastIndexOf(' ', maxChars);

if(nextIndex === -1){
break;
}

results.push(trucatedStatus.substr(0, nextIndex) + ' (...)');
trucatedStatus = aggregateMention + trucatedStatus.substr(nextIndex + 1);
results.push(truncatedStatus.substr(0, nextIndex) + ' (...)');
truncatedStatus = aggregateMention + truncatedStatus.substr(nextIndex + 1);

// Refresh max
let mentionExtraChars = this.getMentionExtraChars(trucatedStatus);
let urlExtraChar = this.getLinksExtraChars(trucatedStatus);
let mentionExtraChars = this.getMentionExtraChars(truncatedStatus);
let urlExtraChar = this.getLinksExtraChars(truncatedStatus);
currentMaxCharLength = this.maxCharLength + mentionExtraChars + urlExtraChar - this.getCwLength();
maxChars = currentMaxCharLength - 6;
}
results.push(trucatedStatus);
results.push(truncatedStatus);
return results;
}

Expand Down Expand Up @@ -930,7 +930,7 @@ export class CreateStatusComponent implements OnInit, OnDestroy {
return false;
}

private tranformHtmlRepliesToReplies(data: string): string {
private transformHtmlRepliesToReplies(data: string): string {
const mastodonMentionRegex = /<span class="h-card"><a href="https:\/\/([a-zA-Z0-9.]{0,255})\/[a-zA-Z0-9_@/-]{0,255}" class="u-url mention">@<span>([a-zA-Z0-9_-]{0,255})<\/span><\/a><\/span>/gmi;
const pleromaMentionRegex = /<span class="h-card"><a data-user="[a-zA-Z0-9]{0,255}" class="u-url mention" href="https:\/\/([a-zA-Z0-9.]{0,255})\/[a-zA-Z0-9_@/-]{0,255}" rel="ugc">@<span>([a-zA-Z0-9_-]{0,255})<\/span><\/a><\/span>/gmi;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<div class="poll-editor__entries">
<div *ngFor="let e of entries">
<app-poll-entry class="poll-editor__entry" [entry]="e" (removeEvent)="removeElement(e)"
(toogleMultiEvent)="toogleMulti()"></app-poll-entry>
(toggleMultiEvent)="toggleMulti()"></app-poll-entry>
</div>
</div>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class PollEditorComponent implements OnInit {
this.entries = this.entries.filter(x => x.id != entry.id);
}

toogleMulti() {
toggleMulti() {
this.multiSelected = !this.multiSelected;
this.entries.forEach((e: PollEntry) => {
e.isMulti = this.multiSelected;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</a>
</div>
<div class="poll-entry__multi">
<a href (click)="toogleMulti()" class="poll-entry__multi--link">
<a href (click)="toggleMulti()" class="poll-entry__multi--link">
<span class="check-mark" [class.check-mark__round]="!entry.isMulti" [class.check-mark__box]="entry.isMulti">
</span>
</a>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export class PollEntryComponent implements OnInit {
@Input() entry: PollEntry;

@Output() removeEvent = new EventEmitter();
@Output() toogleMultiEvent = new EventEmitter();
@Output() toggleMultiEvent = new EventEmitter();

constructor() { }

Expand All @@ -24,8 +24,8 @@ export class PollEntryComponent implements OnInit {
return false;
}

toogleMulti(): boolean {
this.toogleMultiEvent.next();
toggleMulti(): boolean {
this.toggleMultiEvent.next();
return false;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ export class AddNewAccountComponent implements OnInit {
} else if ((<Error>err).message === 'CORS') {
this.notificationService.notify(null, null, 'Connection Error. It\'s usually a CORS issue with the server you\'re connecting to. Please check in the console and if so, contact your administrator with those informations.', true);
} else {
this.notificationService.notify(null, null, 'Unkown error', true);
this.notificationService.notify(null, null, 'Unknown error', true);
}
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
color: $boost-color;
}

$acccount-info-left: 70px;
$account-info-left: 70px;
.follow-account {
padding: 5px;
height: 60px;
Expand All @@ -67,7 +67,7 @@ $acccount-info-left: 70px;
&__display-name {
position: absolute;
top: 7px;
left: $acccount-info-left;
left: $account-info-left;
color: whitesmoke;
}

Expand All @@ -78,21 +78,21 @@ $acccount-info-left: 70px;
&__acct {
position: absolute;
top: 27px;
left: $acccount-info-left;
left: $account-info-left;
font-size: 13px;
color: $status-links-color;

white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;

width: calc(100% - #{$acccount-info-left});
width: calc(100% - #{$account-info-left});
}
}

.follow_request {
width: calc(100% - #{$acccount-info-left});
margin-left: $acccount-info-left;
width: calc(100% - #{$account-info-left});
margin-left: $account-info-left;

&__link {
display: inline-block;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,11 @@
// border-radius: 2px;
// }

// $acccount-info-left: 70px;
// $account-info-left: 70px;
// &__display-name {
// position: absolute;
// top: 7px;
// left: $acccount-info-left;
// left: $account-info-left;
// color: whitesmoke;
// }

Expand All @@ -84,7 +84,7 @@
// &__acct {
// position: absolute;
// top: 27px;
// left: $acccount-info-left;
// left: $account-info-left;
// font-size: 13px;
// color: $status-links-color;
// }
Expand Down
Loading