Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving UX by hiding editing buttons for readers of a project #3682

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

VitorVieiraZ
Copy link
Contributor

@VitorVieiraZ VitorVieiraZ commented Nov 18, 2024

While in Reader role, editing buttons are no longer visible to user. These buttons include:

Main Add button and the one within the features list.
Add feature button and its variations.
Edit feature button and its variations.
Edit geometry button.

Reader Other Roles

Resolves #3174

Copy link

github-actions bot commented Nov 27, 2024

Pull Request Test Coverage Report for Build 12792939964

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 247 unchanged lines in 5 files lost coverage.
  • Overall coverage decreased (-0.04%) to 60.389%

Files with Coverage Reduction New Missed Lines %
input/core/coreutils.cpp 1 84.66%
input/core/merginprojectmetadata.cpp 3 88.64%
input/app/activeproject.cpp 56 68.66%
input/app/main.cpp 78 33.33%
input/core/merginapi.cpp 109 78.23%
Totals Coverage Status
Change from base Build 12688514540: -0.04%
Covered Lines: 7920
Relevant Lines: 13115

💛 - Coveralls

@VitorVieiraZ VitorVieiraZ changed the title WIP - Improving UX by hiding editing buttons for readers and guests of a project Improving UX by hiding editing buttons for readers and guests of a project Dec 10, 2024
@VitorVieiraZ VitorVieiraZ changed the title Improving UX by hiding editing buttons for readers and guests of a project Improving UX by hiding editing buttons for readers of a project Dec 10, 2024
@@ -59,6 +59,8 @@ struct MerginProjectMetadata
{
QString name;
QString projectNamespace;
QString role;
QList<QString> writersnames;
Copy link
Collaborator

Choose a reason for hiding this comment

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

This should not be needed here

@@ -48,6 +48,8 @@ Item {
function setupProjectOpen( projectPath ) {
if ( projectPath === __activeProject.localProject.qgisProjectFilePath )
{
// update user's role in project ( in case user has changed )
__activeProject.updateUserRoleInActiveProject()
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is giving me qml error, the function is not Q_INVOKABLE

app/activeproject.h Outdated Show resolved Hide resolved
Comment on lines +3462 to +3487
QFile file( metadataPath );
if ( !file.open( QIODevice::ReadOnly ) )
{
return false;
}

QByteArray data = file.readAll();
file.close();

QJsonDocument doc = QJsonDocument::fromJson( data );
if ( !doc.isObject() )
{
return false;
}

QJsonObject obj = doc.object();
obj["role"] = newRole;
doc.setObject( obj );

if ( !file.open( QIODevice::WriteOnly ) )
{
return false;
}

bool success = ( file.write( doc.toJson() ) != -1 );
file.close();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Let's turn this into a CoreUtils::replaceValueInJson method that can then be easily tested. Ideally pass in the name of the key, key value and path to json + autotests

core/merginapi.cpp Outdated Show resolved Hide resolved
core/merginapi.cpp Outdated Show resolved Hide resolved
app/activeproject.cpp Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users unable to sync project after a reader user makes some local changes
3 participants