GSoC-23 Week 1-2 | Adding Account Moderation Tool #3


Hello world,

This is my third blog post for Google Summer of Code 2023 where I will be sharing what I was able to accomplish in the first two weeks.

The first task I worked on was implementing the account moderation tool. This tool enables moderators/admins of an instance to view all the accounts available on the server and take action against them.

Before starting with its implementation, I requested Carl to schedule a meeting so that I could gain a better understanding of the implementation process. He advised me to study the already implemented SocialGraph page, along with other helpful insights.

Initially, when attempting to receive raw JSON data from the /api/v1/admin/accounts endpoint, I encountered a 403 error response. Upon spending some time debugging my code I couldn’t determine what I was doing wrong and so I finally resorted to asking for help in the Tokodon matrix chat, where redstrate❣️ helped me identify that we didn’t have the necessary scope set in Tokodon to access admin endpoints.

After setting the correct scope, I was finally able to make network requests to the admin endpoint 🥳. I decided to implement a QAbstractListModel to expose all the data and required properties in the QML UI. With this in mind, I created a new class AccountsToolModel that inherited from QAbstractListModel. For making all the filter options functional I created QProperty instances with the necessary READ, WRITE and NOTIFY methods.

To display the admin-related information for an account, I parsed the received JSON data and created a new method AbstractAccount::adminIdentityLookup which will populate QProperty instances of AdminAccountInfo to store all the required information for the moderation tool. Once all the cpp backend was ready, I started with the qml implementation, figuring out the best way in which the data can be presented.

Once the UI was implemented, I encountered an issue with pagination not functioning correctly. After debugging the issue, I discovered that when requesting a response for the next page using the v2 endpoint, the response received was actually v1. This discrepancy messed up the query parameters and rendered pagination impossible. To address this issue, I implemented a simple code block: url = url.toString().replace("/v1/", "/v2/");. This replacement fixed the problem and allowed proper pagination to occur.

To ensure the issue was addressed, I reported it on Mastodon’s GitHub repository. You can find the detailed report here.

At the end of the first two weeks the initial page of Account Moderation tool was implemented whose Merge Request can be tracked here. I also made significant progress towards developing next page of the account tool during these weeks.

Images showing implemented Account Moderation tool

An image showing User Interface of Tokodon’s Account Moderation Tool

Next I am working on implementing the second page of account Moderation tool and report Moderation tool :)

I will be writing regular blog posts on my website. You can read my previous blog-posts and follow my progress here