- Simplified repository creation, offer simple README generation, and insertion of a pre-defined .gitignore file (ticket-76)
- Added an extension point for monitoring onStartup and onShutdown (ticket-79)
- Tag server-side merges when incremental push tags are enabled (issue-432, ticket-85)
+ - Add a user preference for the clone transport (ticket-90)
- Add setting to control default thread pool size for miscellaneous background tasks (ticket-92)
dependencyChanges:
- Update to javax.mail 1.5.1 (issue-417, ticket-58)
\r
import com.gitblit.Constants.AccessPermission;\r
import com.gitblit.Constants.AccountType;\r
+import com.gitblit.Constants.Transport;\r
import com.gitblit.manager.IRuntimeManager;\r
import com.gitblit.models.TeamModel;\r
import com.gitblit.models.UserModel;\r
\r
private static final String EMAILONMYTICKETCHANGES = "emailMeOnMyTicketChanges";\r
\r
+ private static final String TRANSPORT = "transport";\r
+\r
private static final String ACCOUNTTYPE = "accountType";\r
\r
private static final String DISABLED = "disabled";\r
String val = model.getPreferences().getLocale().getLanguage() + "_" + model.getPreferences().getLocale().getCountry();\r
config.setString(USER, model.username, LOCALE, val);\r
}\r
+\r
config.setBoolean(USER, model.username, EMAILONMYTICKETCHANGES, model.getPreferences().isEmailMeOnMyTicketChanges());\r
+\r
+ if (model.getPreferences().getTransport() != null) {\r
+ config.setString(USER, model.username, TRANSPORT, model.getPreferences().getTransport().name());\r
+ }\r
}\r
\r
// user roles\r
// preferences\r
user.getPreferences().setLocale(config.getString(USER, username, LOCALE));\r
user.getPreferences().setEmailMeOnMyTicketChanges(config.getBoolean(USER, username, EMAILONMYTICKETCHANGES, true));\r
+ user.getPreferences().setTransport(Transport.fromString(config.getString(USER, username, TRANSPORT)));\r
\r
// user roles\r
Set<String> roles = new HashSet<String>(Arrays.asList(config.getStringList(\r
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet;
+import java.util.Iterator;
import java.util.List;
import java.util.Set;
}
});
+ // consider the user's transport preference
+ RepositoryUrl preferredUrl = null;
+ Transport preferredTransport = user.getPreferences().getTransport();
+ if (preferredTransport != null) {
+ Iterator<RepositoryUrl> itr = list.iterator();
+ while (itr.hasNext()) {
+ RepositoryUrl url = itr.next();
+ if (url.transport.equals(preferredTransport)) {
+ itr.remove();
+ preferredUrl = url;
+ break;
+ }
+ }
+ }
+ if (preferredUrl != null) {
+ list.add(0, preferredUrl);
+ }
+
return list;
}
import java.util.Map;
import java.util.TreeMap;
+import com.gitblit.Constants.Transport;
import com.gitblit.utils.StringUtils;
/**
private Boolean emailMeOnMyTicketChanges;
+ private Transport transport;
+
private final Map<String, UserRepositoryPreferences> repositoryPreferences = new TreeMap<String, UserRepositoryPreferences>();
public UserPreferences(String username) {
public void setEmailMeOnMyTicketChanges(boolean value) {
this.emailMeOnMyTicketChanges = value;
}
+
+ public Transport getTransport() {
+ return transport;
+ }
+
+ public void setTransport(Transport transport) {
+ this.transport = transport;
+ }
}
gb.comment = Comment
gb.sshKeyCommentDescription = Enter an optional comment. If blank, the comment will be extracted from the key data.
gb.permission = Permission
-gb.sshKeyPermissionDescription = Specify the access permission for the SSH key
\ No newline at end of file
+gb.sshKeyPermissionDescription = Specify the access permission for the SSH key
+gb.transportPreference = Transport Preference
+gb.transportPreferenceDescription = Set the transport that you prefer to use for cloning
\ No newline at end of file
<div wicket:id="emailAddress"></div>\r
<div wicket:id="language"></div>\r
<div wicket:id="emailMeOnMyTicketChanges"></div>\r
+ <div wicket:id="transport"></div>\r
\r
<div class="form-actions"><input class="btn btn-appmenu" type="submit" value="Save" wicket:message="value:gb.save" wicket:id="save" /></div>\r
</form> \r
import org.apache.wicket.model.IModel;\r
import org.apache.wicket.model.Model;\r
\r
+import com.gitblit.Constants.Transport;\r
import com.gitblit.GitBlitException;\r
import com.gitblit.Keys;\r
import com.gitblit.models.Menu.ParameterMenuItem;\r
final IModel<String> emailAddress = Model.of(user.emailAddress == null ? "" : user.emailAddress);\r
final IModel<Language> language = Model.of(preferredLanguage);\r
final IModel<Boolean> emailMeOnMyTicketChanges = Model.of(user.getPreferences().isEmailMeOnMyTicketChanges());\r
+ final IModel<Transport> transport = Model.of(user.getPreferences().getTransport());\r
\r
prefs.add(new TextOption("displayName",\r
getString("gb.displayName"),\r
getString("gb.emailMeOnMyTicketChangesDescription"),\r
emailMeOnMyTicketChanges).setVisible(app().notifier().isSendingMail()));\r
\r
+ List<Transport> availableTransports = new ArrayList<>();\r
+ if (app().gitblit().isServingSSH()) {\r
+ availableTransports.add(Transport.SSH);\r
+ }\r
+ if (app().gitblit().isServingHTTP()) {\r
+ availableTransports.add(Transport.HTTPS);\r
+ availableTransports.add(Transport.HTTP);\r
+ }\r
+ if (app().gitblit().isServingGIT()) {\r
+ availableTransports.add(Transport.GIT);\r
+ }\r
+\r
+ prefs.add(new ChoiceOption<Transport>("transport",\r
+ getString("gb.transportPreference"),\r
+ getString("gb.transportPreferenceDescription"),\r
+ transport,\r
+ availableTransports));\r
+\r
prefs.add(new AjaxButton("save") {\r
\r
private static final long serialVersionUID = 1L;\r
}\r
\r
user.getPreferences().setEmailMeOnMyTicketChanges(emailMeOnMyTicketChanges.getObject());\r
+ user.getPreferences().setTransport(transport.getObject());\r
\r
try {\r
app().gitblit().reviseUser(user.username, user);\r