-
Notifications
You must be signed in to change notification settings - Fork 65
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
base: master
Are you sure you want to change the base?
Conversation
…anging Add button visibility for readers
Pull Request Test Coverage Report for Build 12792939964Details
💛 - Coveralls |
core/merginprojectmetadata.h
Outdated
@@ -59,6 +59,8 @@ struct MerginProjectMetadata | |||
{ | |||
QString name; | |||
QString projectNamespace; | |||
QString role; | |||
QList<QString> writersnames; |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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
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(); |
There was a problem hiding this comment.
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
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.Resolves #3174