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() { refresh() {
this.chatService.getAllChatsRaw() this.chatService.getAllChatsRaw()
.subscribe(response => { .subscribe(response => {
console.log(response);
this.parentChats = this.chatService.renderAllChats(response.json()); this.parentChats = this.chatService.renderAllChats(response.json());
}); });
} }

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

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

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

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

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

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

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

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

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

Loading…
Cancel
Save