Constraints, gauge symmetries, and noncommutative gravity in two dimensions