Merge branch 'master' of Software_Engineering_I/greenvironment-frontend into max_dev

master
Max_ES 5 years ago committed by Gitea
commit 5b2b5c0936

@ -66,7 +66,7 @@ export class MainNavigationComponent implements OnInit {
this.loggedIn = user.loggedIn;
this.userId = user.userID;
this.username = user.username;
this.level = this.levellist.getLevelName(user.level);
this.level = user.levelName;
this.points = user.points;
this.profileUrl = '/profile/' + this.userId;
if (this.user.darkmode === true && this.lighttheme) {

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

@ -1,16 +1,17 @@
import {Levellist} from 'src/app/models/levellist';
export class FriendInfo {
levellist: Levellist = new Levellist();
id: number;
name: string;
rankname: string;
rankname = 'Rookie';
profilePicture: string;
constructor(pId: number, pName: string, pLevel: number, pic: string) {
this.id = pId;
this.name = pName;
this.rankname = this.levellist.getLevelName(pLevel);
constructor(id: number, name: string, level: {name: string}, pic: string) {
this.id = id;
this.name = name;
if (level) {
this.rankname = level.name;
}
this.profilePicture = pic;
}
}

@ -16,7 +16,7 @@ export interface IUser {
settings?: string;
level: number;
level: {name: string, levelNumber: number};
points: number;

@ -12,7 +12,8 @@ export class User {
handle: string;
email: string;
points: number;
level: number;
level = 0;
levelName = 'Rookie';
profilePicture: string;
joinedAt: string;
friendCount: number;
@ -36,7 +37,10 @@ export class User {
this.handle = userDataResponse.handle;
this.email = userDataResponse.email;
this.points = userDataResponse.points;
this.level = userDataResponse.level;
if (userDataResponse.level) {
this.level = userDataResponse.level.levelNumber;
this.levelName = userDataResponse.level.name;
}
this.profilePicture = this.buildProfilePictureUrl(userDataResponse.profilePicture);
this.joinedAt = userDataResponse.joinedAt;
this.friendCount = userDataResponse.friendCount;

@ -105,7 +105,7 @@ export class ChatService {
for (const chat of temp.data.getSelf.chats) {
let memberID: number;
let memberName: string;
let memberLevel: number;
let memberLevel: {name: string, levelNumber: number};
let profilePicture: string;
for (const member of chat.members) {
if (member.id !== this.ownID) {
@ -226,7 +226,7 @@ export class ChatService {
const body = {
query: `query {
getSelf {
chats(first: 1000, offset: 0) {members{name, id, level}}
chats(first: 1000, offset: 0) {members{name, id, level {name levelNumber}}}
}}`
};
@ -251,7 +251,7 @@ export class ChatService {
query: `query {
getSelf {
chats(first: 10, offset: 0) {
id, members{name, id, level},
id, members{name, id, level {name levelNumber}},
messages(first: 10, offset: 0) {
author {id}, createdAt, content
}
@ -265,7 +265,7 @@ export class ChatService {
getBodyForGetChatsByID(pChatID: number) {
const body = {
query: `query($chatID: ID!) {
getChat(chatId: $chatID) {id, members{name, id, level},
getChat(chatId: $chatID) {id, members{name, id, level {name levelNumber}},
messages(first: 1000, offset: 0) {author {id}, createdAt, content}}
}
}`, variables: {

@ -21,14 +21,20 @@ const graphqlQuery = `mutation($email: String!, $pwHash: String!) {
email,
handle,
points,
level,
level {
name
levelNumber
},
profilePicture,
receivedRequests{id, sender{name, handle, id}},
sentRequests{receiver{id}},
friends {
id,
name,
level,
level {
name
levelNumber
},
profilePicture
},
groups {

@ -16,7 +16,10 @@ const graphqlGetProfileQuery = `query($userId: ID) {
name
profilePicture
points
level
level {
name
levelNumber
}
friendCount
groupCount
joinedAt

@ -77,13 +77,19 @@ export class RegisterService {
name,
handle,
points,
level,
level {
name
levelNumber
},
receivedRequests{id, sender{name, handle, id}},
sentRequests{receiver{id}}
friends {
id,
name,
level,
level {
name
levelNumber
},
profilePicture
},
groups{id},

@ -23,7 +23,10 @@ const graphqlQuery = `query($query: String!, $first: Int, $offset: Int) {
id,
handle,
points,
level,
level {
name
levelNumber
},
friends {
id
}
@ -77,7 +80,10 @@ export class SearchService extends BaseService {
user.userID = foundUser.id;
user.handle = foundUser.handle;
user.points = foundUser.points;
user.level = foundUser.level;
if (foundUser.level) {
user.level = foundUser.level.levelNumber;
user.levelName = foundUser.level.name;
}
// @ts-ignore
user.friends = foundUser.friends;
users.push(user);

@ -14,14 +14,20 @@ const getSelfGraphqlQuery = `{
email,
handle,
points,
level,
level {
name
levelNumber
},
profilePicture,
receivedRequests{id, sender{name, handle, id}},
sentRequests{receiver{id}},
friends {
id,
name,
level,
level {
name
levelNumber
},
profilePicture,
},
groups {

Loading…
Cancel
Save