Skip to content

Commit

Permalink
Add the maximun number of contributor in the dialog like in the plugin
Browse files Browse the repository at this point in the history
  • Loading branch information
ValentinBuira committed Nov 25, 2024
1 parent 7755a68 commit a87025b
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 4 deletions.
4 changes: 3 additions & 1 deletion app/qml/dialogs/MMMonthlyContributorsLimitDialog.qml
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ import "../components" as MMComponents
MMComponents.MMDrawerDialog {
id: root

property int contributorsQuota

signal manageAccountClicked()

title: qsTr( "You've reached the maximum number of active monthly contributors for your current subscription." )
title: qsTr( "You've reached the maximum number of active monthly contributors (%1) for your current subscription." ).arg( contributorsQuota )
imageSource: __style.reachedMonthlyContributorLimitImage

description: qsTr( "Upgrade your subscription or wait until next month for the limit to reset." )
Expand Down
3 changes: 2 additions & 1 deletion app/qml/main.qml
Original file line number Diff line number Diff line change
Expand Up @@ -901,7 +901,8 @@ ApplicationWindow {
storageLimitDialog.open()
}

function onMonthlyContributorLimitReached( uploadSize ) {
function onMonthlyContributorLimitReached( quota, serverMsg ) {
monthlyContributorsLimitDialog.contributorsQuota = quota
monthlyContributorsLimitDialog.open()
}

Expand Down
6 changes: 5 additions & 1 deletion core/merginapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2145,7 +2145,11 @@ void MerginApi::pushStartReplyFinished()
}
else if ( EnumHelper::isEqual( code, ErrorCode::MonthlyContributorsLimitHit ) )
{
emit monthlyContributorLimitReached( serverMsg );
int quota = 0;
QVariant maximunMonthlyContributor = extractServerErrorValue( data, "projects_quota" );
if ( maximunMonthlyContributor.isValid() )
quota = maximunMonthlyContributor.toInt();
emit monthlyContributorLimitReached( quota, serverMsg );
}
else
{
Expand Down
2 changes: 1 addition & 1 deletion core/merginapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -598,7 +598,7 @@ class MerginApi: public QObject
);

void storageLimitReached( qreal uploadSize );
void monthlyContributorLimitReached( const QString &message );
void monthlyContributorLimitReached( int contributorsQuota, const QString &message );
void projectLimitReached( int maxProjects, const QString &message );
void migrationRequested( const QString &version );
void notifySuccess( const QString &message );
Expand Down
2 changes: 2 additions & 0 deletions gallery/qml/pages/DrawerPage.qml
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,8 @@ Page {
MMMonthlyContributorsLimitDialog {
id: monthlyContributorsLimitDialog

contributorsQuota: 15

onPrimaryButtonClicked: {
console.log("Manage workspace clicked")
}
Expand Down

1 comment on commit a87025b

@inputapp-bot
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iOS - version 24.11.696111 just submitted!

Please sign in to comment.