Fix Posting and cleanup

- Fix posting not showing the new post
- Remove console.logs
master
trivernis 5 years ago
parent a87236cebe
commit a4f6f9e4f7

@ -51,7 +51,6 @@ export class ChatmanagerComponent implements OnInit {
refresh() {
this.chatService.getAllChatsRaw()
.subscribe(response => {
console.log(response);
this.parentChats = this.chatService.renderAllChats(response.json());
});
}

@ -39,7 +39,6 @@ export class FeedComponent implements OnInit {
}
ngOnInit() {
console.log('init feedcomponent');
this.data.currentUserInfo.subscribe(user => {
this.user = user;
this.loggedIn = user.loggedIn;
@ -67,7 +66,10 @@ export class FeedComponent implements OnInit {
this.feedService.createPostActivity(postElement.value, activityId).subscribe(() => {
postElement.value = '';
this.textInputValue = '';
this.view = 'new';
this.checked = false;
if (this.view !== 'new') {
this.showNew();
}
}, (error: IErrorResponse) => {
this.errorOccurred = true;
this.errorMessage = error.error.errors[0].message;
@ -76,7 +78,10 @@ export class FeedComponent implements OnInit {
this.feedService.createPost(postElement.value).subscribe(() => {
postElement.value = '';
this.textInputValue = '';
this.view = 'new';
this.checked = false;
if (this.view !== 'new') {
this.showNew();
}
}, (error: IErrorResponse) => {
this.errorOccurred = true;
this.errorMessage = error.error.errors[0].message;
@ -95,6 +100,7 @@ export class FeedComponent implements OnInit {
* Shows the feed sorted by new
*/
showNew() {
this.view = 'new';
this.feedService.getPosts(Sort.NEW);
}
@ -102,6 +108,7 @@ export class FeedComponent implements OnInit {
* Shows the feed sorted by top
*/
showMostLiked() {
this.view = 'mostliked';
this.feedService.getPosts(Sort.TOP);
}

@ -32,8 +32,6 @@ export class DialogCreateEventComponent {
name = name.trim();
if (name && date && time) {
date = date + ' ' + time;
console.log(date);
console.log(new Date(date).getTime().toString());
this.group.createEvent(name, (new Date(date)).getTime().toString(), this.groupId);
this.dialogRef.close();
}
@ -69,7 +67,6 @@ export class GroupComponent implements OnInit {
const possibleID = this.router.url.substr(this.router.url.lastIndexOf('/') + 1);
if (this.id !== possibleID && this.id && this.router.url.includes('group/')) {
// reload the group
console.log('search for group id: ' + this.router.url.substr(this.router.url.lastIndexOf('/') + 1));
this.ngOnInit();
}
}

@ -121,7 +121,6 @@ export class MainNavigationComponent implements OnInit {
}`
};
this.http.post(url, body).subscribe(response => {
console.log(response.text());
});
this.loggedIn = false;
const user = new User();
@ -131,12 +130,10 @@ export class MainNavigationComponent implements OnInit {
}
acceptRequest(id: number) {
console.log('try to accept request from id: ' + id);
const headers = new Headers();
headers.set('Content-Type', 'application/json');
this.http.post(environment.graphQLUrl, this.requestservice.buildJsonAcceptRequest(id))
.subscribe(response => {
console.log(response);
for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);
@ -151,7 +148,6 @@ export class MainNavigationComponent implements OnInit {
headers.set('Content-Type', 'application/json');
this.http.post(environment.graphQLUrl, this.requestservice.buildJsonDenyRequest(id))
.subscribe(response => {
console.log(response);
for (let i = 0; i < this.user.receivedRequests.length; i++) {
if (this.user.receivedRequests[i].senderUserID === id) {
this.user.receivedRequests.splice(i, 1);

@ -54,7 +54,7 @@ export class DialogFileUploadComponent {
}, (error) => {
this.uploading = false;
this.errorOccurred = true;
console.log(error);
console.error(error);
if (error.error) {
this.errorMessage = error.error.error;
} else {

@ -60,7 +60,6 @@ export class ProfileComponent implements OnInit {
this.userProfile = response;
// tslint:disable-next-line:max-line-length
this.userProfile.allowedToSendRequest = this.requestService.isAllowedToSendRequest(this.userProfile.userID, this.self);
console.log(this.userProfile.allowedToSendRequest);
this.ownProfile = this.userProfile.userID === this.self.userID;
this.rankname = this.levellist.getLevelName(this.userProfile.level);
} else {

@ -44,8 +44,6 @@ export class SearchComponent implements OnInit {
if (this.category === 'user') {
this.loading = true;
this.findUser(searchWord);
} else if (this.category === 'groupe') {
console.log('search group');
}
}
}

@ -163,7 +163,7 @@ export class FeedService extends BaseService {
.pipe(tap(response => {
if (this.activePostList === Sort.NEW) {
const updatedPosts = this.posts.getValue();
updatedPosts.push(this.constructPost(response));
updatedPosts.unshift(this.constructPost(response));
this.posts.next(updatedPosts);
}
}));

@ -26,7 +26,6 @@ export class RegisterService {
return this.http.post(url, this.buildJson(registration))
.subscribe(response => {
console.log(response.text());
this.registerSuccess();
this.updateUserInfo(response.json());
}, errorCb
@ -34,8 +33,6 @@ export class RegisterService {
}
public registerSuccess() {
console.log('alles supi dupi');
// do routing
this.router.navigateByUrl('');
}

@ -20,9 +20,7 @@ export class SettingsService {
const headers = new Headers();
headers.set('Content-Type', 'application/json');
const body = this.buildJsonDarkMode('darkmode: ' + '\'' + active + '\'');
this.http.post(url, body).subscribe(response => {
console.log(response.text());
});
this.http.post(url, body).subscribe();
}
public buildJsonDarkMode(setting_: string): any {

Loading…
Cancel
Save