Skip to content

Commit 969a582

Browse files
committed
Fix the get conact details request
1 parent 359204a commit 969a582

2 files changed

Lines changed: 16 additions & 2 deletions

File tree

API.Test/MessagesTests.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,20 @@ public void GetStaffFilters()
102102
Assert.Fail();
103103
}
104104

105+
[Test]
106+
public void GetSearchedStaffPeople()
107+
{
108+
Client.LoginAsync(s_Server, s_LoginName, s_UserName, s_Password).Wait();
109+
110+
Task<MessagePerson[]> filters = Client.GetStaffFilterSearchResultAsync("", new());
111+
filters.Wait();
112+
113+
if (filters.Result.Length > 0)
114+
Assert.Pass();
115+
else
116+
Assert.Fail();
117+
}
118+
105119
[Test]
106120
public void GetDrafts()
107121
{

WebUntisAPI.Client/WebUntisclient.Profile.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -230,14 +230,14 @@ public async Task<GeneralAccount> GetGenerallyAccountInformationAsync(Cancellati
230230
/// <exception cref="HttpRequestException">Thrown when an error happened while the http request</exception>
231231
public async Task<(ContactDetails contact, bool canRead, bool canWrite)> GetContactDetailsAsync(CancellationToken ct = default)
232232
{
233-
string responseString = await MakeAPIGetRequestAsync($"/WebUntis/api/profile/contactdetails?personId={User.Id}&isRequestForStudent={UserType is Client.UserType.Student}", ct);
233+
string responseString = await MakeAPIGetRequestAsync($"/WebUntis/api/profile/contactdetails?personId={User.Id}&isRequestForStudent=false", ct);
234234
JObject data = JObject.Parse(responseString)["data"].Value<JObject>();
235235

236236
if (!data["read"].Value<bool>()) // Return null when you do not have a read permission
237237
return (null, false, data["write"].Value<bool>());
238238

239239
ContactDetails contact = data["address"].ToObject<ContactDetails>();
240-
return (contact, true, data["write"].Value<bool>());
240+
return (contact, data["read"].Value<bool>(), data["write"].Value<bool>());
241241
}
242242

243243
/// <summary>

0 commit comments

Comments
 (0)