Commit 5feed868 authored by Robert Rudman's avatar Robert Rudman

Give Rodgort read-write access rather than room owner. Pin links to close...

Give Rodgort read-write access rather than room owner. Pin links to close queue/open questions in burn room
parent 079825d9
......@@ -145,7 +145,13 @@ namespace Rodgort.Services
var roomName = $"Burnination progress for the [{tag}] tag";
var roomId = await _chatClient.CreateRoom(ChatSite.StackOverflow, ChatRooms.SO_BOTICS_WORKSHOP, roomName, metaPostUrl, new[] { tag });
await _chatClient.AddRoomOwner(ChatSite.StackOverflow, roomId, ChatUserIds.GEMMY);
await _chatClient.AddWriteAccess(ChatSite.StackOverflow, roomId, ChatUserIds.GEMMY);
var closeQueueLink = UrlTools.BuildUrl("https://stackoverflow.com/review/close/", new Dictionary<string, string> { { "filter-tags", tag } });
var openQuestionsLink = UrlTools.BuildUrl("https://stackoverflow.com/search", new Dictionary<string, string> { { "q", $"[{tag}] is:q closed:no" } });
var burninationMessage = $"[Close Queue]({closeQueueLink}) - [Open questions]({openQuestionsLink}) - [Meta post]({metaPostUrl}) - [Burn room](https://chat.stackoverflow.com/rooms/{roomId}).";
await _chatClient.SendMessageAndPin(ChatSite.StackOverflow, roomId, burninationMessage);
var gemmyMessage = $"@Gemmy start tag [{tag}] {roomId} https://chat.stackoverflow.com/rooms/{roomId}";
......@@ -174,7 +180,7 @@ namespace Rodgort.Services
var roomName = $"Observation room for [{tag}] burnination";
var roomId = await _chatClient.CreateRoom(ChatSite.StackOverflow, ChatRooms.SO_BOTICS_WORKSHOP, roomName, metaPostUrl, new[] { tag });
await _chatClient.AddRoomOwner(ChatSite.StackOverflow, roomId, ChatUserIds.GEMMY);
await _chatClient.AddWriteAccess(ChatSite.StackOverflow, roomId, ChatUserIds.GEMMY);
await _chatClient.SendMessageAndPin(ChatSite.StackOverflow, roomId, $"[Rodgort tag progress](https://rodgort.sobotics.org/progress?metaQuestionId={metaQuestionId})");
......
......@@ -150,6 +150,23 @@ namespace StackExchangeChat
});
}
public async Task AddWriteAccess(ChatSite chatSite, int roomId, int userId)
{
await ThrottlingUtils.Throttle(ChatThrottleGroups.WebRequestThrottle, async () =>
{
var fkey = (await _siteAuthenticator.GetRoomDetails(chatSite, roomId)).FKey;
await _siteAuthenticator.AuthenticateClient(_httpClient, chatSite);
await _httpClient.PostAsync($"https://{chatSite.ChatDomain}/rooms/setuseraccess/${roomId}",
new FormUrlEncodedContent(
new Dictionary<string, string>
{
{"fkey", fkey},
{"userAccess", "read-write"},
{"aclUserId", userId.ToString()},
}));
});
}
public IObservable<ChatEvent> SubscribeToEvents(ChatSite chatSite, int roomId)
{
return Observable.Create<ChatEvent>(async observer =>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment